@zeniai/client-epic-state 4.20.2-beta10ND → 4.20.2-beta26RR

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 (172) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/entity/aiCfo/aiCfoSelector.d.ts +2 -1
  3. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -38
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -78
  6. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +1 -4
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -5
  8. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -37
  9. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  10. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  11. package/lib/entity/task/taskPayload.d.ts +3 -0
  12. package/lib/entity/task/taskPayload.js +5 -0
  13. package/lib/entity/task/taskState.d.ts +3 -0
  14. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  15. package/lib/entity/tenant/tenantReducer.js +0 -1
  16. package/lib/entity/tenant/tenantSelector.d.ts +0 -1
  17. package/lib/entity/tenant/tenantSelector.js +1 -9
  18. package/lib/entity/tenant/tenantState.d.ts +0 -1
  19. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -4
  20. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  21. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -3
  22. package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -17
  23. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -1
  24. package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -5
  25. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  26. package/lib/epic.d.ts +3 -2
  27. package/lib/epic.js +3 -2
  28. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -78
  29. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -5
  30. package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
  31. package/lib/esm/entity/task/taskPayload.js +5 -0
  32. package/lib/esm/entity/tenant/tenantReducer.js +0 -1
  33. package/lib/esm/entity/tenant/tenantSelector.js +0 -7
  34. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  35. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +1 -17
  36. package/lib/esm/epic.js +3 -2
  37. package/lib/esm/index.js +11 -12
  38. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +1 -82
  39. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +2 -8
  40. package/lib/esm/view/classList/fetchClassListEpic.js +2 -9
  41. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +5 -18
  42. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
  43. package/lib/esm/view/companyView/types/cockpitTypes.js +1 -0
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  45. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  46. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +3 -4
  47. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  48. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  49. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  50. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -17
  51. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  52. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -63
  53. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -12
  54. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  55. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -12
  56. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -18
  57. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -3
  58. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  59. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +0 -1
  60. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
  61. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  62. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
  63. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
  64. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  65. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  66. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +4 -7
  67. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  68. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  69. package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +2 -0
  70. package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +4 -0
  71. package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
  72. package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -0
  73. package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +64 -0
  74. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +54 -0
  75. package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +4 -0
  76. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +49 -1
  77. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +5 -2
  78. package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -3
  79. package/lib/esm/view/taskManager/taskListView/taskList.js +8 -0
  80. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +79 -10
  81. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +44 -11
  82. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  83. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
  84. package/lib/index.d.ts +14 -17
  85. package/lib/index.js +36 -42
  86. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  87. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +0 -7
  88. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +1 -15
  89. package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -83
  90. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -4
  91. package/lib/view/aiCfoView/aiCfoViewSelector.js +2 -9
  92. package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -15
  93. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  94. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  95. package/lib/view/classList/fetchClassListEpic.js +1 -8
  96. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +0 -1
  97. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +5 -18
  98. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +0 -1
  99. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
  100. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  101. package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
  102. package/lib/view/companyView/types/cockpitTypes.js +1 -0
  103. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  104. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
  105. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +3 -4
  106. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  107. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  108. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  109. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  110. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  111. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  112. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -18
  113. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -2
  114. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  115. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -63
  116. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -12
  117. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  118. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -11
  119. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -5
  120. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -20
  121. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  122. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -3
  123. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  124. package/lib/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  125. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  126. package/lib/view/spendManagement/billPay/billList/billListState.js +0 -1
  127. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
  128. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  129. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
  130. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
  131. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
  132. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  133. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  134. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  135. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +3 -6
  136. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +0 -1
  137. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  138. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  139. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  140. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +2 -1
  141. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +2 -0
  142. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +2 -1
  143. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +4 -0
  144. package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
  145. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -0
  146. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +9 -0
  147. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +68 -0
  148. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +8 -0
  149. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +58 -0
  150. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +2 -0
  151. package/lib/view/taskManager/taskDetailView/taskDetail.js +4 -0
  152. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +10 -1
  153. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +50 -2
  154. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +2 -0
  155. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +5 -2
  156. package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -3
  157. package/lib/view/taskManager/taskListView/taskList.d.ts +15 -1
  158. package/lib/view/taskManager/taskListView/taskList.js +10 -1
  159. package/lib/view/taskManager/taskListView/taskListPayload.d.ts +3 -0
  160. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +7 -4
  161. package/lib/view/taskManager/taskListView/taskListReducer.js +80 -11
  162. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +8 -3
  163. package/lib/view/taskManager/taskListView/taskListSelector.js +44 -11
  164. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  165. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
  166. package/package.json +1 -1
  167. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +0 -19
  168. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +0 -2
  169. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +0 -1
  170. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -29
  171. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +0 -8
  172. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -33
@@ -45,7 +45,6 @@ export const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled
45
45
  return {
46
46
  ...reimbursement,
47
47
  submittedBy: getUserByUserId(userState, reimbursement.reimburseeUserId),
48
- createdByUser: getUserByUserId(userState, reimbursement.createdBy),
49
48
  approvers: approvers,
50
49
  };
51
50
  });
@@ -416,14 +415,6 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
416
415
  reimbursementsWithNoSortKeyValue.push(reimbursement);
417
416
  }
418
417
  break;
419
- case 'createdBy':
420
- if (reimbursement.createdByUser != null) {
421
- reimbursementsWithSortKeyValue.push(reimbursement);
422
- }
423
- else {
424
- reimbursementsWithNoSortKeyValue.push(reimbursement);
425
- }
426
- break;
427
418
  }
428
419
  });
429
420
  const getColumnWiseSortOrder = (sortOrder) => {
@@ -431,7 +422,6 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
431
422
  case 'reportName':
432
423
  case 'type':
433
424
  case 'status':
434
- case 'createdBy':
435
425
  return sortOrder === 'ascending' ? 'asc' : 'desc';
436
426
  default:
437
427
  return sortOrder === 'ascending' ? 'desc' : 'asc';
@@ -451,8 +441,6 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
451
441
  return getStatusPerTab(reimbursement);
452
442
  case 'amount':
453
443
  return reimbursement.amount.amount ?? 0;
454
- case 'createdBy':
455
- return `${reimbursement.createdByUser?.firstName ?? ''} ${reimbursement.createdByUser?.lastName ?? ''}`.toLowerCase();
456
444
  }
457
445
  }, getColumnWiseSortOrder(sortOrder));
458
446
  return [
@@ -55,7 +55,6 @@ export const toRemiSubTabUnderScoreType = (v) => stringToUnion(v, REMI_SUB_TAB_U
55
55
  const ALL_REIMBURSEMENT_SORT_KEYS = [
56
56
  'reportName',
57
57
  'submittedOn',
58
- 'createdBy',
59
58
  'type',
60
59
  'status',
61
60
  'amount',
@@ -4,6 +4,7 @@ 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 { removeTaskFromList } from '../../taskListView/taskListReducer';
7
8
  import { archiveTask, archiveTaskSuccessOrFailure } from '../taskDetailReducer';
8
9
  // Epic function to handle archiving of tasks
9
10
  export const archiveTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(archiveTask.match), mergeMap((action) => handleArchiveTask(action.payload.taskId, state$, zeniAPI)));
@@ -25,6 +26,7 @@ const handleApiResponse = (response, taskId) => {
25
26
  response.data.tasks.length > 0) {
26
27
  const fetchActions = [
27
28
  updateTasks(response.data.tasks),
29
+ removeTaskFromList(taskId),
28
30
  archiveTaskSuccessOrFailure({
29
31
  fetchState: 'Completed',
30
32
  taskId,
@@ -2,6 +2,7 @@ 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 { removeTaskFromList } from '../../taskListView/taskListReducer';
5
6
  import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
6
7
  export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteTask.match), mergeMap((action) => {
7
8
  const { taskId } = action.payload;
@@ -10,6 +11,9 @@ export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filt
10
11
  .pipe(mergeMap((response) => {
11
12
  if (isSuccessStatus(response)) {
12
13
  const actions = [];
14
+ if (taskId != null) {
15
+ actions.push(removeTaskFromList(taskId));
16
+ }
13
17
  actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
14
18
  return from(actions);
15
19
  }
@@ -25,6 +25,7 @@ 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,
28
29
  };
29
30
  const actions = [
30
31
  saveTaskUpdatesToLocalStore({ taskDetailLocalData, taskId }),
@@ -94,5 +94,6 @@ 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 } : {}),
97
98
  };
98
99
  };
@@ -0,0 +1,64 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { updateTasks } from '../../../../entity/task/taskReducer';
5
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
+ import { date } from '../../../../zeniDayJS';
7
+ import { removeTaskFromList } from '../../taskListView/taskListReducer';
8
+ import { snoozeTask, snoozeTaskSuccessOrFailure } from '../taskDetailReducer';
9
+ export const snoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(snoozeTask.match), mergeMap((action) => handleSnoozeTask(action.payload.taskId, action.payload.snoozedUntil, zeniAPI)));
10
+ const formatSnoozedUntilForDisplay = (snoozedUntil) => date(snoozedUntil).format('MMM D, h:mm A');
11
+ const handleSnoozeTask = (taskId, snoozedUntil, zeniAPI) => {
12
+ const snoozeTaskApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`, { snoozed_until: snoozedUntil });
13
+ return snoozeTaskApi$.pipe(mergeMap((response) => handleApiResponse(response, taskId, snoozedUntil)), catchError((error) => of(snoozeTaskSuccessOrFailure({
14
+ fetchState: 'Error',
15
+ taskId,
16
+ error: createZeniAPIStatus('Unexpected Error', 'Snooze Task REST API call errored out: ' + JSON.stringify(error)),
17
+ }))));
18
+ };
19
+ const handleApiResponse = (response, taskId, snoozedUntil) => {
20
+ if (isSuccessResponse(response) &&
21
+ response.data != null &&
22
+ response.data.tasks.length > 0) {
23
+ const fetchActions = [
24
+ updateTasks(response.data.tasks),
25
+ removeTaskFromList(taskId),
26
+ snoozeTaskSuccessOrFailure({
27
+ fetchState: 'Completed',
28
+ taskId,
29
+ }),
30
+ openSnackbar({
31
+ messageSection: 'snooze_task',
32
+ messageText: 'success',
33
+ type: 'success',
34
+ variables: [
35
+ {
36
+ variableName: '_snoozed_until_',
37
+ variableValue: formatSnoozedUntilForDisplay(snoozedUntil),
38
+ },
39
+ ],
40
+ }),
41
+ ];
42
+ return from(fetchActions);
43
+ }
44
+ else {
45
+ return from([
46
+ snoozeTaskSuccessOrFailure({
47
+ fetchState: 'Error',
48
+ taskId,
49
+ error: response.status,
50
+ }),
51
+ openSnackbar({
52
+ messageSection: 'snooze_task',
53
+ messageText: 'failed',
54
+ type: 'error',
55
+ variables: [
56
+ {
57
+ variableName: '_api-error_',
58
+ variableValue: response.status.message,
59
+ },
60
+ ],
61
+ }),
62
+ ]);
63
+ }
64
+ };
@@ -0,0 +1,54 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { updateTasks } from '../../../../entity/task/taskReducer';
5
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
+ import { snoozeTaskSuccessOrFailure, unsnoozeTask, } from '../taskDetailReducer';
7
+ export const unsnoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(unsnoozeTask.match), mergeMap((action) => handleUnsnoozeTask(action.payload.taskId, zeniAPI)));
8
+ const handleUnsnoozeTask = (taskId, zeniAPI) => {
9
+ const unsnoozeTaskApi$ = zeniAPI.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`);
10
+ return unsnoozeTaskApi$.pipe(mergeMap((response) => handleApiResponse(response, taskId)), catchError((error) => of(snoozeTaskSuccessOrFailure({
11
+ fetchState: 'Error',
12
+ taskId,
13
+ error: createZeniAPIStatus('Unexpected Error', 'Unsnooze Task REST API call errored out: ' + JSON.stringify(error)),
14
+ }))));
15
+ };
16
+ const handleApiResponse = (response, taskId) => {
17
+ if (isSuccessResponse(response) &&
18
+ response.data != null &&
19
+ response.data.tasks.length > 0) {
20
+ const fetchActions = [
21
+ updateTasks(response.data.tasks),
22
+ snoozeTaskSuccessOrFailure({
23
+ fetchState: 'Completed',
24
+ taskId,
25
+ }),
26
+ openSnackbar({
27
+ messageSection: 'unsnooze_task',
28
+ messageText: 'success',
29
+ type: 'success',
30
+ }),
31
+ ];
32
+ return from(fetchActions);
33
+ }
34
+ else {
35
+ return from([
36
+ snoozeTaskSuccessOrFailure({
37
+ fetchState: 'Error',
38
+ taskId,
39
+ error: response.status,
40
+ }),
41
+ openSnackbar({
42
+ messageSection: 'unsnooze_task',
43
+ messageText: 'failed',
44
+ type: 'error',
45
+ variables: [
46
+ {
47
+ variableName: '_api-error_',
48
+ variableValue: response.status.message,
49
+ },
50
+ ],
51
+ }),
52
+ ]);
53
+ }
54
+ };
@@ -31,5 +31,9 @@ export const initialTaskDetail = {
31
31
  fetchState: 'Not-Started',
32
32
  error: undefined,
33
33
  },
34
+ snoozeStatus: {
35
+ fetchState: 'Not-Started',
36
+ error: undefined,
37
+ },
34
38
  taskDetailLocalData: initialTaskDetailLocalData,
35
39
  };
@@ -185,6 +185,54 @@ const taskDetailView = createSlice({
185
185
  draft.editTaskStateById[taskId].archiveStatus.fetchState = fetchState;
186
186
  draft.editTaskStateById[taskId].archiveStatus.error = error;
187
187
  },
188
+ snoozeTask: {
189
+ reducer(draft, action) {
190
+ const { taskId } = action.payload;
191
+ draft.editTaskStateById[taskId] = {
192
+ ...(draft.editTaskStateById[taskId] != null
193
+ ? draft.editTaskStateById[taskId]
194
+ : initialTaskDetail),
195
+ snoozeStatus: {
196
+ fetchState: 'In-Progress',
197
+ error: undefined,
198
+ },
199
+ };
200
+ },
201
+ prepare(taskId, snoozedUntil) {
202
+ return {
203
+ payload: {
204
+ taskId,
205
+ snoozedUntil,
206
+ },
207
+ };
208
+ },
209
+ },
210
+ snoozeTaskSuccessOrFailure(draft, action) {
211
+ const { taskId, fetchState, error } = action.payload;
212
+ draft.editTaskStateById[taskId].snoozeStatus.fetchState = fetchState;
213
+ draft.editTaskStateById[taskId].snoozeStatus.error = error;
214
+ },
215
+ unsnoozeTask: {
216
+ reducer(draft, action) {
217
+ const { taskId } = action.payload;
218
+ draft.editTaskStateById[taskId] = {
219
+ ...(draft.editTaskStateById[taskId] != null
220
+ ? draft.editTaskStateById[taskId]
221
+ : initialTaskDetail),
222
+ snoozeStatus: {
223
+ fetchState: 'In-Progress',
224
+ error: undefined,
225
+ },
226
+ };
227
+ },
228
+ prepare(taskId) {
229
+ return {
230
+ payload: {
231
+ taskId,
232
+ },
233
+ };
234
+ },
235
+ },
188
236
  deleteTask: {
189
237
  reducer(draft, action) {
190
238
  const { taskId } = action.payload;
@@ -270,5 +318,5 @@ const taskDetailView = createSlice({
270
318
  },
271
319
  },
272
320
  });
273
- export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
321
+ export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, snoozeTask, snoozeTaskSuccessOrFailure, unsnoozeTask, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
274
322
  export default taskDetailView.reducer;
@@ -21,11 +21,13 @@ export const getTaskDetail = (state, taskId) => {
21
21
  };
22
22
  let taskHistory = [];
23
23
  let createdByUser = undefined;
24
+ let snoozedUntil = undefined;
24
25
  if (taskId != null && sourceTaskDetail != null) {
25
26
  const taskEntity = getTaskById(taskState, taskId);
26
27
  const fileIdsInEntity = taskEntity?.fileIds ?? [];
27
28
  if (taskEntity != null) {
28
29
  createdByUser = getUserAndUserRole(userState, userRoleState, addressState, taskEntity.createdBy);
30
+ snoozedUntil = taskEntity.snoozedUntil;
29
31
  }
30
32
  if (fileIdsInEntity.length > 0) {
31
33
  fetchStatus = reduceFetchState([
@@ -74,6 +76,7 @@ export const getTaskDetail = (state, taskId) => {
74
76
  version: 0,
75
77
  createdByUser,
76
78
  showTaskDetailFormFooter,
79
+ snoozedUntil,
77
80
  };
78
81
  };
79
82
  export const allTaskStatus = [
@@ -91,11 +94,11 @@ export const allTaskStatus = [
91
94
  },
92
95
  {
93
96
  code: 'done',
94
- name: 'In Review',
97
+ name: 'Done',
95
98
  },
96
99
  {
97
100
  code: 'resolved',
98
- name: 'Complete',
101
+ name: 'Resolved',
99
102
  },
100
103
  ];
101
104
  export const allTaskPriority = [
@@ -9,10 +9,20 @@ 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
- return of(updateTasks(response.data.tasks), updateTaskList({
13
- data: response.data.tasks,
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 ?? [],
14
24
  updateType: 'replace',
15
- }), updateTags(response.data.tasks.map((task) => task.tags).flat()));
25
+ }), updateTags(allTasks.map((task) => task.tags).flat()));
16
26
  }
17
27
  else {
18
28
  return of(updateTaskListFetchStatus({
@@ -1,4 +1,11 @@
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
+ export const toTaskListTabType = (v) => stringToUnion(v, ALL_TASK_LIST_TABS);
2
9
  export const DUE_DATE_GROUP_KEYS = [
3
10
  'overdue',
4
11
  'today',
@@ -26,6 +33,7 @@ const ALL_TASK_LIST_SORT_KEYS = [
26
33
  'status',
27
34
  'priority',
28
35
  'timeSpent',
36
+ 'visibility',
29
37
  ];
30
38
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
39
  const toTaskListSortKeyType = (v) => stringToUnion(v, ALL_TASK_LIST_SORT_KEYS);
@@ -29,7 +29,23 @@ 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
+ };
32
41
  export const initialState = {
42
+ currentTab: 'live',
43
+ byTab: {
44
+ live: { ...initialTabData },
45
+ archived: { ...initialTabData },
46
+ deleted: { ...initialTabData },
47
+ snoozed: { ...initialTabData },
48
+ },
33
49
  taskIds: [],
34
50
  taskIdsByGroupsIds: {},
35
51
  taskIdsByPriority: initialTaskIdsByPriority,
@@ -86,17 +102,30 @@ const taskList = createSlice({
86
102
  draft.error = undefined;
87
103
  },
88
104
  updateTaskList(draft, action) {
89
- const { data } = action.payload;
105
+ const { data, archived, deleted, snoozed } = action.payload;
90
106
  draft.fetchState = 'Completed';
91
107
  draft.error = undefined;
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;
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);
100
129
  },
101
130
  initiateTaskListLocalData(draft, action) {
102
131
  const { taskGroupById } = action.payload;
@@ -404,12 +433,34 @@ const taskList = createSlice({
404
433
  draft.updateTasksFetchState.fetchState = 'Error';
405
434
  draft.updateTasksFetchState.error = action.payload.error;
406
435
  },
436
+ removeTaskFromList(draft, action) {
437
+ const taskIdToRemove = action.payload;
438
+ draft.taskIds = draft.taskIds.filter((id) => id !== taskIdToRemove);
439
+ Object.keys(draft.taskIdsByGroupsIds).forEach((groupId) => {
440
+ draft.taskIdsByGroupsIds[groupId] = draft.taskIdsByGroupsIds[groupId].filter((id) => id !== taskIdToRemove);
441
+ });
442
+ Object.keys(draft.taskIdsByPriority).forEach((key) => {
443
+ draft.taskIdsByPriority[key] = draft.taskIdsByPriority[key].filter((id) => id !== taskIdToRemove);
444
+ });
445
+ Object.keys(draft.taskIdsByStatus).forEach((key) => {
446
+ draft.taskIdsByStatus[key] = draft.taskIdsByStatus[key].filter((id) => id !== taskIdToRemove);
447
+ });
448
+ Object.keys(draft.taskIdsByDueDate).forEach((key) => {
449
+ draft.taskIdsByDueDate[key] = draft.taskIdsByDueDate[key].filter((id) => id !== taskIdToRemove);
450
+ });
451
+ Object.keys(draft.taskIdsByAssignees).forEach((key) => {
452
+ draft.taskIdsByAssignees[key] = draft.taskIdsByAssignees[key].filter((id) => id !== taskIdToRemove);
453
+ });
454
+ Object.keys(draft.taskIdsByTags).forEach((key) => {
455
+ draft.taskIdsByTags[key] = draft.taskIdsByTags[key].filter((id) => id !== taskIdToRemove);
456
+ });
457
+ },
407
458
  clearTaskList(draft) {
408
459
  Object.assign(draft, initialState);
409
460
  },
410
461
  },
411
462
  });
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;
463
+ 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;
413
464
  export default taskList.reducer;
414
465
  /**
415
466
  * helpers
@@ -488,6 +539,24 @@ const getTagsGroupKey = (tags) => {
488
539
  tagIds.sort();
489
540
  return tagIds.join(',');
490
541
  };
542
+ const toTabData = (grouped) => ({
543
+ taskIds: grouped.taskIds,
544
+ taskIdsByAssignees: grouped.taskIdsByAssignees,
545
+ taskIdsByDueDate: grouped.taskIdsByDueDate,
546
+ taskIdsByGroupsIds: grouped.taskIdsByGroupIds,
547
+ taskIdsByPriority: grouped.taskIdsGroupedByPriority,
548
+ taskIdsByStatus: grouped.taskIdsGroupedByStatus,
549
+ taskIdsByTags: grouped.taskIdsByTags,
550
+ });
551
+ const copyTabDataToTopLevel = (draft, tabData) => {
552
+ draft.taskIds = tabData.taskIds;
553
+ draft.taskIdsByGroupsIds = tabData.taskIdsByGroupsIds;
554
+ draft.taskIdsByPriority = tabData.taskIdsByPriority;
555
+ draft.taskIdsByStatus = tabData.taskIdsByStatus;
556
+ draft.taskIdsByAssignees = tabData.taskIdsByAssignees;
557
+ draft.taskIdsByDueDate = tabData.taskIdsByDueDate;
558
+ draft.taskIdsByTags = tabData.taskIdsByTags;
559
+ };
491
560
  const getGroupedTaskIds = (tasks) => {
492
561
  const taskIds = [];
493
562
  const taskIdsByGroupIds = {};