Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const extractTaskListItemData = (task: ITask, isBrowser: boolean): TaskLi

const taskState = task.data.interaction.state;
const startTimeStamp = task.data.interaction.createdTimestamp;
const isIncomingTask = taskState === 'new' || taskState === 'consult';
const isIncomingTask = !task?.data.wrapUpRequired && (taskState === 'new' || taskState === 'consult');
const mediaType = task.data.interaction.mediaType;
const mediaChannel = task.data.interaction.mediaChannel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,40 @@ describe('task-list.utils', () => {
mockTask.data.interaction.mediaType = originalMediaType;
});

it('should extract correct data for incoming telephony task on browser if wrapUpRequired', () => {
const originalState = mockTask.data.interaction.state;
const originalCallAssociatedDetails = mockTask.data.interaction.callAssociatedDetails;
const originalWrapUpRequired = mockTask.data.wrapUpRequired;
const originalMediaType = mockTask.data.interaction.mediaType;

mockTask.data.interaction.state = 'new';
mockTask.data.interaction.callAssociatedDetails = {
ani: '9876543210',
customerName: 'Jane Smith',
virtualTeamName: 'Sales Team',
ronaTimeout: '60',
};
mockTask.data.wrapUpRequired = true;
mockTask.data.interaction.mediaType = MEDIA_CHANNEL.TELEPHONY;

const result = extractTaskListItemData(mockTask, true);

expect(result.ani).toBe('9876543210');
expect(result.ronaTimeout).toBeNull(); // Active tasks don't show RONA timeout
expect(result.taskState).toBe('new');
expect(result.isIncomingTask).toBe(false);
expect(result.acceptText).toBeUndefined();
expect(result.declineText).toBeUndefined();
expect(result.disableAccept).toBe(false);
expect(result.displayState).toBe('new');

// Restore original values
mockTask.data.interaction.state = originalState;
mockTask.data.interaction.callAssociatedDetails = originalCallAssociatedDetails;
mockTask.data.wrapUpRequired = originalWrapUpRequired;
mockTask.data.interaction.mediaType = originalMediaType;
});

it('should extract correct data for incoming telephony task on non-browser', () => {
const originalState = mockTask.data.interaction.state;
const originalCallAssociatedDetails = mockTask.data.interaction.callAssociatedDetails;
Expand Down
6 changes: 5 additions & 1 deletion packages/contact-center/store/src/storeEventsWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ class StoreWrapper implements IStoreWrapper {

setCurrentTask = (task: ITask | null, isClicked: boolean = false): void => {
// Don't assign the task as current task if the interaction state is 'new' or 'consult'
if (task?.data.interaction.state === 'new' || task?.data.interaction.state === 'consult') return;
if (
!task?.data.wrapUpRequired &&
(task?.data.interaction.state === 'new' || task?.data.interaction.state === 'consult')
)
return;

runInAction(() => {
// Determine if the new task is the same as the current task
Expand Down
Loading