@zeniai/client-epic-state 4.12.13 → 4.12.15
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/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +31 -1
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +32 -38
- package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.js +4 -1
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -0
- package/lib/view/taskManager/taskListView/taskListReducer.js +19 -2
- package/package.json +1 -1
|
@@ -6,4 +6,34 @@ import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
|
6
6
|
import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
|
|
7
7
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
8
8
|
export declare type ActionType = ReturnType<typeof saveTaskDetail> | ReturnType<typeof updateTasks> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTaskListOnNewTaskCreationSuccess> | ReturnType<typeof saveTaskSuccessOrFailure>;
|
|
9
|
-
export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<
|
|
9
|
+
export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
10
|
+
payload: {
|
|
11
|
+
task: import("../../../../entity/task/taskPayload").TaskPayload;
|
|
12
|
+
taskGroupId: string;
|
|
13
|
+
currentTaskState?: import("../../../..").Task | undefined;
|
|
14
|
+
};
|
|
15
|
+
type: string;
|
|
16
|
+
} | {
|
|
17
|
+
payload: {
|
|
18
|
+
messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
|
|
19
|
+
messageText: "failed" | "success" | "notification";
|
|
20
|
+
type: import("../../../..").SnackbarMessageType;
|
|
21
|
+
showStatusIcon?: boolean | undefined;
|
|
22
|
+
variables?: {
|
|
23
|
+
variableName: string;
|
|
24
|
+
variableValue: string;
|
|
25
|
+
}[] | undefined;
|
|
26
|
+
};
|
|
27
|
+
type: string;
|
|
28
|
+
} | {
|
|
29
|
+
payload: {
|
|
30
|
+
fetchState: import("../../../../commonStateTypes/common").FetchState;
|
|
31
|
+
newTaskId?: string | undefined;
|
|
32
|
+
taskId?: string | undefined;
|
|
33
|
+
error?: import("../../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
34
|
+
};
|
|
35
|
+
type: string;
|
|
36
|
+
} | {
|
|
37
|
+
payload: import("../../../../entity/task/taskPayload").TaskPayload[];
|
|
38
|
+
type: string;
|
|
39
|
+
}>;
|
|
@@ -11,56 +11,50 @@ const taskSelector_1 = require("../../../../entity/task/taskSelector");
|
|
|
11
11
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
12
12
|
const formatZeniDateFY_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
13
13
|
const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.saveTaskDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
14
|
+
var _a;
|
|
14
15
|
const { taskId, taskGroupId } = action.payload;
|
|
15
16
|
const state = state$.value;
|
|
16
|
-
const
|
|
17
|
+
const updatedTaskGroupId = taskId == null
|
|
18
|
+
? taskGroupId
|
|
19
|
+
: (_a = (0, taskSelector_1.getTaskById)(state.taskState, taskId)) === null || _a === void 0 ? void 0 : _a.taskGroupIds[0];
|
|
20
|
+
const payload = prepareTaskPayload(state, taskId, updatedTaskGroupId);
|
|
17
21
|
const saveTaskApi = taskId != null
|
|
18
22
|
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, payload)
|
|
19
23
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload);
|
|
20
24
|
return saveTaskApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
|
-
var _a;
|
|
22
25
|
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
23
26
|
response.data != null &&
|
|
27
|
+
updatedTaskGroupId != null &&
|
|
24
28
|
response.data.tasks.length > 0) {
|
|
25
29
|
const newTaskId = response.data.tasks[0].task_id;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
taskId
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (newTaskGroupId != null) {
|
|
38
|
-
fetchActions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
39
|
-
taskGroupId: newTaskGroupId,
|
|
40
|
-
task: response.data.tasks[0],
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
return (0, rxjs_1.from)(fetchActions);
|
|
30
|
+
return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(response.data.tasks), (0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
31
|
+
fetchState: 'Completed',
|
|
32
|
+
newTaskId,
|
|
33
|
+
taskId,
|
|
34
|
+
}), (0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
35
|
+
taskGroupId: updatedTaskGroupId,
|
|
36
|
+
task: response.data.tasks[0],
|
|
37
|
+
currentTaskState: taskId != null
|
|
38
|
+
? (0, taskSelector_1.getTaskById)(state.taskState, taskId)
|
|
39
|
+
: undefined,
|
|
40
|
+
}));
|
|
44
41
|
}
|
|
45
42
|
else {
|
|
46
|
-
return (0, rxjs_1.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
],
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
43
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
44
|
+
fetchState: 'Error',
|
|
45
|
+
taskId,
|
|
46
|
+
error: response.status,
|
|
47
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
48
|
+
messageSection: 'save_task_detail',
|
|
49
|
+
messageText: 'failed',
|
|
50
|
+
type: 'error',
|
|
51
|
+
variables: [
|
|
52
|
+
{
|
|
53
|
+
variableName: '_api-error_',
|
|
54
|
+
variableValue: response.status.message,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}));
|
|
64
58
|
}
|
|
65
59
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
66
60
|
fetchState: 'Error',
|
|
@@ -20,7 +20,10 @@ const fetchTaskListPageEpic = (actions$, state$) => actions$.pipe((0, operators_
|
|
|
20
20
|
taskListPageActions.push((0, taskGroupViewReducer_1.fetchAllTaskGroups)());
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
|
|
23
|
+
if (state.taskListState.fetchState !== 'In-Progress' &&
|
|
24
|
+
state.taskListState.hasValidState() === false) {
|
|
25
|
+
taskListPageActions.push((0, taskListReducer_1.fetchTaskList)());
|
|
26
|
+
}
|
|
24
27
|
if (state.classListState.hasValidState() === false &&
|
|
25
28
|
state.classListState.fetchState !== 'In-Progress') {
|
|
26
29
|
taskListPageActions.push((0, classListReducer_1.fetchClassList)());
|
|
@@ -43,6 +43,7 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
|
|
|
43
43
|
}, string, never, never>, updateTaskListOnNewTaskCreationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
44
44
|
task: TaskPayload;
|
|
45
45
|
taskGroupId: ID;
|
|
46
|
+
currentTaskState?: Task | undefined;
|
|
46
47
|
}, string>, updateTaskListOnTaskGroupNameUpdate: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
48
|
taskGroupName: ID;
|
|
48
49
|
taskGroupId: ID;
|
|
@@ -280,9 +280,26 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
280
280
|
delete draft.localData.existingTaskGroupNamesByGroupId[taskGroupId];
|
|
281
281
|
},
|
|
282
282
|
updateTaskListOnNewTaskCreationSuccess(draft, action) {
|
|
283
|
-
const { task, taskGroupId } = action.payload;
|
|
283
|
+
const { task, taskGroupId, currentTaskState } = action.payload;
|
|
284
284
|
const taskId = task.task_id;
|
|
285
|
-
|
|
285
|
+
if (currentTaskState == null) {
|
|
286
|
+
draft.taskIds.push(taskId);
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
const priorityKey = (0, taskState_1.toPriorityCodeType)(currentTaskState.priority.code);
|
|
290
|
+
const statusKey = (0, taskState_1.toTaskStatusCodeType)(currentTaskState.status.code);
|
|
291
|
+
const assigneeKey = getAssigneesGroupKey(currentTaskState.assignees);
|
|
292
|
+
const tagsKey = currentTaskState.tagIds.join();
|
|
293
|
+
const dueDateKey = currentTaskState.dueDate != null
|
|
294
|
+
? getDueDateGroupKey(currentTaskState.dueDate.toString())
|
|
295
|
+
: 'upcoming';
|
|
296
|
+
draft.taskIdsByPriority[priorityKey] = draft.taskIdsByPriority[priorityKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
297
|
+
draft.taskIdsByStatus[statusKey] = draft.taskIdsByStatus[statusKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
298
|
+
draft.taskIdsByAssignees[assigneeKey] = draft.taskIdsByAssignees[assigneeKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
299
|
+
draft.taskIdsByTags[tagsKey] = draft.taskIdsByTags[tagsKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
300
|
+
draft.taskIdsByDueDate[dueDateKey] = draft.taskIdsByDueDate[dueDateKey].filter((taskId) => taskId !== currentTaskState.id);
|
|
301
|
+
draft.taskIdsByGroupsIds[taskGroupId] = draft.taskIdsByGroupsIds[taskGroupId].filter((taskId) => taskId !== currentTaskState.id);
|
|
302
|
+
}
|
|
286
303
|
const priorityKey = (0, taskState_1.toPriorityCodeType)(task.priority.code);
|
|
287
304
|
const statusKey = (0, taskState_1.toTaskStatusCodeType)(task.status.code);
|
|
288
305
|
const assigneeKey = getAssigneesGroupKey(task.assignees);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.15",
|
|
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
|
"types": "lib/index.d.ts",
|