@zeniai/client-epic-state 5.0.37 → 5.0.38

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 (144) hide show
  1. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +1 -0
  2. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +2 -1
  3. package/lib/entity/file/fileState.d.ts +4 -4
  4. package/lib/entity/file/fileState.js +4 -0
  5. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  6. package/lib/entity/snackbar/snackbarTypes.js +4 -0
  7. package/lib/entity/task/taskPayload.d.ts +3 -0
  8. package/lib/entity/task/taskPayload.js +5 -0
  9. package/lib/entity/task/taskState.d.ts +3 -0
  10. package/lib/entity/tenant/clearAllEpic.d.ts +5 -2
  11. package/lib/entity/tenant/clearAllEpic.js +6 -0
  12. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +19 -0
  13. package/lib/entity/tenant/epic/deleteConnectionEpic.js +29 -0
  14. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +19 -0
  15. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +31 -0
  16. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +19 -0
  17. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +33 -0
  18. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  19. package/lib/entity/tenant/tenantReducer.d.ts +59 -1
  20. package/lib/entity/tenant/tenantReducer.js +139 -4
  21. package/lib/entity/tenant/tenantState.d.ts +7 -0
  22. package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
  23. package/lib/epic.d.ts +9 -1
  24. package/lib/epic.js +12 -1
  25. package/lib/esm/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +1 -0
  26. package/lib/esm/entity/file/fileState.js +4 -0
  27. package/lib/esm/entity/snackbar/snackbarTypes.js +4 -0
  28. package/lib/esm/entity/task/taskPayload.js +5 -0
  29. package/lib/esm/entity/tenant/clearAllEpic.js +6 -0
  30. package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +25 -0
  31. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +27 -0
  32. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +29 -0
  33. package/lib/esm/entity/tenant/tenantReducer.js +135 -2
  34. package/lib/esm/epic.js +12 -1
  35. package/lib/esm/index.js +15 -6
  36. package/lib/esm/init.js +71 -16
  37. package/lib/esm/reducer.js +9 -0
  38. package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +23 -0
  39. package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +25 -0
  40. package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +11 -0
  41. package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +106 -0
  42. package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +4 -0
  43. package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +1 -0
  44. package/lib/esm/view/taskManager/cannedResponsesView/cannedResponses.js +1 -0
  45. package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +12 -0
  46. package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +64 -0
  47. package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +3 -0
  48. package/lib/esm/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +17 -0
  49. package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +21 -0
  50. package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +29 -0
  51. package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +3 -0
  52. package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +5 -0
  53. package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
  54. package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -0
  55. package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +66 -0
  56. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +57 -0
  57. package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +4 -0
  58. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +60 -7
  59. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +12 -0
  60. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +56 -21
  61. package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -0
  62. package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -4
  63. package/lib/esm/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +3 -2
  64. package/lib/esm/view/taskManager/taskListView/taskList.js +7 -0
  65. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +106 -12
  66. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +48 -39
  67. package/lib/esm/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +65 -0
  68. package/lib/esm/view/zeniOAuthView/zeniOAuthParamsParser.js +41 -0
  69. package/lib/esm/view/zeniOAuthView/zeniOAuthReducer.js +49 -0
  70. package/lib/esm/view/zeniOAuthView/zeniOAuthSelector.js +3 -0
  71. package/lib/esm/view/zeniOAuthView/zeniOAuthState.js +1 -0
  72. package/lib/index.d.ts +18 -6
  73. package/lib/index.js +67 -30
  74. package/lib/init.d.ts +5 -3
  75. package/lib/init.js +71 -16
  76. package/lib/reducer.d.ts +9 -0
  77. package/lib/reducer.js +9 -0
  78. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  79. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  80. package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +16 -0
  81. package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +27 -0
  82. package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +14 -0
  83. package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +29 -0
  84. package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +23 -0
  85. package/lib/view/featureNotificationView/featureNotificationViewPayload.js +15 -0
  86. package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +19 -0
  87. package/lib/view/featureNotificationView/featureNotificationViewReducer.js +110 -0
  88. package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +6 -0
  89. package/lib/view/featureNotificationView/featureNotificationViewSelector.js +11 -0
  90. package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +26 -0
  91. package/lib/view/featureNotificationView/featureNotificationViewState.js +2 -0
  92. package/lib/view/taskManager/cannedResponsesView/cannedResponses.d.ts +19 -0
  93. package/lib/view/taskManager/cannedResponsesView/cannedResponses.js +2 -0
  94. package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.d.ts +21 -0
  95. package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +15 -0
  96. package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.d.ts +30 -0
  97. package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +68 -0
  98. package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.d.ts +3 -0
  99. package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +6 -0
  100. package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.d.ts +7 -0
  101. package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +21 -0
  102. package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.d.ts +7 -0
  103. package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +25 -0
  104. package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.d.ts +7 -0
  105. package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +33 -0
  106. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +2 -1
  107. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +3 -0
  108. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +2 -1
  109. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +5 -0
  110. package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
  111. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -0
  112. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +9 -0
  113. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +70 -0
  114. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +9 -0
  115. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +61 -0
  116. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +2 -0
  117. package/lib/view/taskManager/taskDetailView/taskDetail.js +4 -0
  118. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +10 -1
  119. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +61 -8
  120. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +5 -0
  121. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +12 -0
  122. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +6 -7
  123. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +56 -22
  124. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -0
  125. package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -4
  126. package/lib/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +3 -2
  127. package/lib/view/taskManager/taskListView/taskList.d.ts +14 -1
  128. package/lib/view/taskManager/taskListView/taskList.js +8 -1
  129. package/lib/view/taskManager/taskListView/taskListPayload.d.ts +3 -0
  130. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +9 -6
  131. package/lib/view/taskManager/taskListView/taskListReducer.js +107 -13
  132. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +9 -3
  133. package/lib/view/taskManager/taskListView/taskListSelector.js +48 -39
  134. package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.d.ts +27 -0
  135. package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +69 -0
  136. package/lib/view/zeniOAuthView/zeniOAuthParamsParser.d.ts +16 -0
  137. package/lib/view/zeniOAuthView/zeniOAuthParamsParser.js +44 -0
  138. package/lib/view/zeniOAuthView/zeniOAuthReducer.d.ts +29 -0
  139. package/lib/view/zeniOAuthView/zeniOAuthReducer.js +53 -0
  140. package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +5 -0
  141. package/lib/view/zeniOAuthView/zeniOAuthSelector.js +9 -0
  142. package/lib/view/zeniOAuthView/zeniOAuthState.d.ts +4 -0
  143. package/lib/view/zeniOAuthView/zeniOAuthState.js +2 -0
  144. package/package.json +1 -1
@@ -14,6 +14,7 @@ const dragNDropTasksEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
14
14
  (0, taskListReducer_1.updateTasksListOnBulkUpdateTasksSuccess)({
15
15
  taskIds,
16
16
  groupId,
17
+ removeFromList: false,
17
18
  }),
18
19
  (0, taskListReducer_1.bulkUpdateTaskList)(taskIds, groupId, updates),
19
20
  ];
@@ -12,10 +12,19 @@ const fetchTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, oper
12
12
  .getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(`{"task_type": "all"}`)}`)
13
13
  .pipe((0, operators_1.mergeMap)((response) => {
14
14
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
15
- return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(response.data.tasks), (0, taskListReducer_1.updateTaskList)({
16
- data: response.data.tasks,
17
- updateType: 'replace',
18
- }), (0, tagReducer_1.updateTags)(response.data.tasks.map((task) => task.tags).flat()));
15
+ const { tasks, deleted, archived, snoozed } = response.data;
16
+ const allTasks = [
17
+ ...tasks,
18
+ ...(deleted ?? []),
19
+ ...(archived ?? []),
20
+ ...(snoozed ?? []),
21
+ ];
22
+ return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(allTasks), (0, taskListReducer_1.updateTaskList)({
23
+ data: tasks,
24
+ deleted: deleted ?? [],
25
+ archived: archived ?? [],
26
+ snoozed: snoozed ?? [],
27
+ }), (0, tagReducer_1.updateTags)(allTasks.map((task) => task.tags).flat()));
19
28
  }
20
29
  else {
21
30
  return (0, rxjs_1.of)((0, taskListReducer_1.updateTaskListFetchStatus)({
@@ -11,9 +11,10 @@ const updateTaskFromListViewEpic = (actions$, state$, zeniAPI) => actions$.pipe(
11
11
  const state = state$.value;
12
12
  const { task, updates } = action.payload;
13
13
  const taskId = task.id;
14
- const taskData = (0, bulkUpdateTaskListEpic_1.getTaskPayload)(state, taskId, updates);
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ const { snoozed_until: _snoozedUntil, ...taskData } = (0, bulkUpdateTaskListEpic_1.getTaskPayload)(state, taskId, updates);
15
16
  return zeniAPI
16
- .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, { ...taskData })
17
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, taskData)
17
18
  .pipe((0, operators_1.mergeMap)((response) => {
18
19
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
20
  return (0, rxjs_1.from)([
@@ -3,6 +3,17 @@ import { PriorityCodeType, TaskStatusCodeType } from '../../../entity/task/taskS
3
3
  import { ZeniDate } from '../../../zeniDayJS';
4
4
  import { SpendManagementUIState } from '../../spendManagement/billPay/billList/billListState';
5
5
  import { CategoryCombinationOperator, FilterCategoryType } from '../../spendManagement/spendManagementFilterHelpers';
6
+ export declare const ALL_TASK_LIST_TABS: readonly ["live", "archived", "deleted", "snoozed"];
7
+ export type TaskListTab = (typeof ALL_TASK_LIST_TABS)[number];
8
+ export interface TaskListTabData {
9
+ taskIds: ID[];
10
+ taskIdsByAssignees: Record<ID, ID[]>;
11
+ taskIdsByDueDate: Record<DueDateGroupKey, ID[]>;
12
+ taskIdsByGroupsIds: Record<ID, ID[]>;
13
+ taskIdsByPriority: Record<PriorityCodeType, ID[]>;
14
+ taskIdsByStatus: Record<TaskStatusCodeType, ID[]>;
15
+ taskIdsByTags: Record<ID, ID[]>;
16
+ }
6
17
  export interface TaskListLocalData {
7
18
  defaultTaskGroupId: ID | null;
8
19
  existingTaskGroupNamesByGroupId: Record<ID, string>;
@@ -13,6 +24,8 @@ export declare const DUE_DATE_GROUP_KEYS: readonly ["overdue", "today", "this_we
13
24
  export declare const toDueDateGroupKeyType: (v: string) => "overdue" | "today" | "this_week" | "this_month" | "upcoming";
14
25
  export declare type DueDateGroupKey = ReturnType<typeof toDueDateGroupKeyType>;
15
26
  export interface TaskListState extends FetchedState {
27
+ byTab: Record<TaskListTab, TaskListTabData>;
28
+ currentTab: TaskListTab;
16
29
  filters: TaskListFilters;
17
30
  localData: TaskListLocalData;
18
31
  taskIds: ID[];
@@ -45,7 +58,7 @@ export interface TaskListUIState extends SpendManagementUIState {
45
58
  searchText: string;
46
59
  sortKey: TaskListViewSortKey;
47
60
  }
48
- declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "dueDate" | "tag" | "priority" | "timeSpent" | "assignee" | "creationDate";
61
+ declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "dueDate" | "tag" | "priority" | "timeSpent" | "assignee" | "creationDate" | "visibility";
49
62
  export declare type TaskListViewSortKey = ReturnType<typeof toTaskListSortKeyType>;
50
63
  export declare const TASK_LIST_FILTER_CATEGORIES: TaskListFilterCategoryOption[];
51
64
  interface TaskListFilterCategoryOption {
@@ -1,7 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TASK_LIST_GROUP_BY_CATEGORIES = exports.TASK_LIST_FILTER_CATEGORIES = exports.toTaskListGroupByKeyTypeStrict = exports.toTaskListGroupByKeyType = exports.TASK_LIST_GROUP_BY_KEYS = exports.toDueDateGroupKeyType = exports.DUE_DATE_GROUP_KEYS = void 0;
3
+ exports.TASK_LIST_GROUP_BY_CATEGORIES = exports.TASK_LIST_FILTER_CATEGORIES = exports.toTaskListGroupByKeyTypeStrict = exports.toTaskListGroupByKeyType = exports.TASK_LIST_GROUP_BY_KEYS = exports.toDueDateGroupKeyType = exports.DUE_DATE_GROUP_KEYS = exports.ALL_TASK_LIST_TABS = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
+ exports.ALL_TASK_LIST_TABS = [
6
+ 'live',
7
+ 'archived',
8
+ 'deleted',
9
+ 'snoozed',
10
+ ];
5
11
  exports.DUE_DATE_GROUP_KEYS = [
6
12
  'overdue',
7
13
  'today',
@@ -32,6 +38,7 @@ const ALL_TASK_LIST_SORT_KEYS = [
32
38
  'status',
33
39
  'priority',
34
40
  'timeSpent',
41
+ 'visibility',
35
42
  ];
36
43
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
44
  const toTaskListSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_TASK_LIST_SORT_KEYS);
@@ -2,6 +2,9 @@ import { TaskPayload } from '../../../entity/task/taskPayload';
2
2
  import { ZeniAPIResponse } from '../../../responsePayload';
3
3
  interface FetchTaskListPayload {
4
4
  tasks: TaskPayload[];
5
+ archived?: TaskPayload[];
6
+ deleted?: TaskPayload[];
7
+ snoozed?: TaskPayload[];
5
8
  }
6
9
  export type FetchTaskListResponse = ZeniAPIResponse<FetchTaskListPayload>;
7
10
  export {};
@@ -1,4 +1,4 @@
1
- import { FetchState, ID, UpdateType } from '../../../commonStateTypes/common';
1
+ import { FetchState, ID } from '../../../commonStateTypes/common';
2
2
  import { TaskPayload } from '../../../entity/task/taskPayload';
3
3
  import { Task } from '../../../entity/task/taskState';
4
4
  import { TaskGroupPayload } from '../../../entity/taskGroup/taskGroupPayload';
@@ -11,8 +11,10 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
11
11
  isTaskTemplatesEnabled: boolean;
12
12
  }, "taskList/fetchTaskListPage", never, never>, fetchTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskList/fetchTaskList">, updateTaskList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
13
  data: TaskPayload[];
14
- updateType: UpdateType;
15
- }, "taskList/updateTaskList">, updateTaskListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
14
+ archived?: TaskPayload[];
15
+ deleted?: TaskPayload[];
16
+ snoozed?: TaskPayload[];
17
+ }, "taskList/updateTaskList">, updateTaskListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"deleted" | "live" | "archived" | "snoozed", "taskList/updateTaskListTab">, updateTaskListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
16
18
  fetchState: FetchState;
17
19
  error?: ZeniAPIStatus;
18
20
  }, "taskList/updateTaskListFetchStatus">, updateTaskListSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -23,12 +25,13 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
23
25
  filters: TaskListFilters;
24
26
  }, "taskList/updateTaskFilters">, updateTaskListOnNewGroupCreationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
27
  newTaskGroup: TaskGroupPayload;
26
- }, "taskList/updateTaskListOnNewGroupCreationSuccess">, bulkUpdateTaskList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskIds: string[], groupId: string, updates: Partial<Task>], {
28
+ }, "taskList/updateTaskListOnNewGroupCreationSuccess">, bulkUpdateTaskList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskIds: string[], groupId: string | null, updates: Partial<Task>], {
27
29
  taskIds: string[];
28
30
  updates: Partial<Task>;
29
- groupId: string;
31
+ groupId: string | null;
30
32
  }, "taskList/bulkUpdateTaskList", never, never>, updateTasksListOnBulkUpdateTasksSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
31
33
  groupId: ID | null;
34
+ removeFromList: boolean;
32
35
  taskIds: ID[];
33
36
  }, "taskList/updateTasksListOnBulkUpdateTasksSuccess">, updateTasksListOnBulkUpdateTasksFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
34
37
  error: ZeniAPIStatus;
@@ -55,6 +58,6 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
55
58
  error: ZeniAPIStatus;
56
59
  }, "taskList/updateTasksListOnUpdateTaskFailure">, updateTaskListOnCreateTaskFromTemplateSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
57
60
  tasks: TaskPayload[];
58
- }, "taskList/updateTaskListOnCreateTaskFromTemplateSuccess">, clearTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskList/clearTaskList">;
61
+ }, "taskList/updateTaskListOnCreateTaskFromTemplateSuccess">, removeTaskFromList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "taskList/removeTaskFromList">, clearTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskList/clearTaskList">;
59
62
  declare const _default: import("redux").Reducer<TaskListState>;
60
63
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearTaskList = exports.updateTaskListOnCreateTaskFromTemplateSuccess = exports.updateTasksListOnUpdateTaskFailure = exports.updateTasksListOnUpdateTaskSuccess = exports.updateTaskFromListView = exports.updateTaskListOnTaskGroupNameUpdate = exports.updateTaskListOnNewTaskCreationSuccess = exports.dragNDropTasks = exports.updateTaskListOnTaskGroupDeletion = exports.updateTaskListLocalData = exports.initiateTaskListLocalData = exports.updateTasksListOnBulkUpdateTasksFailure = exports.updateTasksListOnBulkUpdateTasksSuccess = exports.bulkUpdateTaskList = exports.updateTaskListOnNewGroupCreationSuccess = exports.updateTaskFilters = exports.updateTaskListUIState = exports.updateTaskListSearchText = exports.updateTaskListFetchStatus = exports.updateTaskList = exports.fetchTaskList = exports.fetchTaskListPage = exports.initialState = void 0;
4
+ exports.clearTaskList = exports.removeTaskFromList = exports.updateTaskListOnCreateTaskFromTemplateSuccess = exports.updateTasksListOnUpdateTaskFailure = exports.updateTasksListOnUpdateTaskSuccess = exports.updateTaskFromListView = exports.updateTaskListOnTaskGroupNameUpdate = exports.updateTaskListOnNewTaskCreationSuccess = exports.dragNDropTasks = exports.updateTaskListOnTaskGroupDeletion = exports.updateTaskListLocalData = exports.initiateTaskListLocalData = exports.updateTasksListOnBulkUpdateTasksFailure = exports.updateTasksListOnBulkUpdateTasksSuccess = exports.bulkUpdateTaskList = exports.updateTaskListOnNewGroupCreationSuccess = exports.updateTaskFilters = exports.updateTaskListUIState = exports.updateTaskListSearchText = exports.updateTaskListFetchStatus = exports.updateTaskListTab = exports.updateTaskList = exports.fetchTaskList = exports.fetchTaskListPage = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const taskState_1 = require("../../../entity/task/taskState");
7
7
  const zeniDayJS_1 = require("../../../zeniDayJS");
@@ -33,7 +33,23 @@ const initialTaskIdsByDueDate = {
33
33
  today: [],
34
34
  upcoming: [],
35
35
  };
36
+ const initialTabData = {
37
+ taskIds: [],
38
+ taskIdsByAssignees: {},
39
+ taskIdsByDueDate: { ...initialTaskIdsByDueDate },
40
+ taskIdsByGroupsIds: {},
41
+ taskIdsByPriority: { ...initialTaskIdsByPriority },
42
+ taskIdsByStatus: { ...initialTaskIdsByStatus },
43
+ taskIdsByTags: {},
44
+ };
36
45
  exports.initialState = {
46
+ currentTab: 'live',
47
+ byTab: {
48
+ live: { ...initialTabData },
49
+ archived: { ...initialTabData },
50
+ deleted: { ...initialTabData },
51
+ snoozed: { ...initialTabData },
52
+ },
37
53
  taskIds: [],
38
54
  taskIdsByGroupsIds: {},
39
55
  taskIdsByPriority: initialTaskIdsByPriority,
@@ -90,17 +106,30 @@ const taskList = (0, toolkit_1.createSlice)({
90
106
  draft.error = undefined;
91
107
  },
92
108
  updateTaskList(draft, action) {
93
- const { data } = action.payload;
109
+ const { data, archived, deleted, snoozed } = action.payload;
94
110
  draft.fetchState = 'Completed';
95
111
  draft.error = undefined;
96
- const { taskIds, taskIdsGroupedByPriority, taskIdsByGroupIds, taskIdsGroupedByStatus, taskIdsByAssignees, taskIdsByDueDate, taskIdsByTags, } = getGroupedTaskIds(data);
97
- draft.taskIds = taskIds;
98
- draft.taskIdsByGroupsIds = taskIdsByGroupIds;
99
- draft.taskIdsByPriority = taskIdsGroupedByPriority;
100
- draft.taskIdsByStatus = taskIdsGroupedByStatus;
101
- draft.taskIdsByAssignees = taskIdsByAssignees;
102
- draft.taskIdsByDueDate = taskIdsByDueDate;
103
- draft.taskIdsByTags = taskIdsByTags;
112
+ // Group live tasks
113
+ const liveGrouped = getGroupedTaskIds(data);
114
+ draft.byTab.live = toTabData(liveGrouped);
115
+ // Group other tabs if provided
116
+ if (archived != null) {
117
+ draft.byTab.archived = toTabData(getGroupedTaskIds(archived));
118
+ }
119
+ if (deleted != null) {
120
+ draft.byTab.deleted = toTabData(getGroupedTaskIds(deleted));
121
+ }
122
+ if (snoozed != null) {
123
+ draft.byTab.snoozed = toTabData(getGroupedTaskIds(snoozed));
124
+ }
125
+ // Copy active tab data to top-level fields
126
+ const activeTabData = draft.byTab[draft.currentTab];
127
+ copyTabDataToTopLevel(draft, activeTabData);
128
+ },
129
+ updateTaskListTab(draft, action) {
130
+ draft.currentTab = action.payload;
131
+ const activeTabData = draft.byTab[action.payload];
132
+ copyTabDataToTopLevel(draft, activeTabData);
104
133
  },
105
134
  initiateTaskListLocalData(draft, action) {
106
135
  const { taskGroupById } = action.payload;
@@ -188,10 +217,13 @@ const taskList = (0, toolkit_1.createSlice)({
188
217
  },
189
218
  },
190
219
  updateTasksListOnBulkUpdateTasksSuccess(draft, action) {
191
- const { taskIds, groupId } = action.payload;
220
+ const { taskIds, groupId, removeFromList } = action.payload;
192
221
  draft.updateTasksFetchState.fetchState = 'Completed';
193
222
  draft.updateTasksFetchState.error = undefined;
194
- if (groupId != null) {
223
+ if (removeFromList) {
224
+ removeTaskIds(draft, taskIds);
225
+ }
226
+ else if (groupId != null) {
195
227
  const { groupByKey } = draft.uiState;
196
228
  if (groupByKey === 'groupName') {
197
229
  Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
@@ -283,6 +315,7 @@ const taskList = (0, toolkit_1.createSlice)({
283
315
  newTaskGroupName: '',
284
316
  selectedTaskIds: [],
285
317
  };
318
+ syncTopLevelToActiveTab(draft);
286
319
  },
287
320
  updateTasksListOnBulkUpdateTasksFailure(draft, action) {
288
321
  draft.updateTasksFetchState.fetchState = 'Error';
@@ -302,6 +335,7 @@ const taskList = (0, toolkit_1.createSlice)({
302
335
  }
303
336
  delete draft.taskIdsByGroupsIds[taskGroupId];
304
337
  delete draft.localData.existingTaskGroupNamesByGroupId[taskGroupId];
338
+ syncTopLevelToActiveTab(draft);
305
339
  },
306
340
  updateTaskListOnNewTaskCreationSuccess(draft, action) {
307
341
  const { task, taskGroupId, currentTaskState } = action.payload;
@@ -336,6 +370,7 @@ const taskList = (0, toolkit_1.createSlice)({
336
370
  doUpdateTaskList(draft, task, taskGroupId);
337
371
  }
338
372
  });
373
+ syncTopLevelToActiveTab(draft);
339
374
  },
340
375
  updateTaskListOnTaskGroupNameUpdate(draft, action) {
341
376
  const { taskGroupName, taskGroupId } = action.payload;
@@ -399,6 +434,7 @@ const taskList = (0, toolkit_1.createSlice)({
399
434
  };
400
435
  }
401
436
  }
437
+ syncTopLevelToActiveTab(draft);
402
438
  },
403
439
  updateTasksListOnUpdateTaskSuccess(draft) {
404
440
  draft.updateTasksFetchState.fetchState = 'Completed';
@@ -408,12 +444,15 @@ const taskList = (0, toolkit_1.createSlice)({
408
444
  draft.updateTasksFetchState.fetchState = 'Error';
409
445
  draft.updateTasksFetchState.error = action.payload.error;
410
446
  },
447
+ removeTaskFromList(draft, action) {
448
+ removeTaskIds(draft, [action.payload]);
449
+ },
411
450
  clearTaskList(draft) {
412
451
  Object.assign(draft, exports.initialState);
413
452
  },
414
453
  },
415
454
  });
416
- _a = taskList.actions, exports.fetchTaskListPage = _a.fetchTaskListPage, exports.fetchTaskList = _a.fetchTaskList, exports.updateTaskList = _a.updateTaskList, exports.updateTaskListFetchStatus = _a.updateTaskListFetchStatus, exports.updateTaskListSearchText = _a.updateTaskListSearchText, exports.updateTaskListUIState = _a.updateTaskListUIState, exports.updateTaskFilters = _a.updateTaskFilters, exports.updateTaskListOnNewGroupCreationSuccess = _a.updateTaskListOnNewGroupCreationSuccess, exports.bulkUpdateTaskList = _a.bulkUpdateTaskList, exports.updateTasksListOnBulkUpdateTasksSuccess = _a.updateTasksListOnBulkUpdateTasksSuccess, exports.updateTasksListOnBulkUpdateTasksFailure = _a.updateTasksListOnBulkUpdateTasksFailure, exports.initiateTaskListLocalData = _a.initiateTaskListLocalData, exports.updateTaskListLocalData = _a.updateTaskListLocalData, exports.updateTaskListOnTaskGroupDeletion = _a.updateTaskListOnTaskGroupDeletion, exports.dragNDropTasks = _a.dragNDropTasks, exports.updateTaskListOnNewTaskCreationSuccess = _a.updateTaskListOnNewTaskCreationSuccess, exports.updateTaskListOnTaskGroupNameUpdate = _a.updateTaskListOnTaskGroupNameUpdate, exports.updateTaskFromListView = _a.updateTaskFromListView, exports.updateTasksListOnUpdateTaskSuccess = _a.updateTasksListOnUpdateTaskSuccess, exports.updateTasksListOnUpdateTaskFailure = _a.updateTasksListOnUpdateTaskFailure, exports.updateTaskListOnCreateTaskFromTemplateSuccess = _a.updateTaskListOnCreateTaskFromTemplateSuccess, exports.clearTaskList = _a.clearTaskList;
455
+ _a = taskList.actions, exports.fetchTaskListPage = _a.fetchTaskListPage, exports.fetchTaskList = _a.fetchTaskList, exports.updateTaskList = _a.updateTaskList, exports.updateTaskListTab = _a.updateTaskListTab, exports.updateTaskListFetchStatus = _a.updateTaskListFetchStatus, exports.updateTaskListSearchText = _a.updateTaskListSearchText, exports.updateTaskListUIState = _a.updateTaskListUIState, exports.updateTaskFilters = _a.updateTaskFilters, exports.updateTaskListOnNewGroupCreationSuccess = _a.updateTaskListOnNewGroupCreationSuccess, exports.bulkUpdateTaskList = _a.bulkUpdateTaskList, exports.updateTasksListOnBulkUpdateTasksSuccess = _a.updateTasksListOnBulkUpdateTasksSuccess, exports.updateTasksListOnBulkUpdateTasksFailure = _a.updateTasksListOnBulkUpdateTasksFailure, exports.initiateTaskListLocalData = _a.initiateTaskListLocalData, exports.updateTaskListLocalData = _a.updateTaskListLocalData, exports.updateTaskListOnTaskGroupDeletion = _a.updateTaskListOnTaskGroupDeletion, exports.dragNDropTasks = _a.dragNDropTasks, exports.updateTaskListOnNewTaskCreationSuccess = _a.updateTaskListOnNewTaskCreationSuccess, exports.updateTaskListOnTaskGroupNameUpdate = _a.updateTaskListOnTaskGroupNameUpdate, exports.updateTaskFromListView = _a.updateTaskFromListView, exports.updateTasksListOnUpdateTaskSuccess = _a.updateTasksListOnUpdateTaskSuccess, exports.updateTasksListOnUpdateTaskFailure = _a.updateTasksListOnUpdateTaskFailure, exports.updateTaskListOnCreateTaskFromTemplateSuccess = _a.updateTaskListOnCreateTaskFromTemplateSuccess, exports.removeTaskFromList = _a.removeTaskFromList, exports.clearTaskList = _a.clearTaskList;
417
456
  exports.default = taskList.reducer;
418
457
  /**
419
458
  * helpers
@@ -492,6 +531,61 @@ const getTagsGroupKey = (tags) => {
492
531
  tagIds.sort();
493
532
  return tagIds.join(',');
494
533
  };
534
+ const toTabData = (grouped) => ({
535
+ taskIds: grouped.taskIds,
536
+ taskIdsByAssignees: grouped.taskIdsByAssignees,
537
+ taskIdsByDueDate: grouped.taskIdsByDueDate,
538
+ taskIdsByGroupsIds: grouped.taskIdsByGroupIds,
539
+ taskIdsByPriority: grouped.taskIdsGroupedByPriority,
540
+ taskIdsByStatus: grouped.taskIdsGroupedByStatus,
541
+ taskIdsByTags: grouped.taskIdsByTags,
542
+ });
543
+ const syncTopLevelToActiveTab = (draft) => {
544
+ const tabData = draft.byTab[draft.currentTab];
545
+ tabData.taskIds = draft.taskIds;
546
+ tabData.taskIdsByGroupsIds = draft.taskIdsByGroupsIds;
547
+ tabData.taskIdsByPriority = draft.taskIdsByPriority;
548
+ tabData.taskIdsByStatus = draft.taskIdsByStatus;
549
+ tabData.taskIdsByAssignees = draft.taskIdsByAssignees;
550
+ tabData.taskIdsByDueDate = draft.taskIdsByDueDate;
551
+ tabData.taskIdsByTags = draft.taskIdsByTags;
552
+ };
553
+ const copyTabDataToTopLevel = (draft, tabData) => {
554
+ draft.taskIds = tabData.taskIds;
555
+ draft.taskIdsByGroupsIds = tabData.taskIdsByGroupsIds;
556
+ draft.taskIdsByPriority = tabData.taskIdsByPriority;
557
+ draft.taskIdsByStatus = tabData.taskIdsByStatus;
558
+ draft.taskIdsByAssignees = tabData.taskIdsByAssignees;
559
+ draft.taskIdsByDueDate = tabData.taskIdsByDueDate;
560
+ draft.taskIdsByTags = tabData.taskIdsByTags;
561
+ };
562
+ const removeIdsFromTabData = (tabData, taskIds) => {
563
+ const removedSet = new Set(taskIds);
564
+ const isRemoved = (id) => removedSet.has(id);
565
+ tabData.taskIds = tabData.taskIds.filter((id) => !isRemoved(id));
566
+ Object.keys(tabData.taskIdsByGroupsIds).forEach((gId) => {
567
+ tabData.taskIdsByGroupsIds[gId] = tabData.taskIdsByGroupsIds[gId].filter((id) => !isRemoved(id));
568
+ });
569
+ Object.keys(tabData.taskIdsByPriority).forEach((key) => {
570
+ tabData.taskIdsByPriority[key] = tabData.taskIdsByPriority[key].filter((id) => !isRemoved(id));
571
+ });
572
+ Object.keys(tabData.taskIdsByStatus).forEach((key) => {
573
+ tabData.taskIdsByStatus[key] = tabData.taskIdsByStatus[key].filter((id) => !isRemoved(id));
574
+ });
575
+ Object.keys(tabData.taskIdsByDueDate).forEach((key) => {
576
+ tabData.taskIdsByDueDate[key] = tabData.taskIdsByDueDate[key].filter((id) => !isRemoved(id));
577
+ });
578
+ Object.keys(tabData.taskIdsByAssignees).forEach((key) => {
579
+ tabData.taskIdsByAssignees[key] = tabData.taskIdsByAssignees[key].filter((id) => !isRemoved(id));
580
+ });
581
+ Object.keys(tabData.taskIdsByTags).forEach((key) => {
582
+ tabData.taskIdsByTags[key] = tabData.taskIdsByTags[key].filter((id) => !isRemoved(id));
583
+ });
584
+ };
585
+ const removeTaskIds = (draft, taskIds) => {
586
+ removeIdsFromTabData(draft, taskIds);
587
+ removeIdsFromTabData(draft.byTab[draft.currentTab], taskIds);
588
+ };
495
589
  const getGroupedTaskIds = (tasks) => {
496
590
  const taskIds = [];
497
591
  const taskIdsByGroupIds = {};
@@ -5,14 +5,16 @@ import { TagState } from '../../../entity/tag/tagState';
5
5
  import { Task, TaskState } from '../../../entity/task/taskState';
6
6
  import { TaskGroupTemplate } from '../../../entity/taskGroupTemplate/taskGroupTemplateState';
7
7
  import { UserState } from '../../../entity/user/userState';
8
+ import { UserGroupsState } from '../../../entity/userGroups/userGroupsState';
8
9
  import { UserRoleState } from '../../../entity/userRole/userRoleState';
9
10
  import { RootState } from '../../../reducer';
10
11
  import { UserAndRole } from '../../companyView/types/userAndRole';
11
12
  import { UserGroupListSelectorView } from '../../userGroupListView/userGroupListViewSelector';
12
13
  import { UserListSelectorView } from '../../userListView/userListViewSelector';
13
- import { TaskListFilters, TaskListLocalData, TaskListState, TaskListUIState } from './taskList';
14
+ import { TaskListFilters, TaskListLocalData, TaskListState, TaskListTab, TaskListUIState } from './taskList';
14
15
  export interface TaskWithUserDetails extends Task {
15
16
  assigneeUsers: UserAndRole[];
17
+ firstAssigneeSortName: string;
16
18
  }
17
19
  export interface TaskGroupWithTasksList {
18
20
  groupName: string;
@@ -21,8 +23,10 @@ export interface TaskGroupWithTasksList {
21
23
  tasks: TaskWithUserDetails[];
22
24
  }
23
25
  export interface TaskListSelectorView extends SelectorView {
26
+ currentTab: TaskListTab;
24
27
  filters: TaskListFilters;
25
28
  localData: TaskListLocalData;
29
+ tabCounts: Record<TaskListTab, number>;
26
30
  taskCreationFromTemplateStatus: FetchStateAndError;
27
31
  taskGroupCreationStatus: FetchStateAndError;
28
32
  taskGroupDeleteStatus: FetchStateAndError;
@@ -34,11 +38,12 @@ export interface TaskListSelectorView extends SelectorView {
34
38
  userGroupList: UserGroupListSelectorView;
35
39
  userList: UserListSelectorView;
36
40
  }
37
- export declare const getTaskListGroupedByAssignees: ({ taskListState, taskState, userState, userRoleState, addressState, tagState, }: {
41
+ export declare const getTaskListGroupedByAssignees: ({ taskListState, taskState, userState, userRoleState, addressState, tagState, userGroupsState, }: {
38
42
  addressState: AddressState;
39
43
  tagState: TagState;
40
44
  taskListState: TaskListState;
41
45
  taskState: TaskState;
46
+ userGroupsState: UserGroupsState;
42
47
  userRoleState: UserRoleState;
43
48
  userState: UserState;
44
49
  }) => {
@@ -47,11 +52,12 @@ export declare const getTaskListGroupedByAssignees: ({ taskListState, taskState,
47
52
  isDefault: boolean;
48
53
  tasks: TaskWithUserDetails[];
49
54
  }[];
50
- export declare const getTaskListGroupedByPriority: ({ taskListState, taskState, userState, userRoleState, addressState, tagState, }: {
55
+ export declare const getTaskListGroupedByPriority: ({ taskListState, taskState, userState, userRoleState, addressState, tagState, userGroupsState, }: {
51
56
  addressState: AddressState;
52
57
  tagState: TagState;
53
58
  taskListState: TaskListState;
54
59
  taskState: TaskState;
60
+ userGroupsState: UserGroupsState;
55
61
  userRoleState: UserRoleState;
56
62
  userState: UserState;
57
63
  }) => {