@zeniai/client-epic-state 5.1.42-betaDI4 → 5.1.42

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 (74) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +1 -1
  3. package/lib/entity/task/taskPayload.d.ts +1 -2
  4. package/lib/entity/task/taskPayload.js +1 -8
  5. package/lib/entity/task/taskReducer.d.ts +1 -8
  6. package/lib/entity/task/taskReducer.js +4 -29
  7. package/lib/entity/task/taskState.d.ts +0 -1
  8. package/lib/entity/tenant/epic/saveExternalConnectionEpic.js +15 -11
  9. package/lib/epic.d.ts +3 -5
  10. package/lib/epic.js +3 -5
  11. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -1
  12. package/lib/esm/entity/task/taskPayload.js +1 -8
  13. package/lib/esm/entity/task/taskReducer.js +3 -28
  14. package/lib/esm/entity/tenant/epic/saveExternalConnectionEpic.js +15 -11
  15. package/lib/esm/epic.js +3 -5
  16. package/lib/esm/index.js +7 -7
  17. package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +0 -3
  18. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -7
  19. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +7 -0
  20. package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
  21. package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +9 -70
  22. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +2 -56
  23. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +9 -32
  24. package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +1 -3
  25. package/lib/esm/view/taskManager/taskListView/taskList.js +0 -1
  26. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -240
  27. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +0 -1
  28. package/lib/esm/view/taskManager/taskListView/taskListViewHelpers.js +0 -58
  29. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +22 -0
  30. package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +75 -3
  31. package/lib/esm/view/transactionDetail/journalEntryLinesViewModel.js +58 -0
  32. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +10 -8
  33. package/lib/esm/view/transactionDetail/transactionDetailReducer.js +66 -1
  34. package/lib/index.d.ts +10 -10
  35. package/lib/index.js +25 -25
  36. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +0 -3
  37. package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -7
  38. package/lib/view/companyView/types/cockpitTypes.d.ts +0 -3
  39. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  40. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +7 -0
  41. package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
  42. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +2 -2
  43. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +8 -69
  44. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -15
  45. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +2 -14
  46. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +3 -57
  47. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +1 -2
  48. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +7 -30
  49. package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +1 -3
  50. package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
  51. package/lib/view/taskManager/taskListView/taskList.js +0 -1
  52. package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -4
  53. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +2 -6
  54. package/lib/view/taskManager/taskListView/taskListReducer.js +13 -241
  55. package/lib/view/taskManager/taskListView/taskListSelector.js +0 -1
  56. package/lib/view/taskManager/taskListView/taskListViewHelpers.d.ts +0 -11
  57. package/lib/view/taskManager/taskListView/taskListViewHelpers.js +1 -60
  58. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +22 -0
  59. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.d.ts +5 -1
  60. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +77 -4
  61. package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +27 -0
  62. package/lib/view/transactionDetail/journalEntryLinesViewModel.js +61 -1
  63. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +10 -8
  64. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +11 -2
  65. package/lib/view/transactionDetail/transactionDetailReducer.js +67 -2
  66. package/lib/view/transactionDetail/transactionDetailState.d.ts +8 -1
  67. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +2 -0
  68. package/package.json +1 -1
  69. package/lib/esm/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -96
  70. package/lib/esm/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +0 -53
  71. package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.d.ts +0 -9
  72. package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -100
  73. package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.d.ts +0 -8
  74. package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +0 -57
@@ -1,96 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { convertHHMMStrToMinutes } from '../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM';
4
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
- import { appendSubTaskId, updateTasks, } from '../../../../entity/task/taskReducer';
6
- import { getTaskById } from '../../../../entity/task/taskSelector';
7
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
- import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
9
- import { createSubTask, createSubTaskSuccessOrFailure, } from '../taskDetailReducer';
10
- export const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createSubTask.match), mergeMap((action) => {
11
- const state = state$.value;
12
- const parentTask = getTaskById(state.taskState, action.payload.parentTaskId);
13
- // Subtasks inherit every parent group membership, not just the first,
14
- // so the subtask surfaces in all the same buckets as its parent.
15
- const parentTaskGroupIds = parentTask?.taskGroupIds ?? [];
16
- const parentTaskGroupId = parentTaskGroupIds[0];
17
- const isTaskListFetched = state.taskListState.fetchState === 'Completed';
18
- const payload = prepareSubTaskPayload(action.payload, parentTaskGroupIds);
19
- return zeniAPI
20
- .postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
21
- .pipe(mergeMap((response) => {
22
- if (isSuccessResponse(response) &&
23
- response.data != null &&
24
- response.data.tasks.length > 0) {
25
- const newTaskId = response.data.tasks[0].task_id;
26
- const actions = [
27
- updateTasks(response.data.tasks),
28
- appendSubTaskId({
29
- parentTaskId: action.payload.parentTaskId,
30
- subTaskId: newTaskId,
31
- }),
32
- createSubTaskSuccessOrFailure({
33
- fetchState: 'Completed',
34
- newTaskId,
35
- }),
36
- openSnackbar({
37
- messageSection: 'create_sub_task',
38
- messageText: 'success',
39
- type: 'success',
40
- }),
41
- ];
42
- // The task list is keyed on parent tasks (no parent_task_id)
43
- // — subtasks belong to their parent's children list, not the
44
- // top-level list. Pushing a subtask into the list would
45
- // surface it as an orphan row at the top of the group.
46
- // Only fire the list-update for actual parent tasks.
47
- const createdTask = response.data.tasks[0];
48
- const isSubtask = createdTask.parent_task_id != null &&
49
- createdTask.parent_task_id !== '';
50
- if (!isSubtask &&
51
- isTaskListFetched === true &&
52
- parentTaskGroupId != null) {
53
- actions.push(updateTaskListOnNewTaskCreationSuccess({
54
- taskGroupId: parentTaskGroupId,
55
- task: createdTask,
56
- }));
57
- }
58
- return from(actions);
59
- }
60
- else {
61
- return of(createSubTaskSuccessOrFailure({
62
- fetchState: 'Error',
63
- error: response.status,
64
- }), openSnackbar({
65
- messageSection: 'create_sub_task',
66
- messageText: 'failed',
67
- type: 'error',
68
- variables: [
69
- {
70
- variableName: '_api-error_',
71
- variableValue: response.status.message,
72
- },
73
- ],
74
- }));
75
- }
76
- }), catchError((error) => of(createSubTaskSuccessOrFailure({
77
- fetchState: 'Error',
78
- error: createZeniAPIStatus('Unexpected Error', 'Create Sub Task REST API call errored out' +
79
- JSON.stringify(error)),
80
- }))));
81
- }));
82
- const prepareSubTaskPayload = (subTask, parentTaskGroupIds) => ({
83
- name: subTask.name,
84
- assignees: subTask.assignee,
85
- description: subTask.description,
86
- priority: subTask.priority,
87
- status: subTask.status,
88
- tags: subTask.tagIds,
89
- time_spent: convertHHMMStrToMinutes(subTask.timeSpent),
90
- group_assignees: subTask.groupAssignees,
91
- parent_task_id: subTask.parentTaskId,
92
- // Inherit every parent group, not just the first — see callsite for
93
- // the two-scope rationale.
94
- task_group_ids: parentTaskGroupIds,
95
- due_date: subTask.dueDate?.format('YYYY-MM-DD') ?? null,
96
- });
@@ -1,53 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { setSubTaskIds, updateTasks } from '../../../../entity/task/taskReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
- import { fetchSubTasks, updateSubTasks, updateSubTasksFetchStatus, } from '../taskDetailReducer';
6
- export const fetchSubTasksEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchSubTasks.match),
7
- // Use mergeMap, not switchMap: switchMap cancels in-flight requests for
8
- // the previous parent without dispatching success or failure, leaving
9
- // subTaskListFetchStatusByParentId stuck at In-Progress and blocking the
10
- // detail page's combined fetchStatus via reduceAnyFetchState. Per-parent
11
- // races on the same parentTaskId are handled last-write-wins downstream.
12
- mergeMap((action) => {
13
- const { parentTaskId } = action.payload;
14
- const query = JSON.stringify({
15
- task_type: 'subtasks',
16
- parent_task_id: parentTaskId,
17
- });
18
- return zeniAPI
19
- .getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(query)}`)
20
- .pipe(mergeMap((response) => {
21
- if (isSuccessResponse(response) && response.data != null) {
22
- const { tasks } = response.data;
23
- // Keep the parent's `subTasksIds` in sync with the fetched
24
- // bucket. Without this, the parent entity record can drift
25
- // out of sync with what the children fetch returned —
26
- // e.g. a server-side delete won't drop from the parent
27
- // record until the next list re-fetch.
28
- const fetchedChildIds = tasks
29
- .filter((t) => t.parent_task_id === parentTaskId)
30
- .map((t) => t.task_id);
31
- return of(updateTasks(tasks), setSubTaskIds({
32
- parentTaskId,
33
- subTaskIds: fetchedChildIds,
34
- }), updateSubTasks({
35
- parentTaskId,
36
- }));
37
- }
38
- else {
39
- return of(updateSubTasksFetchStatus({
40
- parentTaskId,
41
- fetchState: 'Error',
42
- error: response.status,
43
- }));
44
- }
45
- }), catchError((error) => {
46
- return of(updateSubTasksFetchStatus({
47
- parentTaskId,
48
- fetchState: 'Error',
49
- error: createZeniAPIStatus('Unexpected Error', 'Fetch Sub Tasks REST API call errored out' +
50
- JSON.stringify(error)),
51
- }));
52
- }));
53
- }));
@@ -1,9 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
3
- import { appendSubTaskId, updateTasks } from '../../../../entity/task/taskReducer';
4
- import { RootState } from '../../../../reducer';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
7
- import { createSubTask, createSubTaskSuccessOrFailure } from '../taskDetailReducer';
8
- export type ActionType = ReturnType<typeof createSubTask> | ReturnType<typeof updateTasks> | ReturnType<typeof appendSubTaskId> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTaskListOnNewTaskCreationSuccess> | ReturnType<typeof createSubTaskSuccessOrFailure>;
9
- export declare const createSubTaskEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSubTaskEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const formatMinutesToFromHHMM_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM");
7
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
- const taskReducer_1 = require("../../../../entity/task/taskReducer");
9
- const taskSelector_1 = require("../../../../entity/task/taskSelector");
10
- const responsePayload_1 = require("../../../../responsePayload");
11
- const taskListReducer_1 = require("../../taskListView/taskListReducer");
12
- const taskDetailReducer_1 = require("../taskDetailReducer");
13
- const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.createSubTask.match), (0, operators_1.mergeMap)((action) => {
14
- const state = state$.value;
15
- const parentTask = (0, taskSelector_1.getTaskById)(state.taskState, action.payload.parentTaskId);
16
- // Subtasks inherit every parent group membership, not just the first,
17
- // so the subtask surfaces in all the same buckets as its parent.
18
- const parentTaskGroupIds = parentTask?.taskGroupIds ?? [];
19
- const parentTaskGroupId = parentTaskGroupIds[0];
20
- const isTaskListFetched = state.taskListState.fetchState === 'Completed';
21
- const payload = prepareSubTaskPayload(action.payload, parentTaskGroupIds);
22
- return zeniAPI
23
- .postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
24
- .pipe((0, operators_1.mergeMap)((response) => {
25
- if ((0, responsePayload_1.isSuccessResponse)(response) &&
26
- response.data != null &&
27
- response.data.tasks.length > 0) {
28
- const newTaskId = response.data.tasks[0].task_id;
29
- const actions = [
30
- (0, taskReducer_1.updateTasks)(response.data.tasks),
31
- (0, taskReducer_1.appendSubTaskId)({
32
- parentTaskId: action.payload.parentTaskId,
33
- subTaskId: newTaskId,
34
- }),
35
- (0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
36
- fetchState: 'Completed',
37
- newTaskId,
38
- }),
39
- (0, snackbarReducer_1.openSnackbar)({
40
- messageSection: 'create_sub_task',
41
- messageText: 'success',
42
- type: 'success',
43
- }),
44
- ];
45
- // The task list is keyed on parent tasks (no parent_task_id)
46
- // — subtasks belong to their parent's children list, not the
47
- // top-level list. Pushing a subtask into the list would
48
- // surface it as an orphan row at the top of the group.
49
- // Only fire the list-update for actual parent tasks.
50
- const createdTask = response.data.tasks[0];
51
- const isSubtask = createdTask.parent_task_id != null &&
52
- createdTask.parent_task_id !== '';
53
- if (!isSubtask &&
54
- isTaskListFetched === true &&
55
- parentTaskGroupId != null) {
56
- actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
57
- taskGroupId: parentTaskGroupId,
58
- task: createdTask,
59
- }));
60
- }
61
- return (0, rxjs_1.from)(actions);
62
- }
63
- else {
64
- return (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
65
- fetchState: 'Error',
66
- error: response.status,
67
- }), (0, snackbarReducer_1.openSnackbar)({
68
- messageSection: 'create_sub_task',
69
- messageText: 'failed',
70
- type: 'error',
71
- variables: [
72
- {
73
- variableName: '_api-error_',
74
- variableValue: response.status.message,
75
- },
76
- ],
77
- }));
78
- }
79
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
80
- fetchState: 'Error',
81
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create Sub Task REST API call errored out' +
82
- JSON.stringify(error)),
83
- }))));
84
- }));
85
- exports.createSubTaskEpic = createSubTaskEpic;
86
- const prepareSubTaskPayload = (subTask, parentTaskGroupIds) => ({
87
- name: subTask.name,
88
- assignees: subTask.assignee,
89
- description: subTask.description,
90
- priority: subTask.priority,
91
- status: subTask.status,
92
- tags: subTask.tagIds,
93
- time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(subTask.timeSpent),
94
- group_assignees: subTask.groupAssignees,
95
- parent_task_id: subTask.parentTaskId,
96
- // Inherit every parent group, not just the first — see callsite for
97
- // the two-scope rationale.
98
- task_group_ids: parentTaskGroupIds,
99
- due_date: subTask.dueDate?.format('YYYY-MM-DD') ?? null,
100
- });
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { setSubTaskIds, updateTasks } from '../../../../entity/task/taskReducer';
4
- import { RootState } from '../../../../reducer';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { fetchSubTasks, updateSubTasks, updateSubTasksFetchStatus } from '../taskDetailReducer';
7
- export type ActionType = ReturnType<typeof fetchSubTasks> | ReturnType<typeof updateTasks> | ReturnType<typeof setSubTaskIds> | ReturnType<typeof updateSubTasks> | ReturnType<typeof updateSubTasksFetchStatus>;
8
- export declare const fetchSubTasksEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchSubTasksEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const taskReducer_1 = require("../../../../entity/task/taskReducer");
7
- const responsePayload_1 = require("../../../../responsePayload");
8
- const taskDetailReducer_1 = require("../taskDetailReducer");
9
- const fetchSubTasksEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchSubTasks.match),
10
- // Use mergeMap, not switchMap: switchMap cancels in-flight requests for
11
- // the previous parent without dispatching success or failure, leaving
12
- // subTaskListFetchStatusByParentId stuck at In-Progress and blocking the
13
- // detail page's combined fetchStatus via reduceAnyFetchState. Per-parent
14
- // races on the same parentTaskId are handled last-write-wins downstream.
15
- (0, operators_1.mergeMap)((action) => {
16
- const { parentTaskId } = action.payload;
17
- const query = JSON.stringify({
18
- task_type: 'subtasks',
19
- parent_task_id: parentTaskId,
20
- });
21
- return zeniAPI
22
- .getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(query)}`)
23
- .pipe((0, operators_1.mergeMap)((response) => {
24
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
25
- const { tasks } = response.data;
26
- // Keep the parent's `subTasksIds` in sync with the fetched
27
- // bucket. Without this, the parent entity record can drift
28
- // out of sync with what the children fetch returned —
29
- // e.g. a server-side delete won't drop from the parent
30
- // record until the next list re-fetch.
31
- const fetchedChildIds = tasks
32
- .filter((t) => t.parent_task_id === parentTaskId)
33
- .map((t) => t.task_id);
34
- return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(tasks), (0, taskReducer_1.setSubTaskIds)({
35
- parentTaskId,
36
- subTaskIds: fetchedChildIds,
37
- }), (0, taskDetailReducer_1.updateSubTasks)({
38
- parentTaskId,
39
- }));
40
- }
41
- else {
42
- return (0, rxjs_1.of)((0, taskDetailReducer_1.updateSubTasksFetchStatus)({
43
- parentTaskId,
44
- fetchState: 'Error',
45
- error: response.status,
46
- }));
47
- }
48
- }), (0, operators_1.catchError)((error) => {
49
- return (0, rxjs_1.of)((0, taskDetailReducer_1.updateSubTasksFetchStatus)({
50
- parentTaskId,
51
- fetchState: 'Error',
52
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Sub Tasks REST API call errored out' +
53
- JSON.stringify(error)),
54
- }));
55
- }));
56
- }));
57
- exports.fetchSubTasksEpic = fetchSubTasksEpic;