@zeniai/client-epic-state 5.0.84-betaAS2 → 5.0.84-betaJK2
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.
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskPayload.d.ts +1 -0
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskReducer.d.ts +5 -1
- package/lib/entity/task/taskReducer.js +8 -2
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +2 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/task/taskPayload.js +1 -0
- package/lib/esm/entity/task/taskReducer.js +7 -1
- package/lib/esm/epic.js +2 -1
- package/lib/esm/index.js +4 -5
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +8 -46
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +6 -2
- package/lib/esm/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +80 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +23 -1
- package/lib/index.d.ts +6 -7
- package/lib/index.js +10 -12
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +0 -22
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +9 -49
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +0 -16
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.d.ts +9 -0
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +84 -0
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +12 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +6 -2
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +24 -2
- package/package.json +1 -1
|
@@ -35,7 +35,11 @@ const internationalWireVerification = (0, toolkit_1.createSlice)({
|
|
|
35
35
|
},
|
|
36
36
|
updateInternationalVerificationForm(draft, action) {
|
|
37
37
|
const { internationalWireFormPayload } = action.payload;
|
|
38
|
-
|
|
38
|
+
const verificationFormFields = [];
|
|
39
|
+
Object.keys(internationalWireFormPayload).forEach((key) => {
|
|
40
|
+
verificationFormFields.push((0, internationalWireVerificationPayload_1.toDynamicFormField)(key, internationalWireFormPayload[key]));
|
|
41
|
+
});
|
|
42
|
+
draft.verificationFormFields = verificationFormFields;
|
|
39
43
|
draft.verificationFormFetchState.fetchState = 'Completed';
|
|
40
44
|
},
|
|
41
45
|
updateVerificationFormFailure(draft, action) {
|
|
@@ -10,17 +10,6 @@ export interface FieldValueType {
|
|
|
10
10
|
code: string;
|
|
11
11
|
description: string;
|
|
12
12
|
}
|
|
13
|
-
export interface VerificationFormFieldOption {
|
|
14
|
-
label: string;
|
|
15
|
-
}
|
|
16
|
-
export interface VerificationFormSubField {
|
|
17
|
-
fieldValues: FieldValueType[];
|
|
18
|
-
label: string;
|
|
19
|
-
placeholder: string;
|
|
20
|
-
type: string;
|
|
21
|
-
isMultipleOptionsSupported?: boolean;
|
|
22
|
-
options?: Record<string, VerificationFormFieldOption>;
|
|
23
|
-
}
|
|
24
13
|
export interface VerificationFormField {
|
|
25
14
|
fieldValues: FieldValueType[];
|
|
26
15
|
isMultipleValuesAllowed: boolean;
|
|
@@ -28,9 +17,4 @@ export interface VerificationFormField {
|
|
|
28
17
|
name: string;
|
|
29
18
|
placeholder: string;
|
|
30
19
|
type: string;
|
|
31
|
-
default?: boolean;
|
|
32
|
-
isMultipleOptionsSupported?: boolean;
|
|
33
|
-
options?: Record<string, VerificationFormFieldOption>;
|
|
34
|
-
requirements?: string[];
|
|
35
|
-
subfields?: Record<string, VerificationFormSubField>;
|
|
36
20
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSubTaskEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const formatMinutesToFromHHMM_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM");
|
|
7
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
8
|
+
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
9
|
+
const taskSelector_1 = require("../../../../entity/task/taskSelector");
|
|
10
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
+
const taskListReducer_1 = require("../../taskListView/taskListReducer");
|
|
12
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
13
|
+
const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.createSubTask.match), (0, operators_1.mergeMap)((action) => {
|
|
14
|
+
const state = state$.value;
|
|
15
|
+
const parentTask = (0, taskSelector_1.getTaskById)(state.taskState, action.payload.parentTaskId);
|
|
16
|
+
const parentTaskGroupId = parentTask?.taskGroupIds[0];
|
|
17
|
+
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
18
|
+
const payload = prepareSubTaskPayload(action.payload);
|
|
19
|
+
return zeniAPI
|
|
20
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
21
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
23
|
+
response.data != null &&
|
|
24
|
+
response.data.tasks.length > 0) {
|
|
25
|
+
const newTaskId = response.data.tasks[0].task_id;
|
|
26
|
+
const actions = [
|
|
27
|
+
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
28
|
+
(0, taskReducer_1.appendSubTaskId)({
|
|
29
|
+
parentTaskId: action.payload.parentTaskId,
|
|
30
|
+
subTaskId: newTaskId,
|
|
31
|
+
}),
|
|
32
|
+
(0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
|
|
33
|
+
fetchState: 'Completed',
|
|
34
|
+
newTaskId,
|
|
35
|
+
}),
|
|
36
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
37
|
+
messageSection: 'create_sub_task',
|
|
38
|
+
messageText: 'success',
|
|
39
|
+
type: 'success',
|
|
40
|
+
}),
|
|
41
|
+
];
|
|
42
|
+
if (isTaskListFetched === true &&
|
|
43
|
+
parentTaskGroupId != null) {
|
|
44
|
+
actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
45
|
+
taskGroupId: parentTaskGroupId,
|
|
46
|
+
task: response.data.tasks[0],
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
return (0, rxjs_1.from)(actions);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
|
|
53
|
+
fetchState: 'Error',
|
|
54
|
+
error: response.status,
|
|
55
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
56
|
+
messageSection: 'create_sub_task',
|
|
57
|
+
messageText: 'failed',
|
|
58
|
+
type: 'error',
|
|
59
|
+
variables: [
|
|
60
|
+
{
|
|
61
|
+
variableName: '_api-error_',
|
|
62
|
+
variableValue: response.status.message,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
|
|
68
|
+
fetchState: 'Error',
|
|
69
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create Sub Task REST API call errored out' +
|
|
70
|
+
JSON.stringify(error)),
|
|
71
|
+
}))));
|
|
72
|
+
}));
|
|
73
|
+
exports.createSubTaskEpic = createSubTaskEpic;
|
|
74
|
+
const prepareSubTaskPayload = (subTask) => ({
|
|
75
|
+
name: subTask.name,
|
|
76
|
+
assignees: subTask.assignee,
|
|
77
|
+
description: subTask.description,
|
|
78
|
+
priority: subTask.priority,
|
|
79
|
+
status: subTask.status,
|
|
80
|
+
tags: subTask.tagIds,
|
|
81
|
+
time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(subTask.timeSpent),
|
|
82
|
+
group_assignees: subTask.groupAssignees,
|
|
83
|
+
parent_task_id: subTask.parentTaskId,
|
|
84
|
+
});
|
|
@@ -3,9 +3,21 @@ import { DayOfWeek, PriorityCodeType, TaskStatusCodeType, TaskType } from '../..
|
|
|
3
3
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
4
|
import { RecurringDatePickerOptions, RecurringFrequencyType } from '../../common/recurringViewHelper';
|
|
5
5
|
import { CommonHistoryView } from '../../spendManagement/commonHistoryView/commonHistory';
|
|
6
|
+
export interface CreateSubTaskPayload {
|
|
7
|
+
assignee: ID[];
|
|
8
|
+
description: string;
|
|
9
|
+
groupAssignees: ID[];
|
|
10
|
+
name: string;
|
|
11
|
+
parentTaskId: ID;
|
|
12
|
+
priority: PriorityCodeType;
|
|
13
|
+
status: TaskStatusCodeType;
|
|
14
|
+
tagIds: ID[];
|
|
15
|
+
timeSpent: string;
|
|
16
|
+
}
|
|
6
17
|
export interface TaskDetailViewState {
|
|
7
18
|
editTaskStateById: Record<ID, EditTaskDetail>;
|
|
8
19
|
newTaskState: EditTaskDetail;
|
|
20
|
+
subTaskCreateStatus: FetchStateAndError;
|
|
9
21
|
taskHistoryById: Record<ID, CommonHistoryView>;
|
|
10
22
|
}
|
|
11
23
|
export interface EditTaskDetail {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
3
|
import { HistoricEventPayload } from '../../spendManagement/commonHistoryView/commonHistoryPayload';
|
|
4
|
-
import { EditTaskLocalData, TaskDetailViewState } from './taskDetail';
|
|
4
|
+
import { CreateSubTaskPayload, EditTaskLocalData, TaskDetailViewState } from './taskDetail';
|
|
5
5
|
export declare const initialState: TaskDetailViewState;
|
|
6
6
|
export declare const fetchTaskDetailPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean, taskId?: string | undefined], {
|
|
7
7
|
cacheOverride: boolean;
|
|
@@ -34,7 +34,11 @@ export declare const fetchTaskDetailPage: import("@reduxjs/toolkit").ActionCreat
|
|
|
34
34
|
error?: ZeniAPIStatus;
|
|
35
35
|
newTaskId?: ID;
|
|
36
36
|
taskId?: ID;
|
|
37
|
-
}, "taskDetailView/saveTaskSuccessOrFailure">,
|
|
37
|
+
}, "taskDetailView/saveTaskSuccessOrFailure">, createSubTask: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: CreateSubTaskPayload], CreateSubTaskPayload, "taskDetailView/createSubTask", never, never>, createSubTaskSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
38
|
+
fetchState: FetchState;
|
|
39
|
+
error?: ZeniAPIStatus;
|
|
40
|
+
newTaskId?: ID;
|
|
41
|
+
}, "taskDetailView/createSubTaskSuccessOrFailure">, deleteTask: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId?: string | undefined], {
|
|
38
42
|
taskId: string | undefined;
|
|
39
43
|
}, "taskDetailView/deleteTask", never, never>, removeTaskDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "taskDetailView/removeTaskDetail">, deleteTaskSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
40
44
|
fetchState: FetchState;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.updateDeletedTagToLocalStore = exports.updateCreatedTagToLocalStore = exports.clearTaskDetail = exports.updateTaskHistoryFetchStatus = exports.updateTaskHistory = exports.fetchTaskHistory = exports.unsnoozeTask = exports.snoozeTaskSuccessOrFailure = exports.snoozeTask = exports.deleteTaskSuccessOrFailure = exports.removeTaskDetail = exports.deleteTask = exports.saveTaskSuccessOrFailure = exports.archiveTaskSuccessOrFailure = exports.archiveTask = exports.saveTaskDetail = exports.discardTaskUpdatesInLocalStore = exports.saveTaskUpdatesToLocalStore = exports.updateEditTaskFetchStatus = exports.initializeTaskToLocalStore = exports.fetchTaskDetail = exports.fetchTaskDetailPage = exports.initialState = void 0;
|
|
7
|
+
exports.updateDeletedTagToLocalStore = exports.updateCreatedTagToLocalStore = exports.clearTaskDetail = exports.updateTaskHistoryFetchStatus = exports.updateTaskHistory = exports.fetchTaskHistory = exports.unsnoozeTask = exports.snoozeTaskSuccessOrFailure = exports.snoozeTask = exports.deleteTaskSuccessOrFailure = exports.removeTaskDetail = exports.deleteTask = exports.createSubTaskSuccessOrFailure = exports.createSubTask = exports.saveTaskSuccessOrFailure = exports.archiveTaskSuccessOrFailure = exports.archiveTask = exports.saveTaskDetail = exports.discardTaskUpdatesInLocalStore = exports.saveTaskUpdatesToLocalStore = exports.updateEditTaskFetchStatus = exports.initializeTaskToLocalStore = exports.fetchTaskDetail = exports.fetchTaskDetailPage = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const commonHistory_1 = require("../../spendManagement/commonHistoryView/commonHistory");
|
|
@@ -13,6 +13,10 @@ const taskDetail_1 = require("./taskDetail");
|
|
|
13
13
|
exports.initialState = {
|
|
14
14
|
newTaskState: taskDetail_1.initialTaskDetail,
|
|
15
15
|
editTaskStateById: {},
|
|
16
|
+
subTaskCreateStatus: {
|
|
17
|
+
fetchState: 'Not-Started',
|
|
18
|
+
error: undefined,
|
|
19
|
+
},
|
|
16
20
|
taskHistoryById: {},
|
|
17
21
|
};
|
|
18
22
|
const taskDetailView = (0, toolkit_1.createSlice)({
|
|
@@ -325,10 +329,28 @@ const taskDetailView = (0, toolkit_1.createSlice)({
|
|
|
325
329
|
error,
|
|
326
330
|
};
|
|
327
331
|
},
|
|
332
|
+
createSubTask: {
|
|
333
|
+
reducer(draft) {
|
|
334
|
+
draft.subTaskCreateStatus = {
|
|
335
|
+
fetchState: 'In-Progress',
|
|
336
|
+
error: undefined,
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
prepare(payload) {
|
|
340
|
+
return { payload };
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
createSubTaskSuccessOrFailure(draft, action) {
|
|
344
|
+
const { fetchState, error } = action.payload;
|
|
345
|
+
draft.subTaskCreateStatus = {
|
|
346
|
+
fetchState,
|
|
347
|
+
error,
|
|
348
|
+
};
|
|
349
|
+
},
|
|
328
350
|
clearTaskDetail(draft) {
|
|
329
351
|
Object.assign(draft, exports.initialState);
|
|
330
352
|
},
|
|
331
353
|
},
|
|
332
354
|
});
|
|
333
|
-
_a = taskDetailView.actions, exports.fetchTaskDetailPage = _a.fetchTaskDetailPage, exports.fetchTaskDetail = _a.fetchTaskDetail, exports.initializeTaskToLocalStore = _a.initializeTaskToLocalStore, exports.updateEditTaskFetchStatus = _a.updateEditTaskFetchStatus, exports.saveTaskUpdatesToLocalStore = _a.saveTaskUpdatesToLocalStore, exports.discardTaskUpdatesInLocalStore = _a.discardTaskUpdatesInLocalStore, exports.saveTaskDetail = _a.saveTaskDetail, exports.archiveTask = _a.archiveTask, exports.archiveTaskSuccessOrFailure = _a.archiveTaskSuccessOrFailure, exports.saveTaskSuccessOrFailure = _a.saveTaskSuccessOrFailure, exports.deleteTask = _a.deleteTask, exports.removeTaskDetail = _a.removeTaskDetail, exports.deleteTaskSuccessOrFailure = _a.deleteTaskSuccessOrFailure, exports.snoozeTask = _a.snoozeTask, exports.snoozeTaskSuccessOrFailure = _a.snoozeTaskSuccessOrFailure, exports.unsnoozeTask = _a.unsnoozeTask, exports.fetchTaskHistory = _a.fetchTaskHistory, exports.updateTaskHistory = _a.updateTaskHistory, exports.updateTaskHistoryFetchStatus = _a.updateTaskHistoryFetchStatus, exports.clearTaskDetail = _a.clearTaskDetail, exports.updateCreatedTagToLocalStore = _a.updateCreatedTagToLocalStore, exports.updateDeletedTagToLocalStore = _a.updateDeletedTagToLocalStore;
|
|
355
|
+
_a = taskDetailView.actions, exports.fetchTaskDetailPage = _a.fetchTaskDetailPage, exports.fetchTaskDetail = _a.fetchTaskDetail, exports.initializeTaskToLocalStore = _a.initializeTaskToLocalStore, exports.updateEditTaskFetchStatus = _a.updateEditTaskFetchStatus, exports.saveTaskUpdatesToLocalStore = _a.saveTaskUpdatesToLocalStore, exports.discardTaskUpdatesInLocalStore = _a.discardTaskUpdatesInLocalStore, exports.saveTaskDetail = _a.saveTaskDetail, exports.archiveTask = _a.archiveTask, exports.archiveTaskSuccessOrFailure = _a.archiveTaskSuccessOrFailure, exports.saveTaskSuccessOrFailure = _a.saveTaskSuccessOrFailure, exports.createSubTask = _a.createSubTask, exports.createSubTaskSuccessOrFailure = _a.createSubTaskSuccessOrFailure, exports.deleteTask = _a.deleteTask, exports.removeTaskDetail = _a.removeTaskDetail, exports.deleteTaskSuccessOrFailure = _a.deleteTaskSuccessOrFailure, exports.snoozeTask = _a.snoozeTask, exports.snoozeTaskSuccessOrFailure = _a.snoozeTaskSuccessOrFailure, exports.unsnoozeTask = _a.unsnoozeTask, exports.fetchTaskHistory = _a.fetchTaskHistory, exports.updateTaskHistory = _a.updateTaskHistory, exports.updateTaskHistoryFetchStatus = _a.updateTaskHistoryFetchStatus, exports.clearTaskDetail = _a.clearTaskDetail, exports.updateCreatedTagToLocalStore = _a.updateCreatedTagToLocalStore, exports.updateDeletedTagToLocalStore = _a.updateDeletedTagToLocalStore;
|
|
334
356
|
exports.default = taskDetailView.reducer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.84-
|
|
3
|
+
"version": "5.0.84-betaJK2",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|