@webex/cc-task 1.28.0-ccconnectors.1

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.
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CallControlPresentationalProps } from '../task.types';
3
+ import './call-control.styles.scss';
4
+ declare function CallControlPresentational(props: CallControlPresentationalProps): React.JSX.Element;
5
+ export default CallControlPresentational;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CallControlProps } from '../task.types';
3
+ declare const CallControl: React.FunctionComponent<CallControlProps>;
4
+ export { CallControl };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IncomingTaskPresentationalProps } from '../task.types';
3
+ declare const IncomingTaskPresentational: React.FunctionComponent<IncomingTaskPresentationalProps>;
4
+ export default IncomingTaskPresentational;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IncomingTaskProps } from '../task.types';
3
+ declare const IncomingTask: React.FunctionComponent<IncomingTaskProps>;
4
+ export { IncomingTask };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const TaskList: React.FunctionComponent<{}>;
3
+ export { TaskList };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TaskListPresentationalProps } from '../task.types';
3
+ declare const TaskListPresentational: React.FunctionComponent<TaskListPresentationalProps>;
4
+ export default TaskListPresentational;
@@ -0,0 +1,25 @@
1
+ import { ITask } from '@webex/plugin-cc';
2
+ import { useCallControlProps, UseTaskListProps, UseTaskProps } from './task.types';
3
+ export declare const useTaskList: (props: UseTaskListProps) => {
4
+ taskList: ITask[];
5
+ acceptTask: (task: ITask) => void;
6
+ declineTask: (task: ITask) => void;
7
+ isBrowser: boolean;
8
+ };
9
+ export declare const useIncomingTask: (props: UseTaskProps) => {
10
+ incomingTask: any;
11
+ isAnswered: boolean;
12
+ isEnded: boolean;
13
+ accept: () => void;
14
+ decline: () => void;
15
+ isBrowser: boolean;
16
+ };
17
+ export declare const useCallControl: (props: useCallControlProps) => {
18
+ currentTask: ITask;
19
+ audioRef: import("react").MutableRefObject<HTMLAudioElement>;
20
+ endCall: () => void;
21
+ toggleHold: (hold: boolean) => void;
22
+ toggleRecording: (pause: boolean) => void;
23
+ wrapupCall: (wrapUpReason: string, auxCodeId: string) => void;
24
+ wrapupRequired: boolean;
25
+ };
@@ -0,0 +1,4 @@
1
+ import { IncomingTask } from './IncomingTask/index';
2
+ import { TaskList } from './TaskList';
3
+ import { CallControl } from './CallControl';
4
+ export { IncomingTask, TaskList, CallControl };
@@ -0,0 +1,156 @@
1
+ import { ITask, IContactCenter } from '@webex/plugin-cc';
2
+ import { ILogger, WrapupCodes } from '@webex/cc-store';
3
+ /**
4
+ * Interface representing the TaskProps of a user.
5
+ */
6
+ export interface TaskProps {
7
+ /**
8
+ * currentTask of the agent.
9
+ */
10
+ currentTask: ITask;
11
+ /**
12
+ * Incoming task on the incoming task widget
13
+ */
14
+ incomingTask: ITask;
15
+ /**
16
+ * CC SDK Instance.
17
+ */
18
+ cc: IContactCenter;
19
+ /**
20
+ * Handler for task accepted
21
+ */
22
+ onAccepted?: () => void;
23
+ /**
24
+ * Handler for task declined
25
+ */
26
+ onDeclined?: () => void;
27
+ /**
28
+ * Handler for task accepted in TaskList
29
+ */
30
+ onTaskAccepted?: (task: ITask) => void;
31
+ /**
32
+ * Handler for task declined in TaskList
33
+ */
34
+ onTaskDeclined?: (task: ITask) => void;
35
+ /**
36
+ * accept incoming task action
37
+ */
38
+ accept: () => void;
39
+ /**
40
+ * decline incoming task action
41
+ */
42
+ decline: () => void;
43
+ /**
44
+ * accept task from task list
45
+ */
46
+ acceptTask: (task: ITask) => void;
47
+ /**
48
+ * decline task from tasklist
49
+ */
50
+ declineTask: (task: ITask) => void;
51
+ /**
52
+ * Flag to determine if the user is logged in with a browser option
53
+ */
54
+ isBrowser: boolean;
55
+ /**
56
+ * Flag to determine if the task is answered
57
+ */
58
+ isAnswered: boolean;
59
+ /**
60
+ * Flag to determine if the task is ended
61
+ */
62
+ isEnded: boolean;
63
+ /**
64
+ * Selected login option
65
+ */
66
+ selectedLoginOption: string;
67
+ /**
68
+ * List of tasks
69
+ */
70
+ taskList: ITask[];
71
+ /**
72
+ * The logger instance from SDK
73
+ */
74
+ logger: ILogger;
75
+ }
76
+ export type UseTaskProps = Pick<TaskProps, 'cc' | 'onAccepted' | 'onDeclined' | 'selectedLoginOption' | 'logger'>;
77
+ export type UseTaskListProps = Pick<TaskProps, 'cc' | 'selectedLoginOption' | 'onTaskAccepted' | 'onTaskDeclined' | 'logger'>;
78
+ export type IncomingTaskPresentationalProps = Pick<TaskProps, 'incomingTask' | 'isBrowser' | 'isAnswered' | 'isEnded' | 'accept' | 'decline'>;
79
+ export type IncomingTaskProps = Pick<TaskProps, 'onAccepted' | 'onDeclined'>;
80
+ export type TaskListProps = Pick<TaskProps, 'onTaskAccepted' | 'onTaskDeclined'>;
81
+ export type TaskListPresentationalProps = Pick<TaskProps, 'currentTask' | 'taskList' | 'isBrowser' | 'acceptTask' | 'declineTask'>;
82
+ export declare enum TASK_EVENTS {
83
+ TASK_INCOMING = "task:incoming",
84
+ TASK_ASSIGNED = "task:assigned",
85
+ TASK_MEDIA = "task:media",
86
+ TASK_HOLD = "task:hold",
87
+ TASK_UNHOLD = "task:unhold",
88
+ TASK_CONSULT = "task:consult",
89
+ TASK_CONSULT_END = "task:consultEnd",
90
+ TASK_CONSULT_ACCEPT = "task:consultAccepted",
91
+ TASK_PAUSE = "task:pause",
92
+ TASK_RESUME = "task:resume",
93
+ TASK_END = "task:end",
94
+ TASK_WRAPUP = "task:wrapup"
95
+ }
96
+ /**
97
+ * Interface representing the properties for control actions on a task.
98
+ */
99
+ export interface ControlProps {
100
+ /**
101
+ * Audio reference
102
+ */
103
+ audioRef: React.RefObject<HTMLAudioElement>;
104
+ /**
105
+ * The current task being handled.
106
+ */
107
+ currentTask: ITask;
108
+ /**
109
+ * Function to handle hold/resume actions.
110
+ */
111
+ onHoldResume: () => void;
112
+ /**
113
+ * Function to handle ending the task.
114
+ */
115
+ onEnd: () => void;
116
+ /**
117
+ * Function to handle wrapping up the task.
118
+ */
119
+ onWrapUp: () => void;
120
+ /**
121
+ * Logger instance for logging purposes.
122
+ */
123
+ logger: ILogger;
124
+ /**
125
+ * Array of wrap-up codes.
126
+ * TODO: Expose this type from SDK.
127
+ */
128
+ wrapupCodes: WrapupCodes[];
129
+ /**
130
+ * Indicates if wrap-up is required.
131
+ */
132
+ wrapupRequired: boolean;
133
+ /**
134
+ * Function to handle hold/resume actions with a boolean parameter.
135
+ * @param hold - Boolean indicating whether to hold (true) or resume (false).
136
+ */
137
+ toggleHold: (hold: boolean) => void;
138
+ /**
139
+ * Function to handle pause/resume recording actions with a boolean parameter.
140
+ * @param pause - Boolean indicating whether to pause (true) or resume (false) recording.
141
+ */
142
+ toggleRecording: (pause: boolean) => void;
143
+ /**
144
+ * Function to handle ending the call.
145
+ */
146
+ endCall: () => void;
147
+ /**
148
+ * Function to handle wrapping up the call with a reason and ID.
149
+ * @param wrapupReason - The reason for wrapping up the call.
150
+ * @param wrapupId - The ID associated with the wrap-up reason.
151
+ */
152
+ wrapupCall: (wrapupReason: string, wrapupId: string) => void;
153
+ }
154
+ export type CallControlProps = Pick<ControlProps, 'onHoldResume' | 'onEnd' | 'onWrapUp'>;
155
+ export type CallControlPresentationalProps = Pick<ControlProps, 'currentTask' | 'audioRef' | 'wrapupCodes' | 'wrapupRequired' | 'toggleHold' | 'toggleRecording' | 'endCall' | 'wrapupCall'>;
156
+ export type useCallControlProps = Pick<ControlProps, 'currentTask' | 'onHoldResume' | 'onEnd' | 'onWrapUp' | 'logger'>;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@webex/cc-task",
3
+ "description": "Webex Contact Center Widgets: Task",
4
+ "version": "1.28.0-ccconnectors.1",
5
+ "main": "dist/index.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "files": [
10
+ "dist/",
11
+ "package.json"
12
+ ],
13
+ "scripts": {
14
+ "clean": "rm -rf dist && rm -rf node_modules",
15
+ "clean:dist": "rm -rf dist",
16
+ "build": "yarn run -T tsc",
17
+ "build:src": "yarn run clean:dist && webpack",
18
+ "build:watch": "webpack --watch",
19
+ "test:unit": "jest --coverage"
20
+ },
21
+ "dependencies": {
22
+ "@webex/cc-store": "1.28.0-ccconnectors.1",
23
+ "mobx-react-lite": "^4.1.0",
24
+ "webex": "3.7.0-wxcc.5"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/core": "7.25.2",
28
+ "@babel/preset-env": "7.25.4",
29
+ "@babel/preset-react": "7.24.7",
30
+ "@babel/preset-typescript": "7.25.9",
31
+ "@testing-library/dom": "10.4.0",
32
+ "@testing-library/jest-dom": "6.6.2",
33
+ "@testing-library/react": "16.0.1",
34
+ "@types/jest": "29.5.14",
35
+ "@types/react-test-renderer": "18",
36
+ "babel-jest": "29.7.0",
37
+ "babel-loader": "9.2.1",
38
+ "file-loader": "6.2.0",
39
+ "jest": "29.7.0",
40
+ "jest-environment-jsdom": "29.7.0",
41
+ "ts-loader": "9.5.1",
42
+ "typescript": "5.6.3",
43
+ "webpack": "5.94.0",
44
+ "webpack-cli": "5.1.4",
45
+ "webpack-merge": "6.0.1"
46
+ },
47
+ "peerDependencies": {
48
+ "@emotion/react": ">=11.14.0",
49
+ "@emotion/styled": ">=11.14.0",
50
+ "@mui/material": ">=6.4.2",
51
+ "react": ">=18.3.1",
52
+ "react-dom": ">=18.3.1"
53
+ },
54
+ "jest": {
55
+ "testEnvironment": "jsdom",
56
+ "testMatch": [
57
+ "**/tests/**/*.ts",
58
+ "**/tests/**/*.tsx"
59
+ ],
60
+ "moduleNameMapper": {
61
+ "^.+\\.(css|less|scss)$": "babel-jest"
62
+ }
63
+ },
64
+ "stableVersion": "1.28.0-ccwidgets.13"
65
+ }