Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Open
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This plugin addresses a few common needs in many contact centers:

* Changing the worker's activity when they're handling tasks and when their tasks are in wrapup.
* This makes it easier to monitor what workers are doing in realtime, and improves workforce management visibility in Flex Insights for historical reporting
* Changing the worker's activity to a default activity upon login
* Again, helps with real-time workforce management visibility and allows for more accurate reporting on post-login/pre-Available duration
* Ability to define activities that should not be manually selected, such as the activities used to indicate the worker is handling tasks or in wrapup
* Preventing the worker from changing their activity while they're on a task, delaying that activity change until after they've completed their tasks
* Changing to another activity like "Break" while the agent is actively handling tasks can result in inaccurate activity based reporting. Preventing that change until they're actually complete with their tasks aids in reporting and monitoring accuracy.
Expand Down
32,931 changes: 16,470 additions & 16,461 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
"version": "0.0.0",
"private": true,
"scripts": {
"postinstall": "flex-plugin pre-script-check"
"postinstall": "flex-plugin pre-script-check",
"lazy-deploy": "twilio flex:plugins:deploy --major --changelog 'Lazy change description' --description 'Lazy plugin description'"
},
"dependencies": {
"flex-plugin-scripts": "^4.3.18-beta.0",
"react": "16.5.2",
"react-dom": "16.5.2"
"react-dom": "16.5.2",
"@twilio/flex-plugin-scripts": "5.1.2"
},
"devDependencies": {
"@twilio/flex-ui": "^1"
"@twilio/flex-ui": "^1",
"react-test-renderer": "16.5.2"
}
}
}
2 changes: 1 addition & 1 deletion src/ActivityHandlerPlugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { VERSION } from '@twilio/flex-ui';
import { FlexPlugin } from 'flex-plugin';
import { FlexPlugin } from '@twilio/flex-plugin';

import PendingActivity from './components/PendingActivity';

Expand Down
1 change: 1 addition & 0 deletions src/enums/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const ReservationEvents = {

export const Activity = {
available: 'Available',
defaultLoggedIn: 'Unavailable Default',
onATask: 'On a Task',
onATaskNoAcd: 'On a Task, No ACD',
wrapup: 'Wrap Up',
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as FlexPlugin from 'flex-plugin';
import * as FlexPlugin from '@twilio/flex-plugin';
import ActivityHandlerPlugin from './ActivityHandlerPlugin';

FlexPlugin.loadPlugin(ActivityHandlerPlugin);
10 changes: 9 additions & 1 deletion src/listeners/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const manager = Manager.getInstance();
const reservationListeners = new Map();

const availableActivity = FlexState.getActivityByName(Activity.available);

// Update 'Activity.defaultLoggedIn' value to match the activity name you're
// using to indicate an agent has logged into Flex, but not selected an
// activity
const defaultLoggedInActivity = FlexState.getActivityByName(Activity.defaultLoggedIn);
// Update 'Activity.onATask' value to match the activity name you're
// using to indicate an agent has an active task
const onTaskActivity = FlexState.getActivityByName(Activity.onATask);
Expand All @@ -30,6 +35,7 @@ const wrapupNoAcdActivity = FlexState.getActivityByName(Activity.wrapupNoAcd);
// The activities in this array can only be set programmatically and will
// not be stored as pending activities to switch the user back to
const systemActivities = [
Activity.defaultLoggedIn,
Activity.onATask,
Activity.onATaskNoAcd,
Activity.wrapup,
Expand Down Expand Up @@ -146,7 +152,9 @@ const validateAndSetWorkerActivity = () => {
setWorkerActivity(targetActivity?.sid, pendingActivity ? true : false);
}
else if (workerActivitySid === FlexState.offlineActivitySid && !FlexState.hasWrappingTask) {
FlexState.clearPendingActivityChange();
// Assume fresh login with no ongoing tasks. Move to Default activity and clear pending
// activities if any
setWorkerActivity(defaultLoggedInActivity?.sid, true);
}
}
//#endregion Supporting functions
Expand Down