@zeniai/client-epic-state 5.0.14-betaRR01 → 5.0.14

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 (64) hide show
  1. package/lib/entity/file/fileState.d.ts +4 -4
  2. package/lib/entity/file/fileState.js +0 -4
  3. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  4. package/lib/entity/snackbar/snackbarTypes.js +0 -2
  5. package/lib/entity/task/taskPayload.d.ts +0 -3
  6. package/lib/entity/task/taskPayload.js +0 -5
  7. package/lib/entity/task/taskState.d.ts +0 -3
  8. package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
  9. package/lib/epic.d.ts +1 -3
  10. package/lib/epic.js +1 -3
  11. package/lib/esm/entity/file/fileState.js +0 -4
  12. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
  13. package/lib/esm/entity/task/taskPayload.js +0 -5
  14. package/lib/esm/epic.js +1 -3
  15. package/lib/esm/index.js +4 -4
  16. package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
  17. package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
  18. package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
  19. package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
  20. package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -4
  21. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +1 -51
  22. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -15
  23. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +21 -56
  24. package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
  25. package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -13
  26. package/lib/esm/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
  27. package/lib/esm/view/taskManager/taskListView/taskList.js +0 -7
  28. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -91
  29. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +39 -48
  30. package/lib/index.d.ts +4 -4
  31. package/lib/index.js +4 -9
  32. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  33. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  34. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
  35. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
  36. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
  37. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
  38. package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
  39. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
  40. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -2
  41. package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -4
  42. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -10
  43. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +2 -52
  44. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -5
  45. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -15
  46. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +7 -6
  47. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +22 -56
  48. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
  49. package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -13
  50. package/lib/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
  51. package/lib/view/taskManager/taskListView/taskList.d.ts +1 -14
  52. package/lib/view/taskManager/taskListView/taskList.js +1 -8
  53. package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
  54. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +2 -6
  55. package/lib/view/taskManager/taskListView/taskListReducer.js +13 -92
  56. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -9
  57. package/lib/view/taskManager/taskListView/taskListSelector.js +39 -48
  58. package/package.json +1 -1
  59. package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -65
  60. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -56
  61. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
  62. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -69
  63. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -9
  64. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -60
package/lib/esm/index.js CHANGED
@@ -354,12 +354,12 @@ import { toSubscriptionSortKeyType, } from './view/subscriptionView/types/subscr
354
354
  import { createTag, deleteTag, fetchTagList, } from './view/tagView/tagViewReducer';
355
355
  import { getAllTags } from './view/tagView/tagViewSelector';
356
356
  import { initialTaskDetail, initialTaskDetailLocalData, } from './view/taskManager/taskDetailView/taskDetail';
357
- import { archiveTask, deleteTask, discardTaskUpdatesInLocalStore, fetchTaskDetailPage, saveTaskDetail, saveTaskUpdatesToLocalStore, snoozeTask, unsnoozeTask, } from './view/taskManager/taskDetailView/taskDetailReducer';
357
+ import { archiveTask, deleteTask, discardTaskUpdatesInLocalStore, fetchTaskDetailPage, saveTaskDetail, saveTaskUpdatesToLocalStore, } from './view/taskManager/taskDetailView/taskDetailReducer';
358
358
  import { allTaskPriority, allTaskStatus, getTaskDetail, } from './view/taskManager/taskDetailView/taskDetailSelector';
359
359
  import { createTaskFromTaskGroupTemplate } from './view/taskManager/taskGroupTemplateView/taskGroupTemplateViewReducer';
360
360
  import { createNewTaskGroup, deleteTaskGroup, fetchAllTaskGroups, updateTaskGroupName, } from './view/taskManager/taskGroupView/taskGroupViewReducer';
361
- import { TASK_LIST_FILTER_CATEGORIES, TASK_LIST_GROUP_BY_CATEGORIES, toDueDateGroupKeyType, toTaskListGroupByKeyType, toTaskListGroupByKeyTypeStrict, ALL_TASK_LIST_TABS, } from './view/taskManager/taskListView/taskList';
362
- import { bulkUpdateTaskList, dragNDropTasks, fetchTaskListPage, initiateTaskListLocalData, removeTaskFromList, updateTaskFilters, updateTaskFromListView, updateTaskListLocalData, updateTaskListSearchText, updateTaskListTab, updateTaskListUIState, } from './view/taskManager/taskListView/taskListReducer';
361
+ import { TASK_LIST_FILTER_CATEGORIES, TASK_LIST_GROUP_BY_CATEGORIES, toDueDateGroupKeyType, toTaskListGroupByKeyType, toTaskListGroupByKeyTypeStrict, } from './view/taskManager/taskListView/taskList';
362
+ import { bulkUpdateTaskList, dragNDropTasks, fetchTaskListPage, initiateTaskListLocalData, updateTaskFilters, updateTaskFromListView, updateTaskListLocalData, updateTaskListSearchText, updateTaskListUIState, } from './view/taskManager/taskListView/taskListReducer';
363
363
  import { getAllTasks, } from './view/taskManager/taskListView/taskListSelector';
364
364
  import { getDueDateValueFromDueDateGroupId, getTaskUpdates, } from './view/taskManager/taskListView/taskListViewHelpers';
365
365
  import { fetchTasksCard } from './view/tasksCard/tasksCardReducer';
@@ -591,7 +591,7 @@ export { fetchGlobalMerchantRecommendation, createGlobalMerchant, updateCreateGl
591
591
  export { approveVendorGlobalReview, rejectVendorGlobalReview, fetchVendorGlobalReviewView, updateSelectedGlobalMerchant, updateVendorGlobalReviewViewUIState, getVendorGlobalReviewView, getTenantMerchantByMerchantId, toVendorGlobalReviewColumnSortKeyType, updateVendorGlobalReviewViewLocalData, };
592
592
  export { fetchArAging, updateArAgingUIState, fetchArAgingDetail, updateArAgingDetailUIState, getArAgingReport, getArAgingDetailForCustomer, updateArAgingNodeCollapseState, };
593
593
  export { toRecurringBillFrequency, toRecurringBillFrequencyStrict, };
594
- export { getTaskGroupById, getAllTasks, fetchTaskListPage, getTaskDetail, fetchTaskDetailPage, saveTaskUpdatesToLocalStore, saveTaskDetail, archiveTask, updateTaskListSearchText, updateTaskListUIState, allTaskStatus, allTaskPriority, updateTaskFilters, TASK_LIST_FILTER_CATEGORIES, TASK_LIST_GROUP_BY_CATEGORIES, deleteTask, discardTaskUpdatesInLocalStore, bulkUpdateTaskList, createNewTaskGroup, initiateTaskListLocalData, deleteTaskGroup, updateTaskListLocalData, dragNDropTasks, updateTaskGroupName, toTaskListGroupByKeyType, toTaskListGroupByKeyTypeStrict, getTaskUpdates, fetchAllTaskGroups, initialTaskDetail, getDueDateValueFromDueDateGroupId, toPriorityCodeType, toTaskStatusCodeType, toDueDateGroupKeyType, updateTaskFromListView, updateTaskListTab, removeTaskFromList, snoozeTask, unsnoozeTask, convertHHMMStrToMinutes, initialTaskDetailLocalData, ALL_TASK_LIST_TABS, };
594
+ export { getTaskGroupById, getAllTasks, fetchTaskListPage, getTaskDetail, fetchTaskDetailPage, saveTaskUpdatesToLocalStore, saveTaskDetail, archiveTask, updateTaskListSearchText, updateTaskListUIState, allTaskStatus, allTaskPriority, updateTaskFilters, TASK_LIST_FILTER_CATEGORIES, TASK_LIST_GROUP_BY_CATEGORIES, deleteTask, discardTaskUpdatesInLocalStore, bulkUpdateTaskList, createNewTaskGroup, initiateTaskListLocalData, deleteTaskGroup, updateTaskListLocalData, dragNDropTasks, updateTaskGroupName, toTaskListGroupByKeyType, toTaskListGroupByKeyTypeStrict, getTaskUpdates, fetchAllTaskGroups, initialTaskDetail, getDueDateValueFromDueDateGroupId, toPriorityCodeType, toTaskStatusCodeType, toDueDateGroupKeyType, updateTaskFromListView, convertHHMMStrToMinutes, initialTaskDetailLocalData, };
595
595
  export { getAllTags, fetchTagList, createTag, deleteTag, };
596
596
  export { getAllCardsAndBankPaymentMethods, createCardSetupIntent, confirmCardSetupIntent, addCardPaymentSource, fetchPaymentSources, resetCardPaymentErrorStatuses, clearCardPaymentView, };
597
597
  export { getAuditReportGroupViewSelectorView, getAuditRuleGroupViewSelectorView, getUserFromAllUsers, fetchAuditRuleGroupView, fetchAuditReportGroupView, saveReasonForAuditRule, clearAuditReportGroupViewByCompanyId, };
@@ -4,7 +4,6 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTasks } from '../../../../entity/task/taskReducer';
5
5
  import { getTaskById } from '../../../../entity/task/taskSelector';
6
6
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
- import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
8
7
  import { archiveTask, archiveTaskSuccessOrFailure } from '../taskDetailReducer';
9
8
  // Epic function to handle archiving of tasks
10
9
  export const archiveTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(archiveTask.match), mergeMap((action) => handleArchiveTask(action.payload.taskId, state$, zeniAPI)));
@@ -26,8 +25,6 @@ const handleApiResponse = (response, taskId) => {
26
25
  response.data.tasks.length > 0) {
27
26
  const fetchActions = [
28
27
  updateTasks(response.data.tasks),
29
- removeTaskFromList(taskId),
30
- fetchTaskList(),
31
28
  archiveTaskSuccessOrFailure({
32
29
  fetchState: 'Completed',
33
30
  taskId,
@@ -2,7 +2,6 @@ import { from, of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
5
- import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
6
5
  import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
7
6
  export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteTask.match), mergeMap((action) => {
8
7
  const { taskId } = action.payload;
@@ -11,10 +10,6 @@ export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filt
11
10
  .pipe(mergeMap((response) => {
12
11
  if (isSuccessStatus(response)) {
13
12
  const actions = [];
14
- if (taskId != null) {
15
- actions.push(removeTaskFromList(taskId));
16
- }
17
- actions.push(fetchTaskList());
18
13
  actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
19
14
  return from(actions);
20
15
  }
@@ -25,7 +25,6 @@ export const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pip
25
25
  savedRecurringEndDate: task.recurringEndDate,
26
26
  recurringStartDate: task.recurringStartDate,
27
27
  timeSpent: task.timeSpent,
28
- isPrivate: task.isPrivate,
29
28
  };
30
29
  const actions = [
31
30
  saveTaskUpdatesToLocalStore({ taskDetailLocalData, taskId }),
@@ -94,6 +94,5 @@ const prepareTaskPayload = (state, taskId, taskGroupId) => {
94
94
  sync_token: syncToken,
95
95
  task_group_ids: taskGroupId != null ? [taskGroupId] : [],
96
96
  time_spent: convertHHMMStrToMinutes(localData.timeSpent),
97
- ...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
98
97
  };
99
98
  };
@@ -31,9 +31,5 @@ export const initialTaskDetail = {
31
31
  fetchState: 'Not-Started',
32
32
  error: undefined,
33
33
  },
34
- snoozeStatus: {
35
- fetchState: 'Not-Started',
36
- error: undefined,
37
- },
38
34
  taskDetailLocalData: initialTaskDetailLocalData,
39
35
  };
@@ -229,56 +229,6 @@ const taskDetailView = createSlice({
229
229
  draft.newTaskState.deleteTaskStatus.error = action.payload.error;
230
230
  }
231
231
  },
232
- snoozeTask: {
233
- reducer(draft, action) {
234
- const { taskId } = action.payload;
235
- draft.editTaskStateById[taskId] = {
236
- ...(draft.editTaskStateById[taskId] != null
237
- ? draft.editTaskStateById[taskId]
238
- : initialTaskDetail),
239
- snoozeStatus: {
240
- fetchState: 'In-Progress',
241
- error: undefined,
242
- },
243
- };
244
- },
245
- prepare(taskId, snoozedUntil) {
246
- return {
247
- payload: {
248
- taskId,
249
- snoozedUntil,
250
- },
251
- };
252
- },
253
- },
254
- snoozeTaskSuccessOrFailure(draft, action) {
255
- const { taskId, fetchState, error } = action.payload;
256
- if (draft.editTaskStateById[taskId] != null) {
257
- draft.editTaskStateById[taskId].snoozeStatus.fetchState = fetchState;
258
- draft.editTaskStateById[taskId].snoozeStatus.error = error;
259
- }
260
- },
261
- unsnoozeTask: {
262
- reducer(draft, action) {
263
- const { taskId } = action.payload;
264
- draft.editTaskStateById[taskId] = {
265
- ...(draft.editTaskStateById[taskId] != null
266
- ? draft.editTaskStateById[taskId]
267
- : initialTaskDetail),
268
- snoozeStatus: {
269
- fetchState: 'In-Progress',
270
- error: undefined,
271
- },
272
- };
273
- },
274
- prepare(taskId) {
275
- return {
276
- payload: {
277
- taskId,
278
- },
279
- };
280
- },
281
- },
282
232
  fetchTaskHistory: {
283
233
  reducer(draft, action) {
284
234
  const { taskId, cacheOverride } = action.payload;
@@ -320,5 +270,5 @@ const taskDetailView = createSlice({
320
270
  },
321
271
  },
322
272
  });
323
- export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, snoozeTask, snoozeTaskSuccessOrFailure, unsnoozeTask, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
273
+ export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
324
274
  export default taskDetailView.reducer;
@@ -6,14 +6,13 @@ import { getTaskById } from '../../../entity/task/taskSelector';
6
6
  import { getUserAndUserRole, } from '../../companyView/types/userAndRole';
7
7
  import { getFileDeleteStatusById, getFileUpdateNameStatusById, } from '../../fileView/fileViewSelector';
8
8
  import { getUserList, } from '../../userListView/userListViewSelector';
9
- import { initialTaskDetail } from './taskDetail';
10
9
  export const getTaskDetail = (state, taskId) => {
11
10
  const { taskDetailState, classListState, classState, fileState, fileViewState, userState, userRoleState, userListViewState, addressState, taskState, } = state;
12
11
  const deleteFileStatusById = {};
13
12
  const updateFileStatusById = {};
14
13
  let showTaskDetailFormFooter = false;
15
14
  const sourceTaskDetail = taskId != null
16
- ? (taskDetailState.editTaskStateById[taskId] ?? initialTaskDetail)
15
+ ? taskDetailState.editTaskStateById[taskId]
17
16
  : taskDetailState.newTaskState;
18
17
  const userList = getUserList(userState, userRoleState, userListViewState, 'taskManagerCandidate');
19
18
  let fetchStatus = {
@@ -22,19 +21,11 @@ export const getTaskDetail = (state, taskId) => {
22
21
  };
23
22
  let taskHistory = [];
24
23
  let createdByUser = undefined;
25
- let isArchived = undefined;
26
- let isDeleted = undefined;
27
- let recurringSourceTaskId = undefined;
28
- let snoozedUntil = undefined;
29
24
  if (taskId != null && sourceTaskDetail != null) {
30
25
  const taskEntity = getTaskById(taskState, taskId);
31
26
  const fileIdsInEntity = taskEntity?.fileIds ?? [];
32
27
  if (taskEntity != null) {
33
28
  createdByUser = getUserAndUserRole(userState, userRoleState, addressState, taskEntity.createdBy);
34
- isArchived = taskEntity.isArchived;
35
- isDeleted = taskEntity.isDeleted;
36
- recurringSourceTaskId = taskEntity.recurringSourceTaskId;
37
- snoozedUntil = taskEntity.snoozedUntil;
38
29
  }
39
30
  if (fileIdsInEntity.length > 0) {
40
31
  fetchStatus = reduceFetchState([
@@ -52,7 +43,7 @@ export const getTaskDetail = (state, taskId) => {
52
43
  ]);
53
44
  }
54
45
  showTaskDetailFormFooter = showFormFooter(sourceTaskDetail.taskDetailLocalData, taskEntity);
55
- taskHistory = taskDetailState.taskHistoryById[taskId]?.historicEvents ?? [];
46
+ taskHistory = taskDetailState.taskHistoryById[taskId].historicEvents;
56
47
  }
57
48
  else if (taskId == null) {
58
49
  fetchStatus = reduceFetchState([userList, classListState]);
@@ -82,11 +73,7 @@ export const getTaskDetail = (state, taskId) => {
82
73
  error: fetchStatus.error,
83
74
  version: 0,
84
75
  createdByUser,
85
- isArchived,
86
- isDeleted,
87
- recurringSourceTaskId,
88
76
  showTaskDetailFormFooter,
89
- snoozedUntil,
90
77
  };
91
78
  };
92
79
  export const allTaskStatus = [
@@ -5,26 +5,21 @@ import { convertHHMMStrToMinutes } from '../../../../commonStateTypes/fiscalYear
5
5
  import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
6
6
  import { updateTasks } from '../../../../entity/task/taskReducer';
7
7
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
- import { bulkUpdateTaskList, fetchTaskList, updateTasksListOnBulkUpdateTasksFailure, updateTasksListOnBulkUpdateTasksSuccess, } from '../taskListReducer';
9
- export const bulkUpdateTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUpdateTaskList.match), switchMap((action) => {
8
+ import { bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksFailure, updateTasksListOnBulkUpdateTasksSuccess, } from '../taskListReducer';
9
+ export const bulkUpdateTaskListEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(bulkUpdateTaskList.match), switchMap((action) => {
10
+ const state = state$.value;
10
11
  const { taskIds, updates, groupId } = action.payload;
11
- const bulkUpdates = toBulkUpdatesPayload(updates);
12
- if (groupId != null) {
13
- bulkUpdates.task_group_ids = [groupId];
14
- }
15
- const payload = { task_ids: taskIds, updates: bulkUpdates };
12
+ const payload = {
13
+ tasks: getTasksListPayload(state, taskIds, updates),
14
+ };
16
15
  return zeniAPI
17
- .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/bulk-update`, payload)
16
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
18
17
  .pipe(mergeMap((response) => {
19
18
  if (isSuccessResponse(response) && response.data != null) {
20
- const removeFromList = updates.isArchived === true ||
21
- updates.isDeleted === true ||
22
- ('snoozedUntil' in updates && updates.snoozedUntil != null);
23
19
  return of(updateTasks(response.data.tasks), updateTasksListOnBulkUpdateTasksSuccess({
24
20
  taskIds,
25
21
  groupId,
26
- removeFromList,
27
- }), fetchTaskList());
22
+ }));
28
23
  }
29
24
  else {
30
25
  return of(updateTasksListOnBulkUpdateTasksFailure({
@@ -38,46 +33,19 @@ export const bulkUpdateTaskListEpic = (actions$, _state$, zeniAPI) => actions$.p
38
33
  }));
39
34
  }));
40
35
  }));
41
- /**
42
- * Helpers
43
- */
44
- const toBulkUpdatesPayload = (updates) => {
45
- const payload = {};
46
- if (updates.status != null) {
47
- payload.status = updates.status.code;
48
- }
49
- if (updates.priority != null) {
50
- payload.priority = updates.priority.code;
51
- }
52
- if (updates.assignees != null) {
53
- payload.assignees = updates.assignees;
54
- }
55
- if (updates.groupAssignees != null) {
56
- payload.group_assignees = updates.groupAssignees;
57
- }
58
- if (updates.dueDate != null) {
59
- payload.due_date = updates.dueDate.format(DEFAULT_DATE_FORMAT);
60
- }
61
- if (updates.tagIds != null) {
62
- payload.tags = updates.tagIds;
63
- }
64
- if (updates.timeSpent != null) {
65
- payload.time_spent = convertHHMMStrToMinutes(updates.timeSpent.replace(/\D/g, ''));
66
- }
67
- if (updates.isArchived != null) {
68
- payload.is_archived = updates.isArchived;
69
- }
70
- if (updates.isDeleted != null) {
71
- payload.is_deleted = updates.isDeleted;
72
- }
73
- // Bulk snooze is not supported — only bulk unsnooze (clear all snooze fields)
74
- if ('snoozedUntil' in updates) {
75
- payload.snoozed_until = null;
76
- payload.snoozed_by = null;
77
- payload.snoozed_at = null;
78
- payload.is_snooze_notification_sent = false;
79
- }
80
- return payload;
36
+ export const getTasksListPayload = (state, taskIds, updates) => {
37
+ const { taskState } = state;
38
+ const tasksList = taskIds
39
+ .map((taskId) => {
40
+ const task = get(taskState.taskByID, taskId);
41
+ return {
42
+ ...task,
43
+ ...updates,
44
+ };
45
+ })
46
+ .filter((task) => task != null);
47
+ const tasksPayload = tasksList.map((task) => toTaskPayload(state, task));
48
+ return tasksPayload;
81
49
  };
82
50
  export const getTaskPayload = (state, taskId, updates) => {
83
51
  const { taskState } = state;
@@ -103,9 +71,6 @@ const toTaskPayload = (state, task) => {
103
71
  assignees: task.assignees,
104
72
  description: task.description,
105
73
  group_assignees: task.groupAssignees,
106
- is_archived: task.isArchived,
107
- is_deleted: task.isDeleted,
108
- snoozed_until: task.snoozedUntil != null ? task.snoozedUntil.toISOString() : null,
109
74
  due_date: task.dueDate != null ? task.dueDate.format(DEFAULT_DATE_FORMAT) : null,
110
75
  priority: task.priority.code,
111
76
  status: task.status.code,
@@ -11,7 +11,6 @@ export const dragNDropTasksEpic = (actions$, state$) => actions$.pipe(filter(dra
11
11
  updateTasksListOnBulkUpdateTasksSuccess({
12
12
  taskIds,
13
13
  groupId,
14
- removeFromList: false,
15
14
  }),
16
15
  bulkUpdateTaskList(taskIds, groupId, updates),
17
16
  ];
@@ -9,20 +9,10 @@ export const fetchTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
9
9
  .getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(`{"task_type": "all"}`)}`)
10
10
  .pipe(mergeMap((response) => {
11
11
  if (isSuccessResponse(response) && response.data != null) {
12
- const { tasks, deleted, archived, snoozed } = response.data;
13
- const allTasks = [
14
- ...tasks,
15
- ...(deleted ?? []),
16
- ...(archived ?? []),
17
- ...(snoozed ?? []),
18
- ];
19
- return of(updateTasks(allTasks), updateTaskList({
20
- data: tasks,
21
- deleted: deleted ?? [],
22
- archived: archived ?? [],
23
- snoozed: snoozed ?? [],
12
+ return of(updateTasks(response.data.tasks), updateTaskList({
13
+ data: response.data.tasks,
24
14
  updateType: 'replace',
25
- }), updateTags(allTasks.map((task) => task.tags).flat()));
15
+ }), updateTags(response.data.tasks.map((task) => task.tags).flat()));
26
16
  }
27
17
  else {
28
18
  return of(updateTaskListFetchStatus({
@@ -8,10 +8,9 @@ export const updateTaskFromListViewEpic = (actions$, state$, zeniAPI) => actions
8
8
  const state = state$.value;
9
9
  const { task, updates } = action.payload;
10
10
  const taskId = task.id;
11
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
- const { snoozed_until: _snoozedUntil, ...taskData } = getTaskPayload(state, taskId, updates);
11
+ const taskData = getTaskPayload(state, taskId, updates);
13
12
  return zeniAPI
14
- .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, taskData)
13
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, { ...taskData })
15
14
  .pipe(mergeMap((response) => {
16
15
  if (isSuccessResponse(response) && response.data != null) {
17
16
  return from([
@@ -1,10 +1,4 @@
1
1
  import { stringToUnion, stringToUnionStrict, } from '../../../commonStateTypes/stringToUnion';
2
- export const ALL_TASK_LIST_TABS = [
3
- 'live',
4
- 'archived',
5
- 'deleted',
6
- 'snoozed',
7
- ];
8
2
  export const DUE_DATE_GROUP_KEYS = [
9
3
  'overdue',
10
4
  'today',
@@ -32,7 +26,6 @@ const ALL_TASK_LIST_SORT_KEYS = [
32
26
  'status',
33
27
  'priority',
34
28
  'timeSpent',
35
- 'visibility',
36
29
  ];
37
30
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
31
  const toTaskListSortKeyType = (v) => stringToUnion(v, ALL_TASK_LIST_SORT_KEYS);
@@ -29,23 +29,7 @@ const initialTaskIdsByDueDate = {
29
29
  today: [],
30
30
  upcoming: [],
31
31
  };
32
- const initialTabData = {
33
- taskIds: [],
34
- taskIdsByAssignees: {},
35
- taskIdsByDueDate: { ...initialTaskIdsByDueDate },
36
- taskIdsByGroupsIds: {},
37
- taskIdsByPriority: { ...initialTaskIdsByPriority },
38
- taskIdsByStatus: { ...initialTaskIdsByStatus },
39
- taskIdsByTags: {},
40
- };
41
32
  export const initialState = {
42
- currentTab: 'live',
43
- byTab: {
44
- live: { ...initialTabData },
45
- archived: { ...initialTabData },
46
- deleted: { ...initialTabData },
47
- snoozed: { ...initialTabData },
48
- },
49
33
  taskIds: [],
50
34
  taskIdsByGroupsIds: {},
51
35
  taskIdsByPriority: initialTaskIdsByPriority,
@@ -102,30 +86,17 @@ const taskList = createSlice({
102
86
  draft.error = undefined;
103
87
  },
104
88
  updateTaskList(draft, action) {
105
- const { data, archived, deleted, snoozed } = action.payload;
89
+ const { data } = action.payload;
106
90
  draft.fetchState = 'Completed';
107
91
  draft.error = undefined;
108
- // Group live tasks
109
- const liveGrouped = getGroupedTaskIds(data);
110
- draft.byTab.live = toTabData(liveGrouped);
111
- // Group other tabs if provided
112
- if (archived != null) {
113
- draft.byTab.archived = toTabData(getGroupedTaskIds(archived));
114
- }
115
- if (deleted != null) {
116
- draft.byTab.deleted = toTabData(getGroupedTaskIds(deleted));
117
- }
118
- if (snoozed != null) {
119
- draft.byTab.snoozed = toTabData(getGroupedTaskIds(snoozed));
120
- }
121
- // Copy active tab data to top-level fields
122
- const activeTabData = draft.byTab[draft.currentTab];
123
- copyTabDataToTopLevel(draft, activeTabData);
124
- },
125
- updateTaskListTab(draft, action) {
126
- draft.currentTab = action.payload;
127
- const activeTabData = draft.byTab[action.payload];
128
- copyTabDataToTopLevel(draft, activeTabData);
92
+ const { taskIds, taskIdsGroupedByPriority, taskIdsByGroupIds, taskIdsGroupedByStatus, taskIdsByAssignees, taskIdsByDueDate, taskIdsByTags, } = getGroupedTaskIds(data);
93
+ draft.taskIds = taskIds;
94
+ draft.taskIdsByGroupsIds = taskIdsByGroupIds;
95
+ draft.taskIdsByPriority = taskIdsGroupedByPriority;
96
+ draft.taskIdsByStatus = taskIdsGroupedByStatus;
97
+ draft.taskIdsByAssignees = taskIdsByAssignees;
98
+ draft.taskIdsByDueDate = taskIdsByDueDate;
99
+ draft.taskIdsByTags = taskIdsByTags;
129
100
  },
130
101
  initiateTaskListLocalData(draft, action) {
131
102
  const { taskGroupById } = action.payload;
@@ -213,13 +184,10 @@ const taskList = createSlice({
213
184
  },
214
185
  },
215
186
  updateTasksListOnBulkUpdateTasksSuccess(draft, action) {
216
- const { taskIds, groupId, removeFromList } = action.payload;
187
+ const { taskIds, groupId } = action.payload;
217
188
  draft.updateTasksFetchState.fetchState = 'Completed';
218
189
  draft.updateTasksFetchState.error = undefined;
219
- if (removeFromList) {
220
- removeTaskIds(draft, taskIds);
221
- }
222
- else if (groupId != null) {
190
+ if (groupId != null) {
223
191
  const { groupByKey } = draft.uiState;
224
192
  if (groupByKey === 'groupName') {
225
193
  Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
@@ -436,15 +404,12 @@ const taskList = createSlice({
436
404
  draft.updateTasksFetchState.fetchState = 'Error';
437
405
  draft.updateTasksFetchState.error = action.payload.error;
438
406
  },
439
- removeTaskFromList(draft, action) {
440
- removeTaskIds(draft, [action.payload]);
441
- },
442
407
  clearTaskList(draft) {
443
408
  Object.assign(draft, initialState);
444
409
  },
445
410
  },
446
411
  });
447
- export const { fetchTaskListPage, fetchTaskList, updateTaskList, updateTaskListTab, updateTaskListFetchStatus, updateTaskListSearchText, updateTaskListUIState, updateTaskFilters, updateTaskListOnNewGroupCreationSuccess, bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksSuccess, updateTasksListOnBulkUpdateTasksFailure, initiateTaskListLocalData, updateTaskListLocalData, updateTaskListOnTaskGroupDeletion, dragNDropTasks, updateTaskListOnNewTaskCreationSuccess, updateTaskListOnTaskGroupNameUpdate, updateTaskFromListView, updateTasksListOnUpdateTaskSuccess, updateTasksListOnUpdateTaskFailure, updateTaskListOnCreateTaskFromTemplateSuccess, removeTaskFromList, clearTaskList, } = taskList.actions;
412
+ export const { fetchTaskListPage, fetchTaskList, updateTaskList, updateTaskListFetchStatus, updateTaskListSearchText, updateTaskListUIState, updateTaskFilters, updateTaskListOnNewGroupCreationSuccess, bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksSuccess, updateTasksListOnBulkUpdateTasksFailure, initiateTaskListLocalData, updateTaskListLocalData, updateTaskListOnTaskGroupDeletion, dragNDropTasks, updateTaskListOnNewTaskCreationSuccess, updateTaskListOnTaskGroupNameUpdate, updateTaskFromListView, updateTasksListOnUpdateTaskSuccess, updateTasksListOnUpdateTaskFailure, updateTaskListOnCreateTaskFromTemplateSuccess, clearTaskList, } = taskList.actions;
448
413
  export default taskList.reducer;
449
414
  /**
450
415
  * helpers
@@ -523,50 +488,6 @@ const getTagsGroupKey = (tags) => {
523
488
  tagIds.sort();
524
489
  return tagIds.join(',');
525
490
  };
526
- const toTabData = (grouped) => ({
527
- taskIds: grouped.taskIds,
528
- taskIdsByAssignees: grouped.taskIdsByAssignees,
529
- taskIdsByDueDate: grouped.taskIdsByDueDate,
530
- taskIdsByGroupsIds: grouped.taskIdsByGroupIds,
531
- taskIdsByPriority: grouped.taskIdsGroupedByPriority,
532
- taskIdsByStatus: grouped.taskIdsGroupedByStatus,
533
- taskIdsByTags: grouped.taskIdsByTags,
534
- });
535
- const copyTabDataToTopLevel = (draft, tabData) => {
536
- draft.taskIds = tabData.taskIds;
537
- draft.taskIdsByGroupsIds = tabData.taskIdsByGroupsIds;
538
- draft.taskIdsByPriority = tabData.taskIdsByPriority;
539
- draft.taskIdsByStatus = tabData.taskIdsByStatus;
540
- draft.taskIdsByAssignees = tabData.taskIdsByAssignees;
541
- draft.taskIdsByDueDate = tabData.taskIdsByDueDate;
542
- draft.taskIdsByTags = tabData.taskIdsByTags;
543
- };
544
- const removeIdsFromTabData = (tabData, taskIds) => {
545
- const isRemoved = (id) => taskIds.includes(id);
546
- tabData.taskIds = tabData.taskIds.filter((id) => !isRemoved(id));
547
- Object.keys(tabData.taskIdsByGroupsIds).forEach((gId) => {
548
- tabData.taskIdsByGroupsIds[gId] = tabData.taskIdsByGroupsIds[gId].filter((id) => !isRemoved(id));
549
- });
550
- Object.keys(tabData.taskIdsByPriority).forEach((key) => {
551
- tabData.taskIdsByPriority[key] = tabData.taskIdsByPriority[key].filter((id) => !isRemoved(id));
552
- });
553
- Object.keys(tabData.taskIdsByStatus).forEach((key) => {
554
- tabData.taskIdsByStatus[key] = tabData.taskIdsByStatus[key].filter((id) => !isRemoved(id));
555
- });
556
- Object.keys(tabData.taskIdsByDueDate).forEach((key) => {
557
- tabData.taskIdsByDueDate[key] = tabData.taskIdsByDueDate[key].filter((id) => !isRemoved(id));
558
- });
559
- Object.keys(tabData.taskIdsByAssignees).forEach((key) => {
560
- tabData.taskIdsByAssignees[key] = tabData.taskIdsByAssignees[key].filter((id) => !isRemoved(id));
561
- });
562
- Object.keys(tabData.taskIdsByTags).forEach((key) => {
563
- tabData.taskIdsByTags[key] = tabData.taskIdsByTags[key].filter((id) => !isRemoved(id));
564
- });
565
- };
566
- const removeTaskIds = (draft, taskIds) => {
567
- removeIdsFromTabData(draft, taskIds);
568
- removeIdsFromTabData(draft.byTab[draft.currentTab], taskIds);
569
- };
570
491
  const getGroupedTaskIds = (tasks) => {
571
492
  const taskIds = [];
572
493
  const taskIdsByGroupIds = {};