@zeniai/client-epic-state 4.12.19 → 4.12.20
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 +1 -31
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +19 -11
- package/lib/view/taskManager/taskDetailView/taskDetail.js +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -2
- package/lib/view/taskManager/taskListView/taskListReducer.js +15 -5
- package/lib/view/taskManager/taskListView/updateTaskFromListViewEpic.js +2 -1
- package/package.json +1 -1
|
@@ -6,34 +6,4 @@ 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<
|
|
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
|
-
}>;
|
|
9
|
+
export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -14,6 +14,7 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
14
14
|
var _a;
|
|
15
15
|
const { taskId, taskGroupId } = action.payload;
|
|
16
16
|
const state = state$.value;
|
|
17
|
+
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
17
18
|
const updatedTaskGroupId = taskId == null
|
|
18
19
|
? taskGroupId
|
|
19
20
|
: (_a = (0, taskSelector_1.getTaskById)(state.taskState, taskId)) === null || _a === void 0 ? void 0 : _a.taskGroupIds[0];
|
|
@@ -27,17 +28,24 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
27
28
|
updatedTaskGroupId != null &&
|
|
28
29
|
response.data.tasks.length > 0) {
|
|
29
30
|
const newTaskId = response.data.tasks[0].task_id;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const actions = [
|
|
32
|
+
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
33
|
+
(0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
34
|
+
fetchState: 'Completed',
|
|
35
|
+
newTaskId,
|
|
36
|
+
taskId,
|
|
37
|
+
}),
|
|
38
|
+
];
|
|
39
|
+
if (isTaskListFetched === true) {
|
|
40
|
+
actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
41
|
+
taskGroupId: updatedTaskGroupId,
|
|
42
|
+
task: response.data.tasks[0],
|
|
43
|
+
currentTaskState: taskId != null
|
|
44
|
+
? (0, taskSelector_1.getTaskById)(state.taskState, taskId)
|
|
45
|
+
: undefined,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
return (0, rxjs_1.from)(actions);
|
|
41
49
|
}
|
|
42
50
|
else {
|
|
43
51
|
return (0, rxjs_1.of)((0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
@@ -48,8 +48,7 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
|
|
|
48
48
|
taskGroupName: ID;
|
|
49
49
|
taskGroupId: ID;
|
|
50
50
|
}, string>, updateTaskFromListView: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
51
|
-
|
|
52
|
-
prevGroupId: ID;
|
|
51
|
+
task: Task;
|
|
53
52
|
updates: Partial<Task>;
|
|
54
53
|
}, string>, updateTasksListOnUpdateTaskSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateTasksListOnUpdateTaskFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
55
54
|
error: ZeniAPIStatus;
|
|
@@ -289,7 +289,9 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
289
289
|
const priorityKey = (0, taskState_1.toPriorityCodeType)(currentTaskState.priority.code);
|
|
290
290
|
const statusKey = (0, taskState_1.toTaskStatusCodeType)(currentTaskState.status.code);
|
|
291
291
|
const assigneeKey = getAssigneesGroupKey(currentTaskState.assignees);
|
|
292
|
-
const
|
|
292
|
+
const tagIds = [...currentTaskState.tagIds];
|
|
293
|
+
tagIds.sort();
|
|
294
|
+
const tagsKey = tagIds.join();
|
|
293
295
|
const dueDateKey = currentTaskState.dueDate != null
|
|
294
296
|
? getDueDateGroupKey(currentTaskState.dueDate.toString())
|
|
295
297
|
: 'upcoming';
|
|
@@ -350,22 +352,25 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
350
352
|
draft.localData.existingTaskGroupNamesByGroupId = Object.assign(Object.assign({}, draft.localData.existingTaskGroupNamesByGroupId), { [taskGroupId]: taskGroupName });
|
|
351
353
|
},
|
|
352
354
|
updateTaskFromListView(draft, action) {
|
|
353
|
-
|
|
355
|
+
var _a;
|
|
356
|
+
const { updates, task } = action.payload;
|
|
357
|
+
const taskId = task.id;
|
|
354
358
|
draft.updateTasksFetchState.fetchState = 'In-Progress';
|
|
355
359
|
draft.updateTasksFetchState.error = undefined;
|
|
356
360
|
if (updates.priority != null) {
|
|
357
|
-
const prevPriorityCode = (0, taskState_1.toPriorityCodeType)(
|
|
361
|
+
const prevPriorityCode = (0, taskState_1.toPriorityCodeType)(task.priority.code);
|
|
358
362
|
draft.taskIdsByPriority[prevPriorityCode] = draft.taskIdsByPriority[prevPriorityCode].filter((id) => id != taskId);
|
|
359
363
|
const newPriorityCode = (0, taskState_1.toPriorityCodeType)(updates.priority.code);
|
|
360
364
|
draft.taskIdsByPriority[newPriorityCode].push(taskId);
|
|
361
365
|
}
|
|
362
366
|
if (updates.status != null) {
|
|
363
|
-
const prevStatusCode = (0, taskState_1.toTaskStatusCodeType)(
|
|
367
|
+
const prevStatusCode = (0, taskState_1.toTaskStatusCodeType)(task.status.code);
|
|
364
368
|
draft.taskIdsByStatus[prevStatusCode] = draft.taskIdsByStatus[prevStatusCode].filter((id) => id != taskId);
|
|
365
369
|
const newStatusCode = (0, taskState_1.toTaskStatusCodeType)(updates.status.code);
|
|
366
370
|
draft.taskIdsByStatus[newStatusCode].push(taskId);
|
|
367
371
|
}
|
|
368
372
|
if (updates.assignees != null) {
|
|
373
|
+
const prevGroupId = getAssigneesGroupKey(task.assignees);
|
|
369
374
|
draft.taskIdsByAssignees[prevGroupId] = draft.taskIdsByAssignees[prevGroupId].filter((id) => id != taskId);
|
|
370
375
|
const newGroupId = updates.assignees.join(',');
|
|
371
376
|
if (draft.taskIdsByAssignees[newGroupId] != null) {
|
|
@@ -376,12 +381,17 @@ const taskList = (0, toolkit_1.createSlice)({
|
|
|
376
381
|
}
|
|
377
382
|
}
|
|
378
383
|
if (updates.dueDate != null) {
|
|
379
|
-
const prevDueDateKey =
|
|
384
|
+
const prevDueDateKey = task.dueDate != null
|
|
385
|
+
? (0, taskList_1.toDueDateGroupKeyType)((_a = task.dueDate) === null || _a === void 0 ? void 0 : _a.toString())
|
|
386
|
+
: 'upcoming';
|
|
380
387
|
draft.taskIdsByDueDate[prevDueDateKey] = draft.taskIdsByDueDate[prevDueDateKey].filter((id) => id != taskId);
|
|
381
388
|
const newDueDateKey = getDueDateGroupKey(updates.dueDate.toString());
|
|
382
389
|
draft.taskIdsByDueDate[newDueDateKey].push(taskId);
|
|
383
390
|
}
|
|
384
391
|
if (updates.tagIds != null) {
|
|
392
|
+
const tagIds = [...task.tagIds];
|
|
393
|
+
tagIds.sort();
|
|
394
|
+
const prevGroupId = tagIds.join(',');
|
|
385
395
|
draft.taskIdsByTags[prevGroupId] = draft.taskIdsByTags[prevGroupId].filter((id) => id != taskId);
|
|
386
396
|
const newGroupId = updates.tagIds.join(',');
|
|
387
397
|
if (draft.taskIdsByTags[newGroupId] != null) {
|
|
@@ -9,7 +9,8 @@ const taskReducer_1 = require("../../../entity/task/taskReducer");
|
|
|
9
9
|
const bulkUpdateTaskListEpic_1 = require("./bulkUpdateTaskListEpic");
|
|
10
10
|
const updateTaskFromListViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskListReducer_1.updateTaskFromListView.match), (0, operators_1.switchMap)((action) => {
|
|
11
11
|
const state = state$.value;
|
|
12
|
-
const {
|
|
12
|
+
const { task, updates } = action.payload;
|
|
13
|
+
const taskId = task.id;
|
|
13
14
|
const payload = {
|
|
14
15
|
tasks: (0, bulkUpdateTaskListEpic_1.getTasksListPayload)(state, [taskId], updates),
|
|
15
16
|
};
|
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.20",
|
|
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",
|