Class

TaskHelper

TaskHelper(task)

Helper class for tasks

Constructor

# new TaskHelper(task)

Creates an instance of TaskHelper.
Parameters:
Name Type Description
task ITask task

Classes

TaskHelper

Members

ChatChannelHelper

# readonly chat

Gets the helper for associated chat channel.
Example
import { TaskHelper } from "@twilio/flex-ui";
const taskHelper = new TaskHelper(someTask);
console.log(taskHelper.chat);
string

# readonly durationSinceUpdate

Duration since last update of a task. Uses `dateUpdated` property of a task.
Example
import { TaskHelper } from "@twilio/flex-ui";
const taskHelper = new TaskHelper(someTask);
console.log(taskHelper.durationSinceUpdate);
string

# readonly durationSinceUpdateShort

Duration since last update of a task in short format. Uses `dateUpdated` property of a task.
Example
import { TaskHelper } from "@twilio/flex-ui";
const taskHelper = new TaskHelper(someTask);
console.log(taskHelper.durationSinceUpdateShort);

Methods

# static amIOnHold(task) → {boolean}

Returns true if task is conference call and worker is on hold
Parameters:
Name Type Description
task ITask
boolean

# static canHold(task) → {boolean}

Returns true if task is live call task and worker can hold this call task
Parameters:
Name Type Description
task ITask
boolean

# static canKickWorkerParticipant(task, participant) → {boolean}

Returns true if current worker can kick the worker participant in the live call task
Parameters:
Name Type Description
task ITask
participant ConferenceState.ConferenceParticipant
boolean

# static canTransfer(task) → {boolean}

Returns true if task is live call task and worker can transfer this call task
Parameters:
Name Type Description
task ITask
boolean

# static getTaskByTaskSid(reservationSid) → {ITask}

Returns task by reservation sid
Parameters:
Name Type Description
reservationSid string reservation sid
ITask

# static getTaskChatChannelSid(task) → {string}

Gets chat channel sid for a task
Parameters:
Name Type Description
task ITask
chat channel sid
string

# static getTaskFromChannelSid(channelSid) → {ITask}

Returns a task which is associated with provided chat channel sid
Parameters:
Name Type Description
channelSid string chat channel sid
ITask

# static isCallOnHold(task) → {boolean}

Returns true if call associated with a task is on hold
Parameters:
Name Type Description
task ITask
boolean

# static isCallTask(task) → {boolean}

Returns true if task is a call based task
Parameters:
Name Type Description
task ITask
boolean

# static isChatBasedTask(task) → {boolean}

Returns true if task is a chat based
Parameters:
Name Type Description
task ITask
boolean

# static isCompleted(task) → {boolean}

Returns if reservation associated with the task is in completed state.
Parameters:
Name Type Description
task ITask
boolean

# static isGroupCall(task) → {boolean}

Returns true if task is Flex conference call with more than 2 participants
Parameters:
Name Type Description
task ITask
boolean

# static isIncomingCall(task) → {boolean}

Returns true if task is an incoming call.
Parameters:
Name Type Description
task ITask
boolean

# static isInitialOutboundAttemptTask(task) → {boolean}

Returns true if the task is initial pending attempt for outbound call
Parameters:
Name Type Description
task ITask
boolean

# static isInWrapupMode(task) → {boolean}

Returns if reservation associated with the task is in wrapping state.
Parameters:
Name Type Description
task ITask
boolean

# static isLiveCall(task) → {boolean}

Returns true if task is a live (accepted) call.
Parameters:
Name Type Description
task ITask
boolean

# static isLiveChat(task) → {boolean}

Returns true if task is a live (accepted) chat based.
Parameters:
Name Type Description
task ITask
boolean

# static isMyTask(task) → {boolean}

Returns if reservation associated with the task is assigned to the current user.
Parameters:
Name Type Description
task ITask
boolean

# static isOutboundCallTask(task) → {boolean}

Returns true if task is as outbound call task
Parameters:
Name Type Description
task ITask
boolean

# static isPending(task) → {boolean}

Returns if reservation associated with the task is in pending state.
Parameters:
Name Type Description
task ITask
boolean

# static isRegularConferenceCall(task) → {boolean}

Returns true if task is regular Flex conference call, not a custom call task
Parameters:
Name Type Description
task ITask
boolean

# static isTaskAccepted(task) → {boolean}

Returns true if task is not pending
Parameters:
Name Type Description
task ITask
boolean