call-control-sdk 4.0.0 → 5.0.0
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/README.md +3 -4
- package/dist/index.d.mts +39 -8
- package/dist/index.d.ts +39 -8
- package/dist/index.js +1600 -840
- package/dist/index.mjs +1546 -791
- package/package.json +67 -57
package/dist/index.mjs
CHANGED
|
@@ -20,44 +20,40 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
21
|
|
|
22
22
|
// call-control-sdk/lib/components/callControlPanel.tsx
|
|
23
|
-
import { useEffect as useEffect2, useState as useState5, useCallback as useCallback3 } from "react";
|
|
24
23
|
import {
|
|
25
|
-
|
|
26
|
-
IconButton as IconButton2,
|
|
27
|
-
Typography as Typography2,
|
|
28
|
-
Menu,
|
|
29
|
-
Box as Box2,
|
|
30
|
-
Tooltip,
|
|
31
|
-
Fade,
|
|
32
|
-
useTheme,
|
|
33
|
-
Button as Button2,
|
|
34
|
-
Chip,
|
|
35
|
-
TextField as TextField2,
|
|
36
|
-
ButtonGroup,
|
|
37
|
-
MenuItem
|
|
38
|
-
} from "@mui/material";
|
|
39
|
-
import {
|
|
40
|
-
PauseCircle as PauseCircle2,
|
|
41
|
-
PlayCircle,
|
|
42
|
-
Mic,
|
|
43
|
-
MicOff,
|
|
24
|
+
ArrowDropDown,
|
|
44
25
|
CallEnd as CallEnd2,
|
|
45
|
-
|
|
26
|
+
Close as Close2,
|
|
46
27
|
DragIndicator,
|
|
47
|
-
|
|
28
|
+
Group,
|
|
29
|
+
History,
|
|
48
30
|
Layers,
|
|
49
|
-
|
|
50
|
-
|
|
31
|
+
Mic as Mic2,
|
|
32
|
+
MicOff as MicOff2,
|
|
33
|
+
Pause as Pause2,
|
|
51
34
|
Pending,
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
Phone,
|
|
36
|
+
PlayArrow as PlayArrow2,
|
|
54
37
|
SupportAgent as SupportAgent2,
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
TransferWithinAStation,
|
|
39
|
+
Upcoming,
|
|
40
|
+
WifiCalling3
|
|
57
41
|
} from "@mui/icons-material";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
import {
|
|
43
|
+
Box as Box2,
|
|
44
|
+
Button as Button2,
|
|
45
|
+
Chip,
|
|
46
|
+
Fade,
|
|
47
|
+
IconButton as IconButton2,
|
|
48
|
+
Menu,
|
|
49
|
+
MenuItem,
|
|
50
|
+
Paper as Paper2,
|
|
51
|
+
TextField as TextField2,
|
|
52
|
+
Tooltip as Tooltip2,
|
|
53
|
+
Typography as Typography2,
|
|
54
|
+
useTheme as useTheme3
|
|
55
|
+
} from "@mui/material";
|
|
56
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef2, useState as useState5 } from "react";
|
|
61
57
|
|
|
62
58
|
// call-control-sdk/lib/hooks/sdk-state.ts
|
|
63
59
|
var SDKStateManager = class {
|
|
@@ -71,18 +67,74 @@ var SDKStateManager = class {
|
|
|
71
67
|
getInitialState() {
|
|
72
68
|
return {
|
|
73
69
|
apiKey: null,
|
|
70
|
+
process: null,
|
|
71
|
+
agentId: "",
|
|
74
72
|
isInitialized: false,
|
|
75
73
|
isHolding: false,
|
|
76
74
|
isMuted: false,
|
|
77
75
|
status: "idle",
|
|
78
76
|
callStartTime: null,
|
|
79
|
-
controlPanelPosition: { x:
|
|
80
|
-
iframePosition: { x:
|
|
77
|
+
controlPanelPosition: { x: 10, y: 10 },
|
|
78
|
+
iframePosition: { x: 10, y: 80 },
|
|
81
79
|
callData: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
agent_id: "",
|
|
81
|
+
status: "",
|
|
82
|
+
type: "",
|
|
83
|
+
event_time: "",
|
|
84
|
+
phone_number: ""
|
|
85
|
+
},
|
|
86
|
+
conferenceLine: [
|
|
87
|
+
{
|
|
88
|
+
line: 1,
|
|
89
|
+
status: "IDLE",
|
|
90
|
+
type: "",
|
|
91
|
+
phone: "",
|
|
92
|
+
isMute: false,
|
|
93
|
+
isHold: false,
|
|
94
|
+
isCallStart: false,
|
|
95
|
+
isMergeCall: false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
line: 2,
|
|
99
|
+
status: "IDLE",
|
|
100
|
+
type: "",
|
|
101
|
+
phone: "",
|
|
102
|
+
isMute: false,
|
|
103
|
+
isHold: false,
|
|
104
|
+
isCallStart: false,
|
|
105
|
+
isMergeCall: false
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
line: 3,
|
|
109
|
+
status: "IDLE",
|
|
110
|
+
type: "",
|
|
111
|
+
phone: "",
|
|
112
|
+
isMute: false,
|
|
113
|
+
isHold: false,
|
|
114
|
+
isCallStart: false,
|
|
115
|
+
isMergeCall: false
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
line: 4,
|
|
119
|
+
status: "IDLE",
|
|
120
|
+
type: "",
|
|
121
|
+
phone: "",
|
|
122
|
+
isMute: false,
|
|
123
|
+
isHold: false,
|
|
124
|
+
isCallStart: false,
|
|
125
|
+
isMergeCall: false
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
line: 5,
|
|
129
|
+
status: "IDLE",
|
|
130
|
+
type: "",
|
|
131
|
+
phone: "",
|
|
132
|
+
isMute: false,
|
|
133
|
+
isHold: false,
|
|
134
|
+
isCallStart: false,
|
|
135
|
+
isMergeCall: false
|
|
136
|
+
}
|
|
137
|
+
]
|
|
86
138
|
};
|
|
87
139
|
}
|
|
88
140
|
loadFromStorage() {
|
|
@@ -91,15 +143,26 @@ var SDKStateManager = class {
|
|
|
91
143
|
if (stored) {
|
|
92
144
|
const parsedState = JSON.parse(stored);
|
|
93
145
|
this.state = __spreadProps(__spreadValues({}, this.state), {
|
|
146
|
+
apiKey: parsedState.apiKey || "",
|
|
147
|
+
agentId: parsedState.agentId || "",
|
|
148
|
+
process: parsedState.process || null,
|
|
149
|
+
isInitialized: parsedState.isInitialized || false,
|
|
94
150
|
isHolding: parsedState.isHolding || false,
|
|
95
151
|
isMuted: parsedState.isMuted || false,
|
|
96
152
|
status: parsedState.status || "idle",
|
|
153
|
+
callStartTime: parsedState.callStartTime || null,
|
|
97
154
|
controlPanelPosition: parsedState.controlPanelPosition || {
|
|
98
|
-
x:
|
|
99
|
-
y:
|
|
155
|
+
x: 10,
|
|
156
|
+
y: 10
|
|
100
157
|
},
|
|
101
|
-
iframePosition: parsedState.iframePosition || { x:
|
|
102
|
-
|
|
158
|
+
iframePosition: parsedState.iframePosition || { x: 10, y: 80 },
|
|
159
|
+
callData: parsedState.callData || {
|
|
160
|
+
mobileNumber: "",
|
|
161
|
+
callReferenceId: "",
|
|
162
|
+
agentLoginId: ""
|
|
163
|
+
},
|
|
164
|
+
// Fix: Properly handle conferenceLine with fallback to initial state
|
|
165
|
+
conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine
|
|
103
166
|
});
|
|
104
167
|
}
|
|
105
168
|
} catch (error) {
|
|
@@ -109,12 +172,18 @@ var SDKStateManager = class {
|
|
|
109
172
|
saveToStorage() {
|
|
110
173
|
try {
|
|
111
174
|
const persistentState = {
|
|
175
|
+
apiKey: this.state.apiKey,
|
|
176
|
+
agentId: this.state.agentId,
|
|
177
|
+
process: this.state.process,
|
|
178
|
+
isInitialized: this.state.isInitialized,
|
|
112
179
|
isHolding: this.state.isHolding,
|
|
113
180
|
isMuted: this.state.isMuted,
|
|
114
181
|
status: this.state.status,
|
|
182
|
+
callStartTime: this.state.callStartTime,
|
|
115
183
|
controlPanelPosition: this.state.controlPanelPosition,
|
|
116
184
|
iframePosition: this.state.iframePosition,
|
|
117
|
-
|
|
185
|
+
callData: this.state.callData,
|
|
186
|
+
conferenceLine: this.state.conferenceLine
|
|
118
187
|
};
|
|
119
188
|
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(persistentState));
|
|
120
189
|
} catch (error) {
|
|
@@ -124,12 +193,14 @@ var SDKStateManager = class {
|
|
|
124
193
|
notifyListeners() {
|
|
125
194
|
this.listeners.forEach((listener) => listener());
|
|
126
195
|
}
|
|
127
|
-
initialize(apiKey) {
|
|
196
|
+
initialize(apiKey, agentId) {
|
|
128
197
|
if (!apiKey || typeof apiKey !== "string" || apiKey.trim().length === 0) {
|
|
129
198
|
throw new Error("API key not available");
|
|
130
199
|
}
|
|
131
200
|
this.state.apiKey = apiKey;
|
|
201
|
+
this.state.agentId = agentId;
|
|
132
202
|
this.state.isInitialized = true;
|
|
203
|
+
this.saveToStorage();
|
|
133
204
|
this.notifyListeners();
|
|
134
205
|
}
|
|
135
206
|
getState() {
|
|
@@ -159,6 +230,11 @@ var SDKStateManager = class {
|
|
|
159
230
|
this.saveToStorage();
|
|
160
231
|
this.notifyListeners();
|
|
161
232
|
}
|
|
233
|
+
setProcess(process) {
|
|
234
|
+
this.state.process = process;
|
|
235
|
+
this.saveToStorage();
|
|
236
|
+
this.notifyListeners();
|
|
237
|
+
}
|
|
162
238
|
setControlPanelPosition(position) {
|
|
163
239
|
this.state.controlPanelPosition = position;
|
|
164
240
|
this.saveToStorage();
|
|
@@ -185,33 +261,64 @@ var SDKStateManager = class {
|
|
|
185
261
|
}
|
|
186
262
|
updateCallData(data) {
|
|
187
263
|
this.state.callData = __spreadValues(__spreadValues({}, this.state.callData), data);
|
|
264
|
+
this.saveToStorage();
|
|
188
265
|
this.notifyListeners();
|
|
189
266
|
}
|
|
267
|
+
setConferenceLine(line) {
|
|
268
|
+
var _a;
|
|
269
|
+
if (!this.state.conferenceLine || !Array.isArray(this.state.conferenceLine)) {
|
|
270
|
+
console.warn("Conference line data corrupted, resetting to initial state");
|
|
271
|
+
this.state.conferenceLine = this.getInitialState().conferenceLine;
|
|
272
|
+
}
|
|
273
|
+
const conferenceLineData = (_a = this.state.conferenceLine) == null ? void 0 : _a.map((each) => {
|
|
274
|
+
if (each.line === line.line) {
|
|
275
|
+
return line;
|
|
276
|
+
}
|
|
277
|
+
return each;
|
|
278
|
+
});
|
|
279
|
+
this.state.conferenceLine = conferenceLineData;
|
|
280
|
+
this.saveToStorage();
|
|
281
|
+
this.notifyListeners();
|
|
282
|
+
}
|
|
283
|
+
resetConferenceLines() {
|
|
284
|
+
this.state.conferenceLine = this.getInitialState().conferenceLine;
|
|
285
|
+
this.saveToStorage();
|
|
286
|
+
this.notifyListeners();
|
|
287
|
+
}
|
|
288
|
+
clearStorageAndReset() {
|
|
289
|
+
try {
|
|
290
|
+
localStorage.removeItem(this.STORAGE_KEY);
|
|
291
|
+
this.state = this.getInitialState();
|
|
292
|
+
this.notifyListeners();
|
|
293
|
+
} catch (error) {
|
|
294
|
+
console.warn("Failed to clear localStorage:", error);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Debug methods
|
|
298
|
+
debugStorage() {
|
|
299
|
+
try {
|
|
300
|
+
const stored = localStorage.getItem(this.STORAGE_KEY);
|
|
301
|
+
console.log("Current localStorage data:", stored);
|
|
302
|
+
if (stored) {
|
|
303
|
+
console.log("Parsed localStorage data:", JSON.parse(stored));
|
|
304
|
+
}
|
|
305
|
+
console.log("Current state:", this.state);
|
|
306
|
+
} catch (error) {
|
|
307
|
+
console.error("Error debugging storage:", error);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
getConferenceLines() {
|
|
311
|
+
return this.state.conferenceLine || [];
|
|
312
|
+
}
|
|
190
313
|
};
|
|
191
314
|
var sdkStateManager = new SDKStateManager();
|
|
192
315
|
|
|
193
|
-
// call-control-sdk/lib/hooks/useSDKState.ts
|
|
194
|
-
function useSDKState() {
|
|
195
|
-
const [state, setState] = useState(sdkStateManager.getState());
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
198
|
-
setState(sdkStateManager.getState());
|
|
199
|
-
});
|
|
200
|
-
return unsubscribe;
|
|
201
|
-
}, []);
|
|
202
|
-
return state;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
316
|
// call-control-sdk/lib/hooks/useDraggable.ts
|
|
206
|
-
import {
|
|
207
|
-
useState as useState2,
|
|
208
|
-
useRef,
|
|
209
|
-
useCallback
|
|
210
|
-
} from "react";
|
|
317
|
+
import { useCallback, useRef, useState } from "react";
|
|
211
318
|
function useDraggable(initialPosition, onPositionChange) {
|
|
212
|
-
const [position, setPosition] =
|
|
213
|
-
const [isDragging, setIsDragging] =
|
|
214
|
-
const dragRef = useRef(
|
|
319
|
+
const [position, setPosition] = useState(initialPosition);
|
|
320
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
321
|
+
const dragRef = useRef();
|
|
215
322
|
const dragStart = useRef({ x: 0, y: 0 });
|
|
216
323
|
const elementStart = useRef({ x: 0, y: 0 });
|
|
217
324
|
const updatePosition = useCallback(
|
|
@@ -296,14 +403,22 @@ function useDraggable(initialPosition, onPositionChange) {
|
|
|
296
403
|
};
|
|
297
404
|
}
|
|
298
405
|
|
|
299
|
-
// call-control-sdk/lib/
|
|
300
|
-
import {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
406
|
+
// call-control-sdk/lib/hooks/useSDKState.ts
|
|
407
|
+
import { useState as useState2, useEffect } from "react";
|
|
408
|
+
function useSDKState() {
|
|
409
|
+
const [state, setState] = useState2(sdkStateManager.getState());
|
|
410
|
+
useEffect(() => {
|
|
411
|
+
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
412
|
+
setState(sdkStateManager.getState());
|
|
413
|
+
});
|
|
414
|
+
return unsubscribe;
|
|
415
|
+
}, []);
|
|
416
|
+
return state;
|
|
417
|
+
}
|
|
304
418
|
|
|
305
419
|
// call-control-sdk/lib/services/endPoint.ts
|
|
306
|
-
var BASE_URL = "http://192.168.100.143:
|
|
420
|
+
var BASE_URL = "http://192.168.100.143:8095";
|
|
421
|
+
var WS_BASE_URL = "ws://192.168.100.143:8095";
|
|
307
422
|
var VERSION = {
|
|
308
423
|
v1: "/api/v1"
|
|
309
424
|
};
|
|
@@ -316,15 +431,26 @@ var END_POINT = {
|
|
|
316
431
|
MUTE_CALL: `${BASE_URL}${VERSION.v1}/cti/mute-call?provider=convox`,
|
|
317
432
|
UNMUTE_CALL: `${BASE_URL}${VERSION.v1}/cti/unmute-call?provider=convox`,
|
|
318
433
|
END_CALL: `${BASE_URL}${VERSION.v1}/cti/end-call?provider=convox`,
|
|
319
|
-
LOGOUT: `${BASE_URL}${VERSION.v1}/cti
|
|
434
|
+
LOGOUT: `${BASE_URL}${VERSION.v1}/cti/logout?provider=convox`,
|
|
320
435
|
CONFERENCE_CALL: `${BASE_URL}${VERSION.v1}/cti/conference-call?provider=convox`,
|
|
321
436
|
CONFERENCE_CALL_HOLD_OR_UN_HOLD: `${BASE_URL}${VERSION.v1}/cti/conference-call/hold-unhold?provider=convox`,
|
|
322
437
|
CONFERENCE_CALL_MUTE_OT_UN_MUTE: `${BASE_URL}${VERSION.v1}/cti/conference-call/mute-unmute?provider=convox`,
|
|
323
438
|
CONFERENCE_CALL_END: `${BASE_URL}${VERSION.v1}/cti/conference-call/hangup?provider=convox`,
|
|
324
|
-
|
|
439
|
+
CONFERENCE_CALL_END_ALL: `${BASE_URL}${VERSION.v1}/cti/conference-call/hangup-all-call?provider=convox`,
|
|
440
|
+
TRANSFER_CALL: `${BASE_URL}${VERSION.v1}/cti/transfer?provider=convox`,
|
|
441
|
+
AGENTS_LIST: `${BASE_URL}${VERSION.v1}/cti/users`,
|
|
442
|
+
PROCESS_LIST: `${BASE_URL}${VERSION.v1}/cti/processes-list`,
|
|
443
|
+
TRANSFER_TO_DETAILS: `${BASE_URL}${VERSION.v1}/cti/trasnfer-to-details?provider=convox`
|
|
444
|
+
};
|
|
445
|
+
var WS_END_POINT = {
|
|
446
|
+
WS: `${WS_BASE_URL}${VERSION.v1}/cti/ws`
|
|
325
447
|
};
|
|
326
448
|
|
|
449
|
+
// call-control-sdk/lib/services/request.ts
|
|
450
|
+
import { useCallback as useCallback2, useReducer } from "react";
|
|
451
|
+
|
|
327
452
|
// call-control-sdk/lib/services/axios.ts
|
|
453
|
+
import axios from "axios";
|
|
328
454
|
var token = "12345";
|
|
329
455
|
var axiosInstance = axios.create({
|
|
330
456
|
baseURL: BASE_URL,
|
|
@@ -454,21 +580,11 @@ var usePostRequest = (props = {}) => {
|
|
|
454
580
|
payload: true
|
|
455
581
|
});
|
|
456
582
|
axios_default.post(url, payload, config).then((res) => {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
});
|
|
463
|
-
onSuccess == null ? void 0 : onSuccess(res.data, payload);
|
|
464
|
-
} else {
|
|
465
|
-
dispatch({
|
|
466
|
-
type: "isError",
|
|
467
|
-
payload: res.data
|
|
468
|
-
});
|
|
469
|
-
showToast((_b = res.data) == null ? void 0 : _b.message, "error");
|
|
470
|
-
onError == null ? void 0 : onError(res.data, payload);
|
|
471
|
-
}
|
|
583
|
+
dispatch({
|
|
584
|
+
type: "isSuccess",
|
|
585
|
+
payload: res.data
|
|
586
|
+
});
|
|
587
|
+
onSuccess == null ? void 0 : onSuccess(res.data, payload);
|
|
472
588
|
}).catch((err) => {
|
|
473
589
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
474
590
|
const error = {
|
|
@@ -504,10 +620,11 @@ import {
|
|
|
504
620
|
CallEnd,
|
|
505
621
|
CallSplit,
|
|
506
622
|
Close,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
623
|
+
Mic,
|
|
624
|
+
MicOff,
|
|
625
|
+
Pause,
|
|
510
626
|
PhoneDisabled,
|
|
627
|
+
PlayArrow,
|
|
511
628
|
SupportAgent
|
|
512
629
|
} from "@mui/icons-material";
|
|
513
630
|
import {
|
|
@@ -516,27 +633,191 @@ import {
|
|
|
516
633
|
Dialog,
|
|
517
634
|
IconButton,
|
|
518
635
|
Paper,
|
|
519
|
-
Radio,
|
|
520
|
-
Stack,
|
|
521
636
|
TextField,
|
|
522
637
|
Typography,
|
|
523
638
|
Autocomplete,
|
|
524
|
-
Grid
|
|
639
|
+
Grid,
|
|
640
|
+
Tooltip,
|
|
641
|
+
useTheme as useTheme2
|
|
525
642
|
} from "@mui/material";
|
|
526
|
-
import { useState as useState4 } from "react";
|
|
643
|
+
import { useEffect as useEffect2, useState as useState4 } from "react";
|
|
644
|
+
|
|
645
|
+
// call-control-sdk/lib/components/styles.ts
|
|
646
|
+
import { useTheme } from "@mui/material";
|
|
647
|
+
var useMyStyles = () => {
|
|
648
|
+
const theme = useTheme();
|
|
649
|
+
return {
|
|
650
|
+
disabled: {
|
|
651
|
+
padding: "0px",
|
|
652
|
+
margin: "0px",
|
|
653
|
+
minWidth: "40px !important",
|
|
654
|
+
borderRadius: "16px",
|
|
655
|
+
border: `1px solid rgb(206, 204, 204)`,
|
|
656
|
+
height: "40px",
|
|
657
|
+
"&:hover": {
|
|
658
|
+
boxShadow: " 0px 2px 2px rgba(0, 0, 0, 0.79)",
|
|
659
|
+
border: `1px solid ${theme.palette.primary.main}`
|
|
660
|
+
},
|
|
661
|
+
"&:active": {
|
|
662
|
+
bgcolor: "primary.main",
|
|
663
|
+
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
enabled: {
|
|
667
|
+
padding: "0px",
|
|
668
|
+
margin: "0px",
|
|
669
|
+
minWidth: "40px !important",
|
|
670
|
+
borderRadius: "16px",
|
|
671
|
+
boxShadow: " 0px 2px 1px rgba(0, 0, 0, 0.507)",
|
|
672
|
+
border: `1px solid ${theme.palette.primary.main}`,
|
|
673
|
+
height: "40px",
|
|
674
|
+
"&:hover": {
|
|
675
|
+
boxShadow: " 0px 2px 1px rgba(0, 0, 0, 0.507)",
|
|
676
|
+
border: `1px solid ${theme.palette.primary.main}`
|
|
677
|
+
},
|
|
678
|
+
"&:active": {
|
|
679
|
+
bgcolor: "primary.main",
|
|
680
|
+
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
outlined: {
|
|
684
|
+
padding: "0px",
|
|
685
|
+
margin: "0px",
|
|
686
|
+
minWidth: "40px !important",
|
|
687
|
+
borderRadius: "16px",
|
|
688
|
+
backgroundColor: theme.palette.grey[200],
|
|
689
|
+
boxShadow: `0px 2px 1px ${theme.palette.primary.light}`,
|
|
690
|
+
border: `0px solid ${theme.palette.primary.main}`,
|
|
691
|
+
height: "40px",
|
|
692
|
+
"&:hover": {
|
|
693
|
+
boxShadow: `0px 2px 1px ${theme.palette.primary.main}`,
|
|
694
|
+
border: `0px solid ${theme.palette.primary.main}`
|
|
695
|
+
},
|
|
696
|
+
"&:active": {
|
|
697
|
+
bgcolor: "primary.main",
|
|
698
|
+
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
var styles_default = useMyStyles;
|
|
704
|
+
|
|
705
|
+
// call-control-sdk/lib/components/dialog.tsx
|
|
527
706
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
528
|
-
function ConferenceDialog({
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
onEndAllCalls,
|
|
534
|
-
open,
|
|
535
|
-
setOpen
|
|
536
|
-
}) {
|
|
707
|
+
function ConferenceDialog({ open, setOpen }) {
|
|
708
|
+
var _a, _b;
|
|
709
|
+
const state = useSDKState();
|
|
710
|
+
const { disabled, enabled, outlined } = styles_default();
|
|
711
|
+
const theme = useTheme2();
|
|
537
712
|
const handleClose = () => {
|
|
538
713
|
setOpen(false);
|
|
539
714
|
};
|
|
715
|
+
const onConferenceLineUpdate = (line, data) => {
|
|
716
|
+
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
717
|
+
};
|
|
718
|
+
const onConferenceCallStart = (line, data) => {
|
|
719
|
+
var _a2, _b2, _c, _d;
|
|
720
|
+
const line_used = __spreadValues(__spreadValues({}, line), data);
|
|
721
|
+
const payload = {
|
|
722
|
+
action: "EXTERNAL_CONFERENCE",
|
|
723
|
+
operation: `CALL${line_used.line}`,
|
|
724
|
+
line_used: String(line_used.line),
|
|
725
|
+
thirdparty_no: line_used.phone,
|
|
726
|
+
userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
|
|
727
|
+
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
728
|
+
};
|
|
729
|
+
axios_default.post(END_POINT.CONFERENCE_CALL, payload).then(() => {
|
|
730
|
+
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
731
|
+
});
|
|
732
|
+
};
|
|
733
|
+
const onMergeConferenceCall = (line, data) => {
|
|
734
|
+
var _a2, _b2, _c, _d;
|
|
735
|
+
const line_used = __spreadValues(__spreadValues({}, line), data);
|
|
736
|
+
const payload = {
|
|
737
|
+
action: "EXTERNAL_CONFERENCE",
|
|
738
|
+
operation: `CONFERENCE`,
|
|
739
|
+
line_used: String(line_used.line),
|
|
740
|
+
thirdparty_no: line_used.phone,
|
|
741
|
+
userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
|
|
742
|
+
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
743
|
+
};
|
|
744
|
+
axios_default.post(END_POINT.CONFERENCE_CALL, payload).then(() => {
|
|
745
|
+
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
746
|
+
});
|
|
747
|
+
};
|
|
748
|
+
const onHoldOrUnHoldConferenceCall = (line, data, type) => {
|
|
749
|
+
var _a2, _b2, _c, _d;
|
|
750
|
+
const line_used = __spreadValues(__spreadValues({}, line), data);
|
|
751
|
+
const payload = {
|
|
752
|
+
action: "EXTERNAL_CONFERENCE",
|
|
753
|
+
operation: type,
|
|
754
|
+
hold_channel_no: type === "HOLDUSER" ? `hold${line_used.line}` : `unhold${line_used.line}`,
|
|
755
|
+
// Change the line according where u intiated firstly
|
|
756
|
+
userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
|
|
757
|
+
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
758
|
+
};
|
|
759
|
+
axios_default.post(END_POINT.CONFERENCE_CALL_HOLD_OR_UN_HOLD, payload).then(() => {
|
|
760
|
+
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
761
|
+
});
|
|
762
|
+
};
|
|
763
|
+
const onMuteOrUnMuteConferenceCall = (line, data, type) => {
|
|
764
|
+
var _a2, _b2, _c, _d;
|
|
765
|
+
const line_used = __spreadValues(__spreadValues({}, line), data);
|
|
766
|
+
const payload = {
|
|
767
|
+
action: "EXTERNAL_CONFERENCE",
|
|
768
|
+
operation: type,
|
|
769
|
+
channel_no: type === "MUTEUSER" ? `mute${line_used.line}` : `play${line_used.line}`,
|
|
770
|
+
userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
|
|
771
|
+
thirdparty_no: line_used.phone,
|
|
772
|
+
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
773
|
+
};
|
|
774
|
+
axios_default.post(END_POINT.CONFERENCE_CALL_MUTE_OT_UN_MUTE, payload).then(() => {
|
|
775
|
+
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
776
|
+
});
|
|
777
|
+
};
|
|
778
|
+
const onEndConferenceCall = (line, data) => {
|
|
779
|
+
var _a2, _b2, _c, _d;
|
|
780
|
+
const line_used = __spreadValues(__spreadValues({}, line), data);
|
|
781
|
+
const payload = {
|
|
782
|
+
action: "EXTERNAL_CONFERENCE",
|
|
783
|
+
operation: "HANGUP_CHANNEL",
|
|
784
|
+
line_used: String(line_used.line - 1),
|
|
785
|
+
user_type: `THIRDPARTY${line_used.line - 1}`,
|
|
786
|
+
thirdparty_no: line_used.phone,
|
|
787
|
+
userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
|
|
788
|
+
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
789
|
+
};
|
|
790
|
+
axios_default.post(END_POINT.CONFERENCE_CALL_END, payload).then(() => {
|
|
791
|
+
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
const onEndAllConferenceCalls = () => {
|
|
795
|
+
var _a2, _b2, _c, _d;
|
|
796
|
+
const payload = {
|
|
797
|
+
action: "EXTERNAL_CONFERENCE",
|
|
798
|
+
operation: "ENDCONFERENCE",
|
|
799
|
+
userid: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.agent_id) != null ? _b2 : "",
|
|
800
|
+
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
801
|
+
};
|
|
802
|
+
axios_default.post(END_POINT.CONFERENCE_CALL_END_ALL, payload).then(() => {
|
|
803
|
+
sdkStateManager.resetConferenceLines();
|
|
804
|
+
handleClose();
|
|
805
|
+
});
|
|
806
|
+
};
|
|
807
|
+
useEffect2(() => {
|
|
808
|
+
var _a2, _b2, _c, _d;
|
|
809
|
+
const obj = {
|
|
810
|
+
line: 1,
|
|
811
|
+
status: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) != null ? _b2 : "",
|
|
812
|
+
type: "internal",
|
|
813
|
+
phone: (_d = (_c = state.callData) == null ? void 0 : _c.phone_number) != null ? _d : "",
|
|
814
|
+
isMute: false,
|
|
815
|
+
isHold: false,
|
|
816
|
+
isMergeCall: false,
|
|
817
|
+
isCallStart: true
|
|
818
|
+
};
|
|
819
|
+
sdkStateManager.setConferenceLine(obj);
|
|
820
|
+
}, []);
|
|
540
821
|
return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
|
|
541
822
|
Dialog,
|
|
542
823
|
{
|
|
@@ -557,214 +838,276 @@ function ConferenceDialog({
|
|
|
557
838
|
},
|
|
558
839
|
children: [
|
|
559
840
|
/* @__PURE__ */ jsxs(Typography, { variant: "body1", children: [
|
|
560
|
-
|
|
561
|
-
"
|
|
841
|
+
(_a = state == null ? void 0 : state.agentId) != null ? _a : "",
|
|
842
|
+
" conference"
|
|
562
843
|
] }),
|
|
563
844
|
/* @__PURE__ */ jsx2(IconButton, { onClick: handleClose, children: /* @__PURE__ */ jsx2(Close, {}) })
|
|
564
845
|
]
|
|
565
846
|
}
|
|
566
847
|
),
|
|
567
|
-
/* @__PURE__ */ jsx2(
|
|
568
|
-
Stack,
|
|
569
|
-
{
|
|
570
|
-
direction: "row",
|
|
571
|
-
alignItems: "center",
|
|
572
|
-
justifyContent: "flex-end",
|
|
573
|
-
mr: 2,
|
|
574
|
-
children: /* @__PURE__ */ jsxs(
|
|
575
|
-
Stack,
|
|
576
|
-
{
|
|
577
|
-
display: "flex",
|
|
578
|
-
direction: "row",
|
|
579
|
-
alignItems: "center",
|
|
580
|
-
justifyContent: "center",
|
|
581
|
-
spacing: 1,
|
|
582
|
-
children: [
|
|
583
|
-
/* @__PURE__ */ jsxs(
|
|
584
|
-
Button,
|
|
585
|
-
{
|
|
586
|
-
variant: "contained",
|
|
587
|
-
color: "success",
|
|
588
|
-
onClick: onConference,
|
|
589
|
-
sx: {
|
|
590
|
-
borderRadius: "10px",
|
|
591
|
-
textTransform: "capitalize"
|
|
592
|
-
},
|
|
593
|
-
children: [
|
|
594
|
-
/* @__PURE__ */ jsx2(Group, { sx: { px: 0.5 } }),
|
|
595
|
-
"Conference"
|
|
596
|
-
]
|
|
597
|
-
}
|
|
598
|
-
),
|
|
599
|
-
/* @__PURE__ */ jsxs(
|
|
600
|
-
Button,
|
|
601
|
-
{
|
|
602
|
-
variant: "contained",
|
|
603
|
-
color: "error",
|
|
604
|
-
onClick: onExit,
|
|
605
|
-
sx: {
|
|
606
|
-
borderRadius: "10px",
|
|
607
|
-
textTransform: "capitalize"
|
|
608
|
-
},
|
|
609
|
-
children: [
|
|
610
|
-
/* @__PURE__ */ jsx2(Logout, { sx: { px: 0.5 } }),
|
|
611
|
-
"Exit Conference"
|
|
612
|
-
]
|
|
613
|
-
}
|
|
614
|
-
)
|
|
615
|
-
]
|
|
616
|
-
}
|
|
617
|
-
)
|
|
618
|
-
}
|
|
619
|
-
),
|
|
620
848
|
/* @__PURE__ */ jsx2(
|
|
621
849
|
Box,
|
|
622
850
|
{
|
|
623
851
|
sx: {
|
|
624
852
|
boxShadow: "0px 1px 2px #e7e5e5ff",
|
|
625
|
-
padding: "6px",
|
|
853
|
+
padding: "2px 6px",
|
|
626
854
|
margin: "0px 10px",
|
|
627
855
|
borderRadius: "20px"
|
|
628
856
|
},
|
|
629
|
-
children:
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
p: 1,
|
|
634
|
-
display: "flex",
|
|
635
|
-
alignItems: "center",
|
|
636
|
-
justifyContent: "space-between",
|
|
637
|
-
gap: 1
|
|
638
|
-
},
|
|
639
|
-
children: [
|
|
640
|
-
/* @__PURE__ */ jsx2(
|
|
641
|
-
Box,
|
|
642
|
-
{
|
|
643
|
-
sx: {
|
|
644
|
-
color: "white",
|
|
645
|
-
bgcolor: "warning.main",
|
|
646
|
-
fontWeight: "bold",
|
|
647
|
-
fontSize: 14,
|
|
648
|
-
minWidth: 70,
|
|
649
|
-
textAlign: "center",
|
|
650
|
-
border: "2px solid primary.main",
|
|
651
|
-
borderRadius: "10px 50px 50px 10px"
|
|
652
|
-
},
|
|
653
|
-
children: /* @__PURE__ */ jsxs(Typography, { children: [
|
|
654
|
-
"Line ",
|
|
655
|
-
index + 1
|
|
656
|
-
] })
|
|
657
|
-
}
|
|
658
|
-
),
|
|
659
|
-
/* @__PURE__ */ jsx2(
|
|
660
|
-
Typography,
|
|
661
|
-
{
|
|
662
|
-
variant: "body2",
|
|
663
|
-
sx: {
|
|
664
|
-
px: 1,
|
|
665
|
-
border: "2px solid gray",
|
|
666
|
-
borderRadius: "10px",
|
|
667
|
-
textAlign: "center",
|
|
668
|
-
width: "80px",
|
|
669
|
-
maxWidth: "100px"
|
|
670
|
-
},
|
|
671
|
-
children: line.status
|
|
672
|
-
}
|
|
673
|
-
),
|
|
674
|
-
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", children: [
|
|
675
|
-
/* @__PURE__ */ jsx2(Radio, { checked: line.type === "Internal" }),
|
|
676
|
-
/* @__PURE__ */ jsx2(Typography, { variant: "body2", children: "Internal" })
|
|
677
|
-
] }),
|
|
678
|
-
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", children: [
|
|
679
|
-
/* @__PURE__ */ jsx2(Radio, { checked: line.type === "External" }),
|
|
680
|
-
/* @__PURE__ */ jsx2(Typography, { variant: "body2", children: "External" })
|
|
681
|
-
] }),
|
|
682
|
-
/* @__PURE__ */ jsx2(
|
|
683
|
-
TextField,
|
|
684
|
-
{
|
|
685
|
-
size: "small",
|
|
686
|
-
placeholder: "Phone Number",
|
|
687
|
-
value: line.phone || ""
|
|
688
|
-
}
|
|
689
|
-
),
|
|
690
|
-
/* @__PURE__ */ jsx2(
|
|
691
|
-
IconButton,
|
|
692
|
-
{
|
|
693
|
-
color: "success",
|
|
694
|
-
sx: {
|
|
695
|
-
bgcolor: "action.hover",
|
|
696
|
-
"&:hover": { bgcolor: "action.selected" }
|
|
697
|
-
},
|
|
698
|
-
children: /* @__PURE__ */ jsx2(Call, {})
|
|
699
|
-
}
|
|
700
|
-
),
|
|
701
|
-
/* @__PURE__ */ jsx2(
|
|
702
|
-
IconButton,
|
|
703
|
-
{
|
|
704
|
-
color: "info",
|
|
705
|
-
sx: {
|
|
706
|
-
bgcolor: "action.hover",
|
|
707
|
-
"&:hover": { bgcolor: "action.selected" }
|
|
708
|
-
},
|
|
709
|
-
children: /* @__PURE__ */ jsx2(CallSplit, {})
|
|
710
|
-
}
|
|
711
|
-
),
|
|
712
|
-
/* @__PURE__ */ jsx2(
|
|
713
|
-
IconButton,
|
|
714
|
-
{
|
|
715
|
-
color: "warning",
|
|
716
|
-
sx: {
|
|
717
|
-
bgcolor: "action.hover",
|
|
718
|
-
"&:hover": { bgcolor: "action.selected" }
|
|
719
|
-
},
|
|
720
|
-
children: /* @__PURE__ */ jsx2(PauseCircle, {})
|
|
721
|
-
}
|
|
722
|
-
),
|
|
723
|
-
/* @__PURE__ */ jsx2(
|
|
724
|
-
IconButton,
|
|
725
|
-
{
|
|
726
|
-
color: "error",
|
|
727
|
-
sx: {
|
|
728
|
-
bgcolor: "action.hover",
|
|
729
|
-
"&:hover": { bgcolor: "action.selected" }
|
|
730
|
-
},
|
|
731
|
-
children: /* @__PURE__ */ jsx2(CallEnd, {})
|
|
732
|
-
}
|
|
733
|
-
)
|
|
734
|
-
]
|
|
735
|
-
},
|
|
736
|
-
index
|
|
737
|
-
))
|
|
738
|
-
}
|
|
739
|
-
),
|
|
740
|
-
/* @__PURE__ */ jsx2(Box, { textAlign: "center", m: 2, children: /* @__PURE__ */ jsxs(
|
|
741
|
-
Button,
|
|
742
|
-
{
|
|
743
|
-
variant: "outlined",
|
|
744
|
-
color: "error",
|
|
745
|
-
size: "large",
|
|
746
|
-
onClick: onEndAllCalls,
|
|
747
|
-
sx: { px: 2, borderRadius: "20px", textTransform: "capitalize" },
|
|
748
|
-
children: [
|
|
749
|
-
/* @__PURE__ */ jsx2(
|
|
750
|
-
IconButton,
|
|
857
|
+
children: (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.map((each, index) => {
|
|
858
|
+
var _a2, _b2;
|
|
859
|
+
return /* @__PURE__ */ jsxs(
|
|
860
|
+
Box,
|
|
751
861
|
{
|
|
752
862
|
sx: {
|
|
753
|
-
|
|
754
|
-
"&:hover": { bgcolor: "error.dark" },
|
|
755
|
-
marginRight: "8px",
|
|
756
|
-
width: "28px",
|
|
757
|
-
height: "28px",
|
|
758
|
-
fontSize: "12px",
|
|
759
|
-
fontWeight: "600",
|
|
760
|
-
lineHeight: "16px",
|
|
761
|
-
letterSpacing: "0.02em",
|
|
762
|
-
textTransform: "capitalize",
|
|
763
|
-
color: "white",
|
|
863
|
+
p: 1,
|
|
764
864
|
display: "flex",
|
|
765
865
|
alignItems: "center",
|
|
766
|
-
justifyContent: "
|
|
767
|
-
|
|
866
|
+
justifyContent: "space-between",
|
|
867
|
+
gap: 1
|
|
868
|
+
},
|
|
869
|
+
children: [
|
|
870
|
+
/* @__PURE__ */ jsx2(
|
|
871
|
+
Box,
|
|
872
|
+
{
|
|
873
|
+
sx: {
|
|
874
|
+
color: "white",
|
|
875
|
+
bgcolor: "warning.main",
|
|
876
|
+
fontWeight: "bold",
|
|
877
|
+
fontSize: 14,
|
|
878
|
+
minWidth: 70,
|
|
879
|
+
textAlign: "center",
|
|
880
|
+
border: "2px solid primary.main",
|
|
881
|
+
borderRadius: "10px 50px 50px 10px"
|
|
882
|
+
},
|
|
883
|
+
children: /* @__PURE__ */ jsx2(Typography, { children: (_a2 = each == null ? void 0 : each.line) != null ? _a2 : "" })
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ jsx2(
|
|
887
|
+
Typography,
|
|
888
|
+
{
|
|
889
|
+
variant: "body2",
|
|
890
|
+
sx: {
|
|
891
|
+
px: 1,
|
|
892
|
+
border: "2px solid gray",
|
|
893
|
+
borderRadius: "10px",
|
|
894
|
+
textAlign: "center",
|
|
895
|
+
width: "80px",
|
|
896
|
+
maxWidth: "100px"
|
|
897
|
+
},
|
|
898
|
+
children: (_b2 = each == null ? void 0 : each.status) != null ? _b2 : ""
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
/* @__PURE__ */ jsx2(
|
|
902
|
+
Button,
|
|
903
|
+
{
|
|
904
|
+
sx: {
|
|
905
|
+
textTransform: "capitalize"
|
|
906
|
+
},
|
|
907
|
+
size: "small",
|
|
908
|
+
children: /* @__PURE__ */ jsx2(Typography, { variant: "body2", children: (each == null ? void 0 : each.line) === 1 ? "Internal" : "External" })
|
|
909
|
+
}
|
|
910
|
+
),
|
|
911
|
+
/* @__PURE__ */ jsx2(
|
|
912
|
+
TextField,
|
|
913
|
+
{
|
|
914
|
+
size: "small",
|
|
915
|
+
placeholder: "Phone Number",
|
|
916
|
+
value: (each == null ? void 0 : each.phone) || "",
|
|
917
|
+
disabled: (each == null ? void 0 : each.line) === 1,
|
|
918
|
+
onChange: (e) => {
|
|
919
|
+
onConferenceLineUpdate(each, { phone: e.target.value });
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
),
|
|
923
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Call", children: /* @__PURE__ */ jsx2(
|
|
924
|
+
Button,
|
|
925
|
+
{
|
|
926
|
+
variant: (each == null ? void 0 : each.isCallStart) ? "outlined" : "contained",
|
|
927
|
+
color: "success",
|
|
928
|
+
sx: (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
|
|
929
|
+
border: `0px solid ${theme.palette.success.light}`,
|
|
930
|
+
"&:hover": {
|
|
931
|
+
bgcolor: "error.light",
|
|
932
|
+
boxShadow: `0px 2px 1px ${theme.palette.success.light}`,
|
|
933
|
+
border: `0px solid ${theme.palette.success.light}`
|
|
934
|
+
},
|
|
935
|
+
"&:active": {
|
|
936
|
+
bgcolor: "error.light",
|
|
937
|
+
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
938
|
+
}
|
|
939
|
+
}),
|
|
940
|
+
onClick: () => {
|
|
941
|
+
onConferenceCallStart(each, {
|
|
942
|
+
isCallStart: true,
|
|
943
|
+
status: "ONCALL"
|
|
944
|
+
});
|
|
945
|
+
},
|
|
946
|
+
disabled: each == null ? void 0 : each.isCallStart,
|
|
947
|
+
children: /* @__PURE__ */ jsx2(
|
|
948
|
+
Call,
|
|
949
|
+
{
|
|
950
|
+
sx: { color: (each == null ? void 0 : each.isCallStart) ? "defalult" : "#fff" }
|
|
951
|
+
}
|
|
952
|
+
)
|
|
953
|
+
}
|
|
954
|
+
) }),
|
|
955
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Merge Call", children: /* @__PURE__ */ jsx2(
|
|
956
|
+
Button,
|
|
957
|
+
{
|
|
958
|
+
variant: (each == null ? void 0 : each.isMergeCall) ? "contained" : "outlined",
|
|
959
|
+
sx: (each == null ? void 0 : each.isMergeCall) && (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
960
|
+
onClick: () => {
|
|
961
|
+
onMergeConferenceCall(each, {
|
|
962
|
+
isMergeCall: true,
|
|
963
|
+
status: "ONCALL"
|
|
964
|
+
});
|
|
965
|
+
},
|
|
966
|
+
disabled: !(each == null ? void 0 : each.isCallStart),
|
|
967
|
+
children: /* @__PURE__ */ jsx2(CallSplit, {})
|
|
968
|
+
}
|
|
969
|
+
) }),
|
|
970
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: each.isHold ? "Hold" : "Un Hold", children: /* @__PURE__ */ jsx2(
|
|
971
|
+
Button,
|
|
972
|
+
{
|
|
973
|
+
variant: (each == null ? void 0 : each.isHold) ? "contained" : "outlined",
|
|
974
|
+
sx: (each == null ? void 0 : each.isHold) && (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
975
|
+
onClick: () => {
|
|
976
|
+
if (each.isHold) {
|
|
977
|
+
onHoldOrUnHoldConferenceCall(
|
|
978
|
+
each,
|
|
979
|
+
{ isHold: false },
|
|
980
|
+
"UNHOLDUSER"
|
|
981
|
+
);
|
|
982
|
+
} else {
|
|
983
|
+
onHoldOrUnHoldConferenceCall(
|
|
984
|
+
each,
|
|
985
|
+
{ isHold: true },
|
|
986
|
+
"HOLDUSER"
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
disabled: !(each == null ? void 0 : each.isCallStart),
|
|
991
|
+
children: each.isHold ? /* @__PURE__ */ jsx2(PlayArrow, {}) : /* @__PURE__ */ jsx2(Pause, {})
|
|
992
|
+
}
|
|
993
|
+
) }),
|
|
994
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: each.isMute ? "Mute" : "Un Mute", children: /* @__PURE__ */ jsx2(
|
|
995
|
+
Button,
|
|
996
|
+
{
|
|
997
|
+
variant: (each == null ? void 0 : each.isMute) ? "contained" : "outlined",
|
|
998
|
+
sx: (each == null ? void 0 : each.isMute) && (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, disabled) : (each == null ? void 0 : each.isCallStart) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
999
|
+
onClick: () => {
|
|
1000
|
+
if (each.isMute) {
|
|
1001
|
+
onMuteOrUnMuteConferenceCall(
|
|
1002
|
+
each,
|
|
1003
|
+
{ isMute: false },
|
|
1004
|
+
"PLAYUSER"
|
|
1005
|
+
);
|
|
1006
|
+
} else {
|
|
1007
|
+
onMuteOrUnMuteConferenceCall(
|
|
1008
|
+
each,
|
|
1009
|
+
{ isMute: true },
|
|
1010
|
+
"MUTEUSER"
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
},
|
|
1014
|
+
disabled: !(each == null ? void 0 : each.isCallStart),
|
|
1015
|
+
children: each.isMute ? /* @__PURE__ */ jsx2(MicOff, {}) : /* @__PURE__ */ jsx2(Mic, {})
|
|
1016
|
+
}
|
|
1017
|
+
) }),
|
|
1018
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "End Call", children: (each == null ? void 0 : each.line) !== 1 ? /* @__PURE__ */ jsx2(
|
|
1019
|
+
Button,
|
|
1020
|
+
{
|
|
1021
|
+
variant: (each == null ? void 0 : each.isCallStart) ? "contained" : "outlined",
|
|
1022
|
+
color: "error",
|
|
1023
|
+
sx: (each == null ? void 0 : each.isCallStart) ? __spreadProps(__spreadValues({}, enabled), {
|
|
1024
|
+
minWidth: "60px !important",
|
|
1025
|
+
border: `0px solid ${theme.palette.error.light}`,
|
|
1026
|
+
"&:hover": {
|
|
1027
|
+
bgcolor: "error.light",
|
|
1028
|
+
boxShadow: `0px 2px 1px ${theme.palette.error.light}`,
|
|
1029
|
+
border: `0px solid ${theme.palette.error.light}`
|
|
1030
|
+
},
|
|
1031
|
+
"&:active": {
|
|
1032
|
+
bgcolor: "error.light",
|
|
1033
|
+
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
1034
|
+
}
|
|
1035
|
+
}) : __spreadProps(__spreadValues({}, disabled), { minWidth: "60px !important" }),
|
|
1036
|
+
onClick: () => {
|
|
1037
|
+
onEndConferenceCall(each, {
|
|
1038
|
+
isCallStart: false,
|
|
1039
|
+
isMergeCall: false,
|
|
1040
|
+
isMute: false,
|
|
1041
|
+
isHold: false,
|
|
1042
|
+
status: "IDLE"
|
|
1043
|
+
});
|
|
1044
|
+
},
|
|
1045
|
+
disabled: !(each == null ? void 0 : each.isCallStart),
|
|
1046
|
+
children: /* @__PURE__ */ jsx2(CallEnd, {})
|
|
1047
|
+
}
|
|
1048
|
+
) : /* @__PURE__ */ jsx2(
|
|
1049
|
+
Button,
|
|
1050
|
+
{
|
|
1051
|
+
variant: (each == null ? void 0 : each.isCallStart) ? "contained" : "outlined",
|
|
1052
|
+
sx: __spreadProps(__spreadValues({}, disabled), {
|
|
1053
|
+
visibility: "hidden",
|
|
1054
|
+
minWidth: "60px !important"
|
|
1055
|
+
}),
|
|
1056
|
+
onClick: () => {
|
|
1057
|
+
onEndConferenceCall(each, {
|
|
1058
|
+
isCallStart: false,
|
|
1059
|
+
isMergeCall: false,
|
|
1060
|
+
isMute: false,
|
|
1061
|
+
isHold: false,
|
|
1062
|
+
status: "IDLE"
|
|
1063
|
+
});
|
|
1064
|
+
},
|
|
1065
|
+
disabled: !(each == null ? void 0 : each.isCallStart),
|
|
1066
|
+
children: /* @__PURE__ */ jsx2(Typography, { children: /* @__PURE__ */ jsx2(
|
|
1067
|
+
CallEnd,
|
|
1068
|
+
{
|
|
1069
|
+
sx: {
|
|
1070
|
+
visibility: "hidden"
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
) })
|
|
1074
|
+
}
|
|
1075
|
+
) })
|
|
1076
|
+
]
|
|
1077
|
+
},
|
|
1078
|
+
index
|
|
1079
|
+
);
|
|
1080
|
+
})
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
/* @__PURE__ */ jsx2(Box, { textAlign: "center", m: 2, children: /* @__PURE__ */ jsxs(
|
|
1084
|
+
Button,
|
|
1085
|
+
{
|
|
1086
|
+
variant: "outlined",
|
|
1087
|
+
color: "error",
|
|
1088
|
+
size: "large",
|
|
1089
|
+
onClick: onEndAllConferenceCalls,
|
|
1090
|
+
sx: { px: 2, borderRadius: "20px", textTransform: "capitalize" },
|
|
1091
|
+
children: [
|
|
1092
|
+
/* @__PURE__ */ jsx2(
|
|
1093
|
+
IconButton,
|
|
1094
|
+
{
|
|
1095
|
+
sx: {
|
|
1096
|
+
bgcolor: "error.main",
|
|
1097
|
+
"&:hover": { bgcolor: "error.dark" },
|
|
1098
|
+
marginRight: "8px",
|
|
1099
|
+
width: "28px",
|
|
1100
|
+
height: "28px",
|
|
1101
|
+
fontSize: "12px",
|
|
1102
|
+
fontWeight: "600",
|
|
1103
|
+
lineHeight: "16px",
|
|
1104
|
+
letterSpacing: "0.02em",
|
|
1105
|
+
textTransform: "capitalize",
|
|
1106
|
+
color: "white",
|
|
1107
|
+
display: "flex",
|
|
1108
|
+
alignItems: "center",
|
|
1109
|
+
justifyContent: "center",
|
|
1110
|
+
borderRadius: "50%"
|
|
768
1111
|
},
|
|
769
1112
|
children: /* @__PURE__ */ jsx2(
|
|
770
1113
|
PhoneDisabled,
|
|
@@ -778,7 +1121,7 @@ function ConferenceDialog({
|
|
|
778
1121
|
)
|
|
779
1122
|
}
|
|
780
1123
|
),
|
|
781
|
-
"End
|
|
1124
|
+
"End Conference"
|
|
782
1125
|
]
|
|
783
1126
|
}
|
|
784
1127
|
) })
|
|
@@ -787,42 +1130,79 @@ function ConferenceDialog({
|
|
|
787
1130
|
) });
|
|
788
1131
|
}
|
|
789
1132
|
function CallTransferDialog({ open, setOpen }) {
|
|
790
|
-
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1133
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1134
|
+
const [transferCall] = usePostRequest({
|
|
1135
|
+
onSuccess: (res) => {
|
|
1136
|
+
console.log("res", res);
|
|
1137
|
+
setOpen(false);
|
|
1138
|
+
},
|
|
1139
|
+
onError: (error) => {
|
|
1140
|
+
console.log("error", error);
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
const state = useSDKState();
|
|
1144
|
+
const [currentselecteTab, setCurrentselecteTab] = useState4("process");
|
|
1145
|
+
const [getIdelAgentsList, { data: idleAgentsList }] = usePostRequest();
|
|
1146
|
+
const [getProcessAndQueuesList, { data: processAndQueuesList }] = usePostRequest();
|
|
797
1147
|
const handleClose = () => {
|
|
798
1148
|
setOpen(false);
|
|
799
1149
|
};
|
|
800
|
-
const handleTransferCall = () => {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1150
|
+
const handleTransferCall = (data, type) => {
|
|
1151
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
|
|
1152
|
+
console.log(data, "data34");
|
|
1153
|
+
if (type === "PROCESS") {
|
|
1154
|
+
const payload = {
|
|
1155
|
+
mobile_number: (_b2 = (_a2 = state.callData) == null ? void 0 : _a2.phone_number) != null ? _b2 : "",
|
|
1156
|
+
userid: (_d2 = (_c2 = state.callData) == null ? void 0 : _c2.agent_id) != null ? _d2 : "",
|
|
1157
|
+
type: "PROCESS",
|
|
1158
|
+
transfer_to: (_e2 = data == null ? void 0 : data.process_name) != null ? _e2 : "",
|
|
1159
|
+
callreferenceid: (_g2 = (_f2 = state.callData) == null ? void 0 : _f2.convox_id) != null ? _g2 : "",
|
|
1160
|
+
processid: String((_i = (_h2 = state.callData) == null ? void 0 : _h2.process_id) != null ? _i : ""),
|
|
1161
|
+
process_name: (_k = (_j = state.callData) == null ? void 0 : _j.process_name) != null ? _k : ""
|
|
1162
|
+
};
|
|
1163
|
+
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
1164
|
+
} else if (type === "QUEUE") {
|
|
1165
|
+
const payload = {
|
|
1166
|
+
mobile_number: (_m = (_l = state.callData) == null ? void 0 : _l.phone_number) != null ? _m : "",
|
|
1167
|
+
userid: (_o = (_n = state.callData) == null ? void 0 : _n.agent_id) != null ? _o : "",
|
|
1168
|
+
type: "QUEUE",
|
|
1169
|
+
transfer_to: (_p = data == null ? void 0 : data.queue_name) != null ? _p : "",
|
|
1170
|
+
callreferenceid: (_r = (_q = state.callData) == null ? void 0 : _q.convox_id) != null ? _r : "",
|
|
1171
|
+
processid: String((_t = (_s = state.callData) == null ? void 0 : _s.process_id) != null ? _t : ""),
|
|
1172
|
+
process_name: (_v = (_u = state.callData) == null ? void 0 : _u.process_name) != null ? _v : ""
|
|
1173
|
+
};
|
|
1174
|
+
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
1175
|
+
} else if (type === "AGENT") {
|
|
1176
|
+
const payload = {
|
|
1177
|
+
mobile_number: (_x = (_w = state.callData) == null ? void 0 : _w.phone_number) != null ? _x : "",
|
|
1178
|
+
userid: (_z = (_y = state.callData) == null ? void 0 : _y.agent_id) != null ? _z : "",
|
|
1179
|
+
type: "AGENT",
|
|
1180
|
+
transfer_to: (_A = data == null ? void 0 : data.user_id) != null ? _A : "",
|
|
1181
|
+
callreferenceid: (_C = (_B = state.callData) == null ? void 0 : _B.convox_id) != null ? _C : "",
|
|
1182
|
+
processid: String((_E = (_D = state.callData) == null ? void 0 : _D.process_id) != null ? _E : ""),
|
|
1183
|
+
process_name: (_G = (_F = state.callData) == null ? void 0 : _F.process_name) != null ? _G : ""
|
|
1184
|
+
};
|
|
1185
|
+
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
1186
|
+
}
|
|
818
1187
|
};
|
|
1188
|
+
useEffect2(() => {
|
|
1189
|
+
getIdelAgentsList(END_POINT.AGENTS_LIST, {
|
|
1190
|
+
status: "IDLE",
|
|
1191
|
+
active: true
|
|
1192
|
+
});
|
|
1193
|
+
getProcessAndQueuesList(END_POINT.TRANSFER_TO_DETAILS, {
|
|
1194
|
+
status: "ACTIVE",
|
|
1195
|
+
active: true
|
|
1196
|
+
});
|
|
1197
|
+
}, []);
|
|
819
1198
|
return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
|
|
820
1199
|
Dialog,
|
|
821
1200
|
{
|
|
822
1201
|
open,
|
|
823
1202
|
"aria-labelledby": "alert-dialog-title",
|
|
824
1203
|
"aria-describedby": "alert-dialog-description",
|
|
825
|
-
|
|
1204
|
+
fullWidth: true,
|
|
1205
|
+
maxWidth: "md",
|
|
826
1206
|
children: /* @__PURE__ */ jsxs(Paper, { sx: { borderRadius: 2 }, children: [
|
|
827
1207
|
/* @__PURE__ */ jsxs(
|
|
828
1208
|
Box,
|
|
@@ -840,7 +1220,7 @@ function CallTransferDialog({ open, setOpen }) {
|
|
|
840
1220
|
]
|
|
841
1221
|
}
|
|
842
1222
|
),
|
|
843
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsxs(
|
|
844
1224
|
Box,
|
|
845
1225
|
{
|
|
846
1226
|
sx: {
|
|
@@ -849,55 +1229,254 @@ function CallTransferDialog({ open, setOpen }) {
|
|
|
849
1229
|
margin: "10px",
|
|
850
1230
|
borderRadius: "10px"
|
|
851
1231
|
},
|
|
852
|
-
children:
|
|
853
|
-
Box,
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1232
|
+
children: [
|
|
1233
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [
|
|
1234
|
+
/* @__PURE__ */ jsx2(
|
|
1235
|
+
Button,
|
|
1236
|
+
{
|
|
1237
|
+
variant: currentselecteTab === "process" ? "contained" : "outlined",
|
|
1238
|
+
onClick: () => setCurrentselecteTab("process"),
|
|
1239
|
+
children: "Process"
|
|
1240
|
+
}
|
|
1241
|
+
),
|
|
1242
|
+
/* @__PURE__ */ jsx2(
|
|
1243
|
+
Button,
|
|
1244
|
+
{
|
|
1245
|
+
variant: currentselecteTab === "queues" ? "contained" : "outlined",
|
|
1246
|
+
onClick: () => setCurrentselecteTab("queues"),
|
|
1247
|
+
children: "Queues"
|
|
1248
|
+
}
|
|
1249
|
+
),
|
|
1250
|
+
/* @__PURE__ */ jsx2(
|
|
1251
|
+
Button,
|
|
1252
|
+
{
|
|
1253
|
+
variant: currentselecteTab === "agents" ? "contained" : "outlined",
|
|
1254
|
+
onClick: () => setCurrentselecteTab("agents"),
|
|
1255
|
+
children: "Agents"
|
|
1256
|
+
}
|
|
1257
|
+
)
|
|
1258
|
+
] }),
|
|
1259
|
+
currentselecteTab === "process" && /* @__PURE__ */ jsx2(Box, { sx: { display: "flex", gap: 1 }, children: ((_b = (_a = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a.process) == null ? void 0 : _b.length) > 0 ? (_d = (_c = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _c.process) == null ? void 0 : _d.map(
|
|
1260
|
+
(process, index) => /* @__PURE__ */ jsxs(
|
|
1261
|
+
Box,
|
|
1262
|
+
{
|
|
1263
|
+
sx: {
|
|
1264
|
+
p: 1,
|
|
1265
|
+
display: "flex",
|
|
1266
|
+
alignItems: "center",
|
|
1267
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
1268
|
+
padding: "6px",
|
|
1269
|
+
margin: "10px 0px",
|
|
1270
|
+
borderRadius: "10px",
|
|
1271
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
1272
|
+
},
|
|
1273
|
+
children: [
|
|
1274
|
+
/* @__PURE__ */ jsxs(
|
|
1275
|
+
Typography,
|
|
1276
|
+
{
|
|
1277
|
+
variant: "body1",
|
|
1278
|
+
sx: {
|
|
1279
|
+
mx: 1,
|
|
1280
|
+
width: "200px",
|
|
1281
|
+
maxWidth: "250px",
|
|
1282
|
+
display: "flex",
|
|
1283
|
+
alignItems: "center"
|
|
1284
|
+
},
|
|
1285
|
+
children: [
|
|
1286
|
+
/* @__PURE__ */ jsx2(SupportAgent, { sx: { marginRight: "4px" } }),
|
|
1287
|
+
process.process_name
|
|
1288
|
+
]
|
|
1289
|
+
}
|
|
1290
|
+
),
|
|
1291
|
+
/* @__PURE__ */ jsx2(
|
|
1292
|
+
IconButton,
|
|
1293
|
+
{
|
|
1294
|
+
color: "success",
|
|
1295
|
+
sx: {
|
|
1296
|
+
bgcolor: "action.hover",
|
|
1297
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
1298
|
+
},
|
|
1299
|
+
onClick: () => {
|
|
1300
|
+
handleTransferCall(process, "PROCESS");
|
|
1301
|
+
},
|
|
1302
|
+
children: /* @__PURE__ */ jsx2(Call, {})
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
]
|
|
1306
|
+
},
|
|
1307
|
+
index
|
|
1308
|
+
)
|
|
1309
|
+
) : /* @__PURE__ */ jsx2(
|
|
1310
|
+
Typography,
|
|
1311
|
+
{
|
|
1312
|
+
variant: "body1",
|
|
1313
|
+
sx: {
|
|
1314
|
+
fontSize: "12px",
|
|
1315
|
+
fontWeight: "600",
|
|
1316
|
+
letterSpacing: "0.02em",
|
|
1317
|
+
textTransform: "capitalize",
|
|
1318
|
+
textAlign: "center",
|
|
1319
|
+
width: "100%",
|
|
1320
|
+
margin: "10px 0px",
|
|
1321
|
+
color: "gray"
|
|
1322
|
+
},
|
|
1323
|
+
children: "No Process Found"
|
|
1324
|
+
}
|
|
1325
|
+
) }),
|
|
1326
|
+
currentselecteTab === "queues" && /* @__PURE__ */ jsx2(Box, { sx: { display: "flex", gap: 1 }, children: ((_f = (_e = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _e.queue) == null ? void 0 : _f.length) > 0 ? (_h = (_g = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _g.queue) == null ? void 0 : _h.map(
|
|
1327
|
+
(queue, index) => {
|
|
1328
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
1329
|
+
return /* @__PURE__ */ jsxs(
|
|
1330
|
+
Box,
|
|
868
1331
|
{
|
|
869
|
-
variant: "body1",
|
|
870
1332
|
sx: {
|
|
871
|
-
|
|
872
|
-
width: "200px",
|
|
873
|
-
maxWidth: "250px",
|
|
1333
|
+
p: 1,
|
|
874
1334
|
display: "flex",
|
|
875
|
-
alignItems: "center"
|
|
1335
|
+
alignItems: "center",
|
|
1336
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
1337
|
+
padding: "6px",
|
|
1338
|
+
margin: "10px 0px",
|
|
1339
|
+
borderRadius: "10px",
|
|
1340
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
876
1341
|
},
|
|
877
1342
|
children: [
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
|
|
1343
|
+
/* @__PURE__ */ jsxs(
|
|
1344
|
+
Typography,
|
|
1345
|
+
{
|
|
1346
|
+
variant: "body1",
|
|
1347
|
+
sx: {
|
|
1348
|
+
mx: 1,
|
|
1349
|
+
width: "200px",
|
|
1350
|
+
maxWidth: "250px",
|
|
1351
|
+
display: "flex",
|
|
1352
|
+
alignItems: "center"
|
|
1353
|
+
},
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ jsx2(SupportAgent, { sx: { marginRight: "4px" } }),
|
|
1356
|
+
queue.queue_name,
|
|
1357
|
+
((_c2 = (_b2 = (_a2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _a2.process) == null ? void 0 : _b2.find(
|
|
1358
|
+
(process) => process.process_id === queue.process_id
|
|
1359
|
+
)) == null ? void 0 : _c2.process_name) ? /* @__PURE__ */ jsx2(
|
|
1360
|
+
Typography,
|
|
1361
|
+
{
|
|
1362
|
+
variant: "body1",
|
|
1363
|
+
sx: {
|
|
1364
|
+
fontSize: "12px",
|
|
1365
|
+
fontWeight: "600",
|
|
1366
|
+
letterSpacing: "0.02em",
|
|
1367
|
+
textTransform: "capitalize",
|
|
1368
|
+
color: "gray"
|
|
1369
|
+
},
|
|
1370
|
+
children: "(" + ((_f2 = (_e2 = (_d2 = processAndQueuesList == null ? void 0 : processAndQueuesList.data) == null ? void 0 : _d2.process) == null ? void 0 : _e2.find(
|
|
1371
|
+
(process) => process.process_id === queue.process_id
|
|
1372
|
+
)) == null ? void 0 : _f2.process_name) + ")"
|
|
1373
|
+
}
|
|
1374
|
+
) : ""
|
|
1375
|
+
]
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
/* @__PURE__ */ jsx2(
|
|
1379
|
+
IconButton,
|
|
1380
|
+
{
|
|
1381
|
+
color: "success",
|
|
1382
|
+
sx: {
|
|
1383
|
+
bgcolor: "action.hover",
|
|
1384
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
1385
|
+
},
|
|
1386
|
+
onClick: () => {
|
|
1387
|
+
handleTransferCall(queue, "QUEUE");
|
|
1388
|
+
},
|
|
1389
|
+
children: /* @__PURE__ */ jsx2(Call, {})
|
|
1390
|
+
}
|
|
1391
|
+
)
|
|
880
1392
|
]
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
1393
|
+
},
|
|
1394
|
+
index
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1397
|
+
) : /* @__PURE__ */ jsx2(
|
|
1398
|
+
Typography,
|
|
1399
|
+
{
|
|
1400
|
+
variant: "body1",
|
|
1401
|
+
sx: {
|
|
1402
|
+
fontSize: "12px",
|
|
1403
|
+
fontWeight: "600",
|
|
1404
|
+
letterSpacing: "0.02em",
|
|
1405
|
+
textTransform: "capitalize",
|
|
1406
|
+
textAlign: "center",
|
|
1407
|
+
width: "100%",
|
|
1408
|
+
margin: "10px 0px",
|
|
1409
|
+
color: "gray"
|
|
1410
|
+
},
|
|
1411
|
+
children: "No Queues Found"
|
|
1412
|
+
}
|
|
1413
|
+
) }),
|
|
1414
|
+
currentselecteTab === "agents" && /* @__PURE__ */ jsx2(Box, { sx: { display: "flex", gap: 1 }, children: (idleAgentsList == null ? void 0 : idleAgentsList.length) > 0 ? idleAgentsList.map((agent, index) => /* @__PURE__ */ jsxs(
|
|
1415
|
+
Box,
|
|
1416
|
+
{
|
|
1417
|
+
sx: {
|
|
1418
|
+
p: 1,
|
|
1419
|
+
display: "flex",
|
|
1420
|
+
alignItems: "center",
|
|
1421
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
1422
|
+
padding: "6px",
|
|
1423
|
+
margin: "10px 0px",
|
|
1424
|
+
borderRadius: "10px",
|
|
1425
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
1426
|
+
},
|
|
1427
|
+
children: [
|
|
1428
|
+
/* @__PURE__ */ jsxs(
|
|
1429
|
+
Typography,
|
|
1430
|
+
{
|
|
1431
|
+
variant: "body1",
|
|
1432
|
+
sx: {
|
|
1433
|
+
mx: 1,
|
|
1434
|
+
width: "200px",
|
|
1435
|
+
maxWidth: "250px",
|
|
1436
|
+
display: "flex",
|
|
1437
|
+
alignItems: "center"
|
|
1438
|
+
},
|
|
1439
|
+
children: [
|
|
1440
|
+
/* @__PURE__ */ jsx2(SupportAgent, { sx: { marginRight: "4px" } }),
|
|
1441
|
+
agent.name
|
|
1442
|
+
]
|
|
1443
|
+
}
|
|
1444
|
+
),
|
|
1445
|
+
/* @__PURE__ */ jsx2(
|
|
1446
|
+
IconButton,
|
|
1447
|
+
{
|
|
1448
|
+
color: "success",
|
|
1449
|
+
sx: {
|
|
1450
|
+
bgcolor: "action.hover",
|
|
1451
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
1452
|
+
},
|
|
1453
|
+
onClick: () => {
|
|
1454
|
+
handleTransferCall(agent, "AGENT");
|
|
1455
|
+
},
|
|
1456
|
+
children: /* @__PURE__ */ jsx2(Call, {})
|
|
1457
|
+
}
|
|
1458
|
+
)
|
|
1459
|
+
]
|
|
1460
|
+
},
|
|
1461
|
+
index
|
|
1462
|
+
)) : /* @__PURE__ */ jsx2(
|
|
1463
|
+
Typography,
|
|
1464
|
+
{
|
|
1465
|
+
variant: "body1",
|
|
1466
|
+
sx: {
|
|
1467
|
+
fontSize: "12px",
|
|
1468
|
+
fontWeight: "600",
|
|
1469
|
+
letterSpacing: "0.02em",
|
|
1470
|
+
textTransform: "capitalize",
|
|
1471
|
+
textAlign: "center",
|
|
1472
|
+
width: "100%",
|
|
1473
|
+
margin: "10px 0px",
|
|
1474
|
+
color: "gray"
|
|
1475
|
+
},
|
|
1476
|
+
children: "No Agents Found"
|
|
1477
|
+
}
|
|
1478
|
+
) })
|
|
1479
|
+
]
|
|
901
1480
|
}
|
|
902
1481
|
)
|
|
903
1482
|
] })
|
|
@@ -909,27 +1488,29 @@ function EndCallDispositionDialog({
|
|
|
909
1488
|
setOpen,
|
|
910
1489
|
onSubmitDisposition
|
|
911
1490
|
}) {
|
|
1491
|
+
var _a, _b;
|
|
912
1492
|
const [formData, setFormData] = useState4({
|
|
913
|
-
disposition:
|
|
914
|
-
followUp: { label: "
|
|
1493
|
+
disposition: { label: "Resolved", value: "RES" },
|
|
1494
|
+
followUp: { label: "No", value: "N" },
|
|
915
1495
|
callbackDate: "",
|
|
916
1496
|
callbackHrs: "",
|
|
917
1497
|
callbackMins: ""
|
|
918
1498
|
});
|
|
919
1499
|
const dispositionOptions = [
|
|
920
|
-
{ label: "Interested" },
|
|
921
|
-
{ label: "
|
|
922
|
-
|
|
923
|
-
|
|
1500
|
+
{ label: "Not Interested", value: "NI" },
|
|
1501
|
+
{ label: "Resolved", value: "RES" }
|
|
1502
|
+
];
|
|
1503
|
+
const followUpOptions = [
|
|
1504
|
+
{ label: "Yes", value: "Y" },
|
|
1505
|
+
{ label: "No", value: "N" }
|
|
924
1506
|
];
|
|
925
|
-
const followUpOptions = [{ label: "yes" }, { label: "no" }];
|
|
926
1507
|
const handleChange = (field, value) => {
|
|
927
1508
|
setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [field]: value }));
|
|
928
1509
|
};
|
|
929
1510
|
const handleReset = () => {
|
|
930
1511
|
setFormData({
|
|
931
|
-
disposition:
|
|
932
|
-
followUp: { label: "
|
|
1512
|
+
disposition: { label: "Resolved", value: "RES" },
|
|
1513
|
+
followUp: { label: "No", value: "N" },
|
|
933
1514
|
callbackDate: "",
|
|
934
1515
|
callbackHrs: "",
|
|
935
1516
|
callbackMins: ""
|
|
@@ -996,7 +1577,7 @@ function EndCallDispositionDialog({
|
|
|
996
1577
|
renderInput: (params) => /* @__PURE__ */ jsx2(TextField, __spreadProps(__spreadValues({}, params), { label: "Follow Up", fullWidth: true }))
|
|
997
1578
|
}
|
|
998
1579
|
) }),
|
|
999
|
-
formData.followUp.label === "yes" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1580
|
+
((_b = (_a = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a.label) == null ? void 0 : _b.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1000
1581
|
/* @__PURE__ */ jsx2(Grid, { size: 6, children: /* @__PURE__ */ jsx2(
|
|
1001
1582
|
TextField,
|
|
1002
1583
|
{
|
|
@@ -1072,23 +1653,158 @@ function EndCallDispositionDialog({
|
|
|
1072
1653
|
}
|
|
1073
1654
|
) });
|
|
1074
1655
|
}
|
|
1656
|
+
function ProcessorListDialog({
|
|
1657
|
+
open,
|
|
1658
|
+
setOpen,
|
|
1659
|
+
processList = [],
|
|
1660
|
+
handleSelectedProcessor
|
|
1661
|
+
}) {
|
|
1662
|
+
const handleClose = () => {
|
|
1663
|
+
setOpen(false);
|
|
1664
|
+
};
|
|
1665
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
|
|
1666
|
+
Dialog,
|
|
1667
|
+
{
|
|
1668
|
+
open,
|
|
1669
|
+
"aria-labelledby": "alert-dialog-title",
|
|
1670
|
+
"aria-describedby": "alert-dialog-description",
|
|
1671
|
+
maxWidth: "xs",
|
|
1672
|
+
children: /* @__PURE__ */ jsxs(Paper, { sx: { borderRadius: 2 }, children: [
|
|
1673
|
+
/* @__PURE__ */ jsxs(
|
|
1674
|
+
Box,
|
|
1675
|
+
{
|
|
1676
|
+
sx: {
|
|
1677
|
+
display: "flex",
|
|
1678
|
+
justifyContent: "space-between",
|
|
1679
|
+
alignItems: "center",
|
|
1680
|
+
padding: "4px 16px",
|
|
1681
|
+
boxShadow: "0px 1px 2px #f5f5f5ff"
|
|
1682
|
+
},
|
|
1683
|
+
children: [
|
|
1684
|
+
/* @__PURE__ */ jsx2(Typography, { variant: "body1", children: " Process List" }),
|
|
1685
|
+
/* @__PURE__ */ jsx2(IconButton, { onClick: handleClose, children: /* @__PURE__ */ jsx2(Close, {}) })
|
|
1686
|
+
]
|
|
1687
|
+
}
|
|
1688
|
+
),
|
|
1689
|
+
/* @__PURE__ */ jsx2(
|
|
1690
|
+
Box,
|
|
1691
|
+
{
|
|
1692
|
+
sx: {
|
|
1693
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
1694
|
+
padding: "6px 10px",
|
|
1695
|
+
margin: "10px",
|
|
1696
|
+
borderRadius: "10px"
|
|
1697
|
+
},
|
|
1698
|
+
children: (processList == null ? void 0 : processList.length) > 0 ? processList == null ? void 0 : processList.map((process, index) => /* @__PURE__ */ jsx2(
|
|
1699
|
+
Box,
|
|
1700
|
+
{
|
|
1701
|
+
sx: {
|
|
1702
|
+
p: 1,
|
|
1703
|
+
display: "flex",
|
|
1704
|
+
alignItems: "center",
|
|
1705
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
1706
|
+
padding: "6px",
|
|
1707
|
+
margin: "10px 0px",
|
|
1708
|
+
borderRadius: "10px",
|
|
1709
|
+
cursor: "pointer",
|
|
1710
|
+
"&:hover": { bgcolor: "action.selected" }
|
|
1711
|
+
},
|
|
1712
|
+
onClick: () => {
|
|
1713
|
+
handleSelectedProcessor(process);
|
|
1714
|
+
},
|
|
1715
|
+
children: /* @__PURE__ */ jsxs(
|
|
1716
|
+
Typography,
|
|
1717
|
+
{
|
|
1718
|
+
variant: "body1",
|
|
1719
|
+
sx: {
|
|
1720
|
+
mx: 1,
|
|
1721
|
+
width: "200px",
|
|
1722
|
+
maxWidth: "250px",
|
|
1723
|
+
display: "flex",
|
|
1724
|
+
alignItems: "center"
|
|
1725
|
+
},
|
|
1726
|
+
children: [
|
|
1727
|
+
/* @__PURE__ */ jsx2(SupportAgent, { sx: { marginRight: "4px" } }),
|
|
1728
|
+
process.process_name
|
|
1729
|
+
]
|
|
1730
|
+
}
|
|
1731
|
+
)
|
|
1732
|
+
},
|
|
1733
|
+
index
|
|
1734
|
+
)) : null
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
] })
|
|
1738
|
+
}
|
|
1739
|
+
) });
|
|
1740
|
+
}
|
|
1741
|
+
function CallHistoryDialog({ open, setOpen }) {
|
|
1742
|
+
const handleClose = () => {
|
|
1743
|
+
setOpen(false);
|
|
1744
|
+
};
|
|
1745
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
|
|
1746
|
+
Dialog,
|
|
1747
|
+
{
|
|
1748
|
+
open,
|
|
1749
|
+
"aria-labelledby": "alert-dialog-title",
|
|
1750
|
+
"aria-describedby": "alert-dialog-description",
|
|
1751
|
+
fullWidth: true,
|
|
1752
|
+
maxWidth: "md",
|
|
1753
|
+
children: /* @__PURE__ */ jsxs(Paper, { sx: { borderRadius: 2 }, children: [
|
|
1754
|
+
/* @__PURE__ */ jsxs(
|
|
1755
|
+
Box,
|
|
1756
|
+
{
|
|
1757
|
+
sx: {
|
|
1758
|
+
display: "flex",
|
|
1759
|
+
justifyContent: "space-between",
|
|
1760
|
+
alignItems: "center",
|
|
1761
|
+
padding: "4px 16px",
|
|
1762
|
+
boxShadow: "0px 1px 2px #f5f5f5ff"
|
|
1763
|
+
},
|
|
1764
|
+
children: [
|
|
1765
|
+
/* @__PURE__ */ jsx2(Typography, { variant: "body1", children: " Call History" }),
|
|
1766
|
+
/* @__PURE__ */ jsx2(IconButton, { onClick: handleClose, children: /* @__PURE__ */ jsx2(Close, {}) })
|
|
1767
|
+
]
|
|
1768
|
+
}
|
|
1769
|
+
),
|
|
1770
|
+
/* @__PURE__ */ jsx2(
|
|
1771
|
+
Box,
|
|
1772
|
+
{
|
|
1773
|
+
sx: {
|
|
1774
|
+
boxShadow: "1px 1px 4px #d3d3d3ff",
|
|
1775
|
+
margin: "10px",
|
|
1776
|
+
borderRadius: "10px",
|
|
1777
|
+
textAlign: "center",
|
|
1778
|
+
fontSize: "16px",
|
|
1779
|
+
fontWeight: "bold"
|
|
1780
|
+
},
|
|
1781
|
+
p: 6,
|
|
1782
|
+
children: "Comming Soon..."
|
|
1783
|
+
}
|
|
1784
|
+
)
|
|
1785
|
+
] })
|
|
1786
|
+
}
|
|
1787
|
+
) });
|
|
1788
|
+
}
|
|
1075
1789
|
|
|
1076
1790
|
// call-control-sdk/lib/components/callControlPanel.tsx
|
|
1077
1791
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1078
1792
|
function CallControlPanel({ onDataChange }) {
|
|
1079
|
-
|
|
1793
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la;
|
|
1794
|
+
const theme = useTheme3();
|
|
1795
|
+
const { disabled, enabled, outlined } = styles_default();
|
|
1080
1796
|
const state = useSDKState();
|
|
1797
|
+
const { showToast } = useToast();
|
|
1798
|
+
const webSocketRef = useRef2(null);
|
|
1081
1799
|
const [anchorEl, setAnchorEl] = useState5(null);
|
|
1082
1800
|
const [showIframe, setShowIframe] = useState5(true);
|
|
1083
|
-
const [statusAnchorEl, setStatusAnchorEl] = useState5(
|
|
1084
|
-
|
|
1085
|
-
);
|
|
1086
|
-
const [dialerAnchorEl, setDialerAnchorEl] = useState5(
|
|
1087
|
-
null
|
|
1088
|
-
);
|
|
1801
|
+
const [statusAnchorEl, setStatusAnchorEl] = useState5(null);
|
|
1802
|
+
const [dialerAnchorEl, setDialerAnchorEl] = useState5(null);
|
|
1089
1803
|
const [open, setOpen] = useState5(false);
|
|
1090
1804
|
const [openCallTransfer, setOpenCallTransfer] = useState5(false);
|
|
1091
1805
|
const [openCallDisposition, setOpenCallDisposition] = useState5(false);
|
|
1806
|
+
const [openProcessorDialog, setOpenProcessorDialog] = useState5(false);
|
|
1807
|
+
const [openCallHistoryDialog, setOpenCallHistoryDialog] = useState5(false);
|
|
1092
1808
|
const [phoneNumber, setPhoneNumber] = useState5("");
|
|
1093
1809
|
const [callDuration, setCallDuration] = useState5(0);
|
|
1094
1810
|
const { position, isDragging, dragRef, handleMouseDown, handleTouchStart } = useDraggable(
|
|
@@ -1105,39 +1821,46 @@ function CallControlPanel({ onDataChange }) {
|
|
|
1105
1821
|
state.iframePosition,
|
|
1106
1822
|
(newPosition) => sdkStateManager.setIframePosition(newPosition)
|
|
1107
1823
|
);
|
|
1824
|
+
const [getProcessList, { data: processList }] = usePostRequest({
|
|
1825
|
+
onSuccess: (res) => {
|
|
1826
|
+
var _a2;
|
|
1827
|
+
console.log("res", res);
|
|
1828
|
+
if (res && res.processes && ((_a2 = res == null ? void 0 : res.processes) == null ? void 0 : _a2.length) > 1) {
|
|
1829
|
+
setOpenProcessorDialog(true);
|
|
1830
|
+
} else {
|
|
1831
|
+
sdkStateManager.setProcess(res == null ? void 0 : res.processes[0]);
|
|
1832
|
+
setOpenProcessorDialog(false);
|
|
1833
|
+
}
|
|
1834
|
+
},
|
|
1835
|
+
onError: () => {
|
|
1836
|
+
setOpenProcessorDialog(false);
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1108
1839
|
const [clickToCall] = usePostRequest();
|
|
1109
|
-
const [holdOrUnHold] = usePostRequest(
|
|
1110
|
-
|
|
1840
|
+
const [holdOrUnHold] = usePostRequest({
|
|
1841
|
+
onSuccess: () => {
|
|
1842
|
+
sdkStateManager.setHolding(!state.isHolding);
|
|
1843
|
+
},
|
|
1844
|
+
onError: (error) => {
|
|
1845
|
+
console.log("error", error);
|
|
1846
|
+
}
|
|
1847
|
+
});
|
|
1848
|
+
const [muteOrUnMute] = usePostRequest({
|
|
1849
|
+
onSuccess: () => {
|
|
1850
|
+
sdkStateManager.setMuted(!state.isMuted);
|
|
1851
|
+
},
|
|
1852
|
+
onError: (error) => {
|
|
1853
|
+
console.log("error", error);
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1111
1856
|
const [readyAgentStatus] = usePostRequest();
|
|
1112
1857
|
const [updateAgentStatus] = usePostRequest();
|
|
1113
1858
|
const [endCall] = usePostRequest();
|
|
1114
|
-
useEffect2(() => {
|
|
1115
|
-
let interval;
|
|
1116
|
-
if (state.callStartTime) {
|
|
1117
|
-
interval = setInterval(() => {
|
|
1118
|
-
const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
|
|
1119
|
-
setCallDuration(elapsed);
|
|
1120
|
-
}, 1e3);
|
|
1121
|
-
} else {
|
|
1122
|
-
setCallDuration(0);
|
|
1123
|
-
}
|
|
1124
|
-
return () => {
|
|
1125
|
-
if (interval) clearInterval(interval);
|
|
1126
|
-
};
|
|
1127
|
-
}, [state.callStartTime]);
|
|
1128
|
-
useEffect2(() => {
|
|
1129
|
-
if (onDataChange) {
|
|
1130
|
-
onDataChange(state.callData);
|
|
1131
|
-
}
|
|
1132
|
-
}, [state.callData, onDataChange]);
|
|
1133
1859
|
const formatDuration = useCallback3((seconds) => {
|
|
1134
1860
|
const mins = Math.floor(seconds / 60);
|
|
1135
1861
|
const secs = seconds % 60;
|
|
1136
1862
|
return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
1137
1863
|
}, []);
|
|
1138
|
-
const handleOpenQueueCounts = (event) => {
|
|
1139
|
-
setAnchorEl(event.currentTarget);
|
|
1140
|
-
};
|
|
1141
1864
|
const handleCloseQueueCounts = () => {
|
|
1142
1865
|
setAnchorEl(null);
|
|
1143
1866
|
};
|
|
@@ -1158,445 +1881,449 @@ function CallControlPanel({ onDataChange }) {
|
|
|
1158
1881
|
const handleCloseAgentStatus = () => {
|
|
1159
1882
|
setStatusAnchorEl(null);
|
|
1160
1883
|
};
|
|
1161
|
-
const handleAgentReady = (
|
|
1884
|
+
const handleAgentReady = () => {
|
|
1162
1885
|
const payload = {
|
|
1163
1886
|
action: "READYAGENT",
|
|
1164
|
-
|
|
1165
|
-
refno: "string"
|
|
1887
|
+
userId: state.agentId
|
|
1166
1888
|
};
|
|
1167
1889
|
readyAgentStatus(END_POINT.READY_AGENT, payload);
|
|
1168
|
-
sdkStateManager.setStatus(status);
|
|
1169
1890
|
};
|
|
1170
1891
|
const handleUpdateAgentStatus = (status) => {
|
|
1171
|
-
sdkStateManager.setStatus(status);
|
|
1172
1892
|
setStatusAnchorEl(null);
|
|
1173
1893
|
const payload = {
|
|
1174
|
-
action: "
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
username: "string",
|
|
1178
|
-
ticket_id: 0
|
|
1894
|
+
action: "AGENTBREAK",
|
|
1895
|
+
break_type: status,
|
|
1896
|
+
userId: state.agentId
|
|
1179
1897
|
};
|
|
1180
1898
|
updateAgentStatus(END_POINT.UPDATE_AGENT_BREAK, payload);
|
|
1181
1899
|
};
|
|
1182
1900
|
const handleStartCall = (number) => {
|
|
1183
1901
|
if (number.length !== 10) {
|
|
1902
|
+
showToast("Invalid phone number", "error");
|
|
1184
1903
|
alert("Invalid phone number");
|
|
1185
1904
|
} else if (!/^\d+$/.test(number)) {
|
|
1186
|
-
|
|
1905
|
+
showToast("Invalid phone number", "error");
|
|
1187
1906
|
} else {
|
|
1188
1907
|
const payload = {
|
|
1189
1908
|
action: "CALL",
|
|
1190
1909
|
phone_number: number,
|
|
1191
|
-
|
|
1192
|
-
username: "string",
|
|
1193
|
-
ticket_id: 0
|
|
1910
|
+
userId: state.agentId
|
|
1194
1911
|
};
|
|
1195
1912
|
clickToCall(END_POINT.CLICK_TO_CALL, payload);
|
|
1196
|
-
sdkStateManager.startCall();
|
|
1197
1913
|
}
|
|
1198
1914
|
};
|
|
1199
1915
|
const handleHoldToggle = () => {
|
|
1200
1916
|
const payload = {
|
|
1201
1917
|
action: state.isHolding ? "UNHOLD" : "HOLD",
|
|
1202
|
-
|
|
1203
|
-
refno: "string"
|
|
1918
|
+
userId: state.agentId
|
|
1204
1919
|
};
|
|
1205
1920
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
1206
|
-
sdkStateManager.setHolding(!state.isHolding);
|
|
1207
1921
|
};
|
|
1208
1922
|
const handleMuteToggle = () => {
|
|
1209
1923
|
const payload = {
|
|
1210
1924
|
action: state.isMuted ? "UNMUTE" : "MUTE",
|
|
1211
|
-
|
|
1212
|
-
refno: "string"
|
|
1925
|
+
userId: state.agentId
|
|
1213
1926
|
};
|
|
1214
|
-
|
|
1215
|
-
muteOrUnMute(END_POINT.UNMUTE_CALL, payload);
|
|
1216
|
-
} else {
|
|
1217
|
-
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
1218
|
-
}
|
|
1219
|
-
sdkStateManager.setMuted(!state.isMuted);
|
|
1927
|
+
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
1220
1928
|
};
|
|
1221
1929
|
const handleEndCall = (data) => {
|
|
1222
|
-
var
|
|
1223
|
-
console.log(data);
|
|
1930
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
1931
|
+
console.log("data", data);
|
|
1224
1932
|
const payload = {
|
|
1225
1933
|
action: "ENDCALL",
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
disposition: (
|
|
1232
|
-
set_followUp: (
|
|
1233
|
-
callback_date: (
|
|
1234
|
-
callback_hrs: (
|
|
1235
|
-
callback_mins: (
|
|
1934
|
+
userId: state.agentId,
|
|
1935
|
+
processid: (_c2 = (_b2 = (_a2 = state.process) == null ? void 0 : _a2.process_id) == null ? void 0 : _b2.toString()) != null ? _c2 : "",
|
|
1936
|
+
process_name: (_e2 = (_d2 = state.process) == null ? void 0 : _d2.process_name) != null ? _e2 : "",
|
|
1937
|
+
callreferenceid: (_g2 = (_f2 = state.callData) == null ? void 0 : _f2.convox_id) != null ? _g2 : "",
|
|
1938
|
+
mobile_number: (_i2 = (_h2 = state.callData) == null ? void 0 : _h2.phone_number) != null ? _i2 : "",
|
|
1939
|
+
disposition: (_k2 = (_j2 = data == null ? void 0 : data.disposition) == null ? void 0 : _j2.value) != null ? _k2 : "",
|
|
1940
|
+
set_followUp: (_m2 = (_l2 = data == null ? void 0 : data.followUp) == null ? void 0 : _l2.value) != null ? _m2 : "",
|
|
1941
|
+
callback_date: (_n2 = data == null ? void 0 : data.callbackDate) != null ? _n2 : "",
|
|
1942
|
+
callback_hrs: (_o2 = data == null ? void 0 : data.callbackHrs) != null ? _o2 : "",
|
|
1943
|
+
callback_mins: (_p2 = data == null ? void 0 : data.callbackMins) != null ? _p2 : "",
|
|
1944
|
+
endcall_type: "CLOSE"
|
|
1236
1945
|
};
|
|
1237
1946
|
setPhoneNumber("");
|
|
1238
1947
|
endCall(END_POINT.END_CALL, payload);
|
|
1239
1948
|
sdkStateManager.endCall();
|
|
1240
1949
|
setOpenCallDisposition(false);
|
|
1241
1950
|
};
|
|
1242
|
-
|
|
1243
|
-
|
|
1951
|
+
useEffect3(() => {
|
|
1952
|
+
let interval;
|
|
1953
|
+
if (state.callData.status && state.callData.status === "ONCALL") {
|
|
1954
|
+
interval = setInterval(() => {
|
|
1955
|
+
const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
|
|
1956
|
+
setCallDuration(elapsed);
|
|
1957
|
+
}, 1e3);
|
|
1958
|
+
} else {
|
|
1959
|
+
setCallDuration(0);
|
|
1960
|
+
}
|
|
1961
|
+
return () => {
|
|
1962
|
+
if (interval) clearInterval(interval);
|
|
1963
|
+
};
|
|
1964
|
+
}, [state.callData.status]);
|
|
1965
|
+
useEffect3(() => {
|
|
1966
|
+
if (onDataChange) {
|
|
1967
|
+
onDataChange(state.callData);
|
|
1968
|
+
}
|
|
1969
|
+
}, [state.callData, onDataChange]);
|
|
1970
|
+
useEffect3(() => {
|
|
1971
|
+
if (state.agentId) {
|
|
1972
|
+
getProcessList(END_POINT.PROCESS_LIST, {
|
|
1973
|
+
userId: state.agentId,
|
|
1974
|
+
action: "GETAGENTPROCESSLIST",
|
|
1975
|
+
refno: "1234221233"
|
|
1976
|
+
});
|
|
1977
|
+
} else {
|
|
1978
|
+
console.log("No agentId available, skipping API call");
|
|
1979
|
+
}
|
|
1980
|
+
}, [state.agentId]);
|
|
1981
|
+
useEffect3(() => {
|
|
1982
|
+
if (state.agentId) {
|
|
1983
|
+
webSocketRef.current = new WebSocket(`${WS_END_POINT.WS}?agent_id=${state.agentId}`);
|
|
1984
|
+
webSocketRef.current.onopen = () => {
|
|
1985
|
+
console.log("WebSocket connection established");
|
|
1986
|
+
};
|
|
1987
|
+
webSocketRef.current.onmessage = (event) => {
|
|
1988
|
+
try {
|
|
1989
|
+
const data = JSON.parse(event.data);
|
|
1990
|
+
console.log("parsedJSON:", data);
|
|
1991
|
+
sdkStateManager.updateCallData(data);
|
|
1992
|
+
if (data.status === "ONCALL") {
|
|
1993
|
+
sdkStateManager.startCall();
|
|
1994
|
+
}
|
|
1995
|
+
if (data.status === "WRAPUP") {
|
|
1996
|
+
sdkStateManager.endCall();
|
|
1997
|
+
}
|
|
1998
|
+
} catch (e) {
|
|
1999
|
+
console.log("Raw message:", event.data);
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
webSocketRef.current.onclose = () => {
|
|
2003
|
+
console.log("WebSocket connection closed");
|
|
2004
|
+
};
|
|
2005
|
+
webSocketRef.current.onerror = (error) => {
|
|
2006
|
+
console.error("WebSocket error:", error);
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
return () => {
|
|
2010
|
+
var _a2;
|
|
2011
|
+
(_a2 = webSocketRef.current) == null ? void 0 : _a2.close();
|
|
2012
|
+
};
|
|
2013
|
+
}, [state.agentId]);
|
|
2014
|
+
if (!state.isInitialized || !state.process) {
|
|
2015
|
+
return /* @__PURE__ */ jsx3(Box2, { children: Boolean(openProcessorDialog) && /* @__PURE__ */ jsx3(
|
|
2016
|
+
ProcessorListDialog,
|
|
2017
|
+
{
|
|
2018
|
+
processList: processList == null ? void 0 : processList.processes,
|
|
2019
|
+
open: openProcessorDialog,
|
|
2020
|
+
setOpen: setOpenProcessorDialog,
|
|
2021
|
+
handleSelectedProcessor: (data) => {
|
|
2022
|
+
sdkStateManager.setProcess(data);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
) });
|
|
1244
2026
|
}
|
|
1245
2027
|
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1246
|
-
/* @__PURE__ */ jsx3(
|
|
1247
|
-
|
|
2028
|
+
/* @__PURE__ */ jsx3(
|
|
2029
|
+
Fade,
|
|
1248
2030
|
{
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
left: position.x,
|
|
1254
|
-
top: position.y,
|
|
1255
|
-
p: 1,
|
|
1256
|
-
borderRadius: 3,
|
|
1257
|
-
bgcolor: "background.paper",
|
|
1258
|
-
zIndex: 99999,
|
|
1259
|
-
transition: theme.transitions.create(["box-shadow", "transform"], {
|
|
1260
|
-
duration: theme.transitions.duration.short
|
|
1261
|
-
}),
|
|
1262
|
-
minWidth: 320,
|
|
1263
|
-
userSelect: "none"
|
|
1264
|
-
},
|
|
1265
|
-
children: /* @__PURE__ */ jsxs2(
|
|
1266
|
-
Box2,
|
|
2031
|
+
in: true,
|
|
2032
|
+
timeout: 300,
|
|
2033
|
+
children: /* @__PURE__ */ jsx3(
|
|
2034
|
+
Paper2,
|
|
1267
2035
|
{
|
|
2036
|
+
ref: dragRef,
|
|
2037
|
+
elevation: isDragging ? 4 : 1,
|
|
1268
2038
|
sx: {
|
|
1269
|
-
|
|
1270
|
-
|
|
2039
|
+
position: "fixed",
|
|
2040
|
+
left: position.x,
|
|
2041
|
+
top: position.y,
|
|
2042
|
+
p: 0.5,
|
|
2043
|
+
borderRadius: 3,
|
|
2044
|
+
bgcolor: "background.paper",
|
|
2045
|
+
zIndex: 99999,
|
|
2046
|
+
transition: theme.transitions.create(["box-shadow", "transform"], {
|
|
2047
|
+
duration: theme.transitions.duration.short
|
|
2048
|
+
}),
|
|
2049
|
+
userSelect: "none"
|
|
1271
2050
|
},
|
|
1272
|
-
children:
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
{
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
},
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
{
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
bgcolor: "
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
sx: {
|
|
1333
|
-
color: state.status === "on call" || state.status === "break" ? "action.selected" : "success.main"
|
|
1334
|
-
}
|
|
2051
|
+
children: /* @__PURE__ */ jsxs2(
|
|
2052
|
+
Box2,
|
|
2053
|
+
{
|
|
2054
|
+
sx: {
|
|
2055
|
+
display: "flex",
|
|
2056
|
+
alignItems: "center"
|
|
2057
|
+
},
|
|
2058
|
+
children: [
|
|
2059
|
+
/* @__PURE__ */ jsxs2(
|
|
2060
|
+
Box2,
|
|
2061
|
+
{
|
|
2062
|
+
sx: {
|
|
2063
|
+
display: "flex",
|
|
2064
|
+
justifyContent: "space-between",
|
|
2065
|
+
alignItems: "center"
|
|
2066
|
+
},
|
|
2067
|
+
children: [
|
|
2068
|
+
/* @__PURE__ */ jsxs2(
|
|
2069
|
+
IconButton2,
|
|
2070
|
+
{
|
|
2071
|
+
component: "div",
|
|
2072
|
+
size: "small",
|
|
2073
|
+
sx: {
|
|
2074
|
+
cursor: "all-scroll"
|
|
2075
|
+
},
|
|
2076
|
+
onMouseDown: handleMouseDown,
|
|
2077
|
+
onTouchStart: handleTouchStart,
|
|
2078
|
+
children: [
|
|
2079
|
+
/* @__PURE__ */ jsx3(DragIndicator, {}),
|
|
2080
|
+
" "
|
|
2081
|
+
]
|
|
2082
|
+
}
|
|
2083
|
+
),
|
|
2084
|
+
/* @__PURE__ */ jsx3(
|
|
2085
|
+
Box2,
|
|
2086
|
+
{
|
|
2087
|
+
sx: {
|
|
2088
|
+
marginRight: "10px"
|
|
2089
|
+
},
|
|
2090
|
+
children: /* @__PURE__ */ jsx3(Tooltip2, { title: "Dial", children: /* @__PURE__ */ jsx3(
|
|
2091
|
+
IconButton2,
|
|
2092
|
+
{
|
|
2093
|
+
size: "small",
|
|
2094
|
+
onClick: (e) => {
|
|
2095
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
2096
|
+
if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) !== "ONCALL" && ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) !== "BREAK" && ((_f2 = (_e2 = state.callData) == null ? void 0 : _e2.status) == null ? void 0 : _f2.toUpperCase()) !== "RINGING" && ((_h2 = (_g2 = state.callData) == null ? void 0 : _g2.status) == null ? void 0 : _h2.toUpperCase()) !== "WRAPUP") {
|
|
2097
|
+
handleOpenDialer(e);
|
|
2098
|
+
}
|
|
2099
|
+
},
|
|
2100
|
+
sx: {
|
|
2101
|
+
bgcolor: "action.hover",
|
|
2102
|
+
"&:hover": {
|
|
2103
|
+
bgcolor: "warning"
|
|
2104
|
+
}
|
|
2105
|
+
},
|
|
2106
|
+
children: /* @__PURE__ */ jsx3(
|
|
2107
|
+
WifiCalling3,
|
|
2108
|
+
{
|
|
2109
|
+
sx: {
|
|
2110
|
+
color: ((_b = (_a = state.callData) == null ? void 0 : _a.status) == null ? void 0 : _b.toUpperCase()) === "ONCALL" || ((_d = (_c = state.callData) == null ? void 0 : _c.status) == null ? void 0 : _d.toUpperCase()) === "BREAK" || ((_f = (_e = state.callData) == null ? void 0 : _e.status) == null ? void 0 : _f.toUpperCase()) === "RINGING" || ((_h = (_g = state.callData) == null ? void 0 : _g.status) == null ? void 0 : _h.toUpperCase()) === "WRAPUP" ? "action.selected" : "success.main"
|
|
1335
2111
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
}
|
|
1340
|
-
),
|
|
1341
|
-
formatDuration(callDuration)
|
|
1342
|
-
]
|
|
1343
|
-
}
|
|
1344
|
-
),
|
|
1345
|
-
/* @__PURE__ */ jsxs2(
|
|
1346
|
-
ButtonGroup,
|
|
1347
|
-
{
|
|
1348
|
-
disableElevation: true,
|
|
1349
|
-
variant: "contained",
|
|
1350
|
-
"aria-label": "Disabled button group",
|
|
1351
|
-
sx: {
|
|
1352
|
-
marginRight: "10px"
|
|
1353
|
-
},
|
|
1354
|
-
children: [
|
|
1355
|
-
/* @__PURE__ */ jsx3(
|
|
1356
|
-
Button2,
|
|
1357
|
-
{
|
|
1358
|
-
sx: {
|
|
1359
|
-
fontWeight: "bold",
|
|
1360
|
-
borderRadius: "16px",
|
|
1361
|
-
display: "flex",
|
|
1362
|
-
alignItems: "center",
|
|
1363
|
-
justifyContent: "space-between"
|
|
1364
|
-
},
|
|
1365
|
-
variant: "outlined",
|
|
1366
|
-
children: /* @__PURE__ */ jsx3(
|
|
1367
|
-
Typography2,
|
|
1368
|
-
{
|
|
1369
|
-
width: 70,
|
|
1370
|
-
variant: "body2",
|
|
1371
|
-
sx: {
|
|
1372
|
-
fontWeight: "bold"
|
|
1373
|
-
},
|
|
1374
|
-
children: state.status.toUpperCase()
|
|
1375
|
-
}
|
|
1376
|
-
)
|
|
1377
|
-
}
|
|
1378
|
-
),
|
|
1379
|
-
/* @__PURE__ */ jsxs2(
|
|
1380
|
-
Button2,
|
|
1381
|
-
{
|
|
1382
|
-
sx: {
|
|
1383
|
-
borderRadius: "16px",
|
|
1384
|
-
width: 20
|
|
1385
|
-
},
|
|
1386
|
-
variant: "outlined",
|
|
1387
|
-
onClick: handleOpenAgentStatus,
|
|
1388
|
-
disabled: Boolean(state.callStartTime),
|
|
1389
|
-
children: [
|
|
1390
|
-
/* @__PURE__ */ jsx3(ArrowDropDown, {}),
|
|
1391
|
-
" "
|
|
1392
|
-
]
|
|
1393
|
-
}
|
|
1394
|
-
)
|
|
1395
|
-
]
|
|
1396
|
-
}
|
|
1397
|
-
)
|
|
1398
|
-
]
|
|
1399
|
-
}
|
|
1400
|
-
),
|
|
1401
|
-
/* @__PURE__ */ jsxs2(
|
|
1402
|
-
Box2,
|
|
1403
|
-
{
|
|
1404
|
-
sx: {
|
|
1405
|
-
display: "flex",
|
|
1406
|
-
gap: 1,
|
|
1407
|
-
justifyContent: "center",
|
|
1408
|
-
alignItems: "center"
|
|
1409
|
-
},
|
|
1410
|
-
children: [
|
|
1411
|
-
state.status === "break" && /* @__PURE__ */ jsx3(Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ jsx3(
|
|
1412
|
-
IconButton2,
|
|
1413
|
-
{
|
|
1414
|
-
onClick: (e) => {
|
|
1415
|
-
e.stopPropagation();
|
|
1416
|
-
handleAgentReady("idle");
|
|
1417
|
-
},
|
|
1418
|
-
color: "default",
|
|
1419
|
-
sx: {
|
|
1420
|
-
bgcolor: "error.dark",
|
|
1421
|
-
"&:hover": {
|
|
1422
|
-
bgcolor: "error.light"
|
|
2112
|
+
}
|
|
2113
|
+
)
|
|
2114
|
+
}
|
|
2115
|
+
) })
|
|
1423
2116
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
2117
|
+
),
|
|
2118
|
+
/* @__PURE__ */ jsx3(
|
|
2119
|
+
Typography2,
|
|
1427
2120
|
{
|
|
1428
2121
|
sx: {
|
|
1429
|
-
color: "
|
|
1430
|
-
|
|
2122
|
+
color: "success.main",
|
|
2123
|
+
width: "40px",
|
|
2124
|
+
marginRight: "10px"
|
|
2125
|
+
},
|
|
2126
|
+
children: formatDuration(callDuration)
|
|
2127
|
+
}
|
|
2128
|
+
),
|
|
2129
|
+
/* @__PURE__ */ jsx3(
|
|
2130
|
+
Typography2,
|
|
2131
|
+
{
|
|
2132
|
+
variant: "body2",
|
|
2133
|
+
sx: {
|
|
2134
|
+
fontWeight: "bold"
|
|
2135
|
+
},
|
|
2136
|
+
children: (_k = (_j = (_i = state.callData) == null ? void 0 : _i.status) == null ? void 0 : _j.toUpperCase()) != null ? _k : "N/A"
|
|
2137
|
+
}
|
|
2138
|
+
),
|
|
2139
|
+
/* @__PURE__ */ jsxs2(
|
|
2140
|
+
Button2,
|
|
2141
|
+
{
|
|
2142
|
+
size: "small",
|
|
2143
|
+
variant: "text",
|
|
2144
|
+
onClick: handleOpenAgentStatus,
|
|
2145
|
+
disabled: Boolean(state.callStartTime),
|
|
2146
|
+
children: [
|
|
2147
|
+
/* @__PURE__ */ jsx3(ArrowDropDown, {}),
|
|
2148
|
+
" "
|
|
2149
|
+
]
|
|
1431
2150
|
}
|
|
1432
2151
|
)
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
2152
|
+
]
|
|
2153
|
+
}
|
|
2154
|
+
),
|
|
2155
|
+
/* @__PURE__ */ jsxs2(
|
|
2156
|
+
Box2,
|
|
2157
|
+
{
|
|
2158
|
+
sx: {
|
|
2159
|
+
display: "flex",
|
|
2160
|
+
gap: 1,
|
|
2161
|
+
justifyContent: "center",
|
|
2162
|
+
alignItems: "center"
|
|
2163
|
+
},
|
|
2164
|
+
children: [
|
|
2165
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: "Agent Ready", children: /* @__PURE__ */ jsx3(
|
|
2166
|
+
Button2,
|
|
2167
|
+
{
|
|
2168
|
+
variant: ((_m = (_l = state.callData) == null ? void 0 : _l.status) == null ? void 0 : _m.toUpperCase()) === "BREAK" || ((_o = (_n = state.callData) == null ? void 0 : _n.status) == null ? void 0 : _o.toUpperCase()) === "MISSED" ? "outlined" : "contained",
|
|
2169
|
+
onClick: (e) => {
|
|
2170
|
+
var _a2, _b2, _c2, _d2;
|
|
2171
|
+
if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "BREAK" || ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) === "MISSED") {
|
|
2172
|
+
e.stopPropagation();
|
|
2173
|
+
handleAgentReady();
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
classes: {
|
|
2177
|
+
root: ((_q = (_p = state.callData) == null ? void 0 : _p.status) == null ? void 0 : _q.toUpperCase()) === "BREAK" || ((_s = (_r = state.callData) == null ? void 0 : _r.status) == null ? void 0 : _s.toUpperCase()) === "MISSED" ? "outlined" : "enabled"
|
|
2178
|
+
},
|
|
2179
|
+
sx: __spreadValues({}, ((_u = (_t = state.callData) == null ? void 0 : _t.status) == null ? void 0 : _u.toUpperCase()) === "BREAK" || ((_w = (_v = state.callData) == null ? void 0 : _v.status) == null ? void 0 : _w.toUpperCase()) === "MISSED" ? outlined : enabled),
|
|
2180
|
+
children: /* @__PURE__ */ jsx3(SupportAgent2, {})
|
|
1446
2181
|
}
|
|
1447
|
-
},
|
|
1448
|
-
children: /* @__PURE__ */ jsx3(
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
sx: {
|
|
1460
|
-
bgcolor: state.isHolding ? "warning.info" : "action.hover"
|
|
1461
|
-
},
|
|
1462
|
-
children: state.isHolding ? /* @__PURE__ */ jsx3(PlayCircle, {}) : /* @__PURE__ */ jsx3(PauseCircle2, {})
|
|
1463
|
-
}
|
|
1464
|
-
) }),
|
|
1465
|
-
state.status === "on call" && /* @__PURE__ */ jsx3(Tooltip, { title: state.isMuted ? "Unmute" : "Mute", children: /* @__PURE__ */ jsx3(
|
|
1466
|
-
IconButton2,
|
|
1467
|
-
{
|
|
1468
|
-
onClick: (e) => {
|
|
1469
|
-
e.stopPropagation();
|
|
1470
|
-
handleMuteToggle();
|
|
1471
|
-
},
|
|
1472
|
-
color: state.isMuted ? "error" : "default",
|
|
1473
|
-
sx: {
|
|
1474
|
-
bgcolor: state.isMuted ? "error.info" : "action.hover"
|
|
1475
|
-
},
|
|
1476
|
-
children: state.isMuted ? /* @__PURE__ */ jsx3(MicOff, {}) : /* @__PURE__ */ jsx3(Mic, {})
|
|
1477
|
-
}
|
|
1478
|
-
) }),
|
|
1479
|
-
state.status !== "on call" && /* @__PURE__ */ jsx3(Tooltip, { title: "Queue", children: /* @__PURE__ */ jsx3(
|
|
1480
|
-
IconButton2,
|
|
1481
|
-
{
|
|
1482
|
-
onClick: (e) => {
|
|
1483
|
-
e.stopPropagation();
|
|
1484
|
-
handleOpenQueueCounts(e);
|
|
1485
|
-
},
|
|
1486
|
-
color: "default",
|
|
1487
|
-
sx: {
|
|
1488
|
-
bgcolor: "action.hover",
|
|
1489
|
-
"&:hover": {
|
|
1490
|
-
bgcolor: "warning"
|
|
2182
|
+
) }),
|
|
2183
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: state.isHolding ? "Resume" : "Hold", children: /* @__PURE__ */ jsx3(
|
|
2184
|
+
Button2,
|
|
2185
|
+
{
|
|
2186
|
+
variant: state.isHolding && ((_y = (_x = state.callData) == null ? void 0 : _x.status) == null ? void 0 : _y.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
|
|
2187
|
+
onClick: (e) => {
|
|
2188
|
+
e.stopPropagation();
|
|
2189
|
+
handleHoldToggle();
|
|
2190
|
+
},
|
|
2191
|
+
sx: state.isHolding && ((_A = (_z = state.callData) == null ? void 0 : _z.status) == null ? void 0 : _A.toUpperCase()) === "ONCALL" ? __spreadValues({}, enabled) : ((_C = (_B = state.callData) == null ? void 0 : _B.status) == null ? void 0 : _C.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
2192
|
+
disabled: ((_E = (_D = state.callData) == null ? void 0 : _D.status) == null ? void 0 : _E.toUpperCase()) !== "ONCALL" && !state.isHolding,
|
|
2193
|
+
children: state.isHolding ? /* @__PURE__ */ jsx3(PlayArrow2, {}) : /* @__PURE__ */ jsx3(Pause2, {})
|
|
1491
2194
|
}
|
|
1492
|
-
},
|
|
1493
|
-
children: /* @__PURE__ */ jsx3(
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
sx: {
|
|
1505
|
-
bgcolor: "action.hover",
|
|
1506
|
-
"&:hover": {
|
|
1507
|
-
bgcolor: "warning"
|
|
2195
|
+
) }),
|
|
2196
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: state.isMuted ? "Unmute" : "Mute", children: /* @__PURE__ */ jsx3(
|
|
2197
|
+
Button2,
|
|
2198
|
+
{
|
|
2199
|
+
variant: state.isMuted && ((_G = (_F = state.callData) == null ? void 0 : _F.status) == null ? void 0 : _G.toUpperCase()) === "ONCALL" ? "contained" : "outlined",
|
|
2200
|
+
onClick: (e) => {
|
|
2201
|
+
e.stopPropagation();
|
|
2202
|
+
handleMuteToggle();
|
|
2203
|
+
},
|
|
2204
|
+
sx: state.isMuted && ((_I = (_H = state.callData) == null ? void 0 : _H.status) == null ? void 0 : _I.toUpperCase()) === "ONCALL" ? __spreadValues({}, enabled) : ((_K = (_J = state.callData) == null ? void 0 : _J.status) == null ? void 0 : _K.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
2205
|
+
disabled: ((_M = (_L = state.callData) == null ? void 0 : _L.status) == null ? void 0 : _M.toUpperCase()) !== "ONCALL" && !state.isMuted,
|
|
2206
|
+
children: state.isMuted ? /* @__PURE__ */ jsx3(MicOff2, {}) : /* @__PURE__ */ jsx3(Mic2, {})
|
|
1508
2207
|
}
|
|
1509
|
-
},
|
|
1510
|
-
children: /* @__PURE__ */ jsx3(
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
bgcolor: "warning"
|
|
2208
|
+
) }),
|
|
2209
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: "Transfer Call", children: /* @__PURE__ */ jsx3(
|
|
2210
|
+
Button2,
|
|
2211
|
+
{
|
|
2212
|
+
variant: openCallTransfer ? "contained" : "outlined",
|
|
2213
|
+
onClick: (e) => {
|
|
2214
|
+
var _a2, _b2;
|
|
2215
|
+
if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
|
|
2216
|
+
e.stopPropagation();
|
|
2217
|
+
setOpenCallTransfer(true);
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
sx: openCallTransfer ? __spreadValues({}, enabled) : ((_O = (_N = state.callData) == null ? void 0 : _N.status) == null ? void 0 : _O.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
2221
|
+
disabled: ((_Q = (_P = state.callData) == null ? void 0 : _P.status) == null ? void 0 : _Q.toUpperCase()) !== "ONCALL",
|
|
2222
|
+
children: /* @__PURE__ */ jsx3(TransferWithinAStation, {})
|
|
1525
2223
|
}
|
|
1526
|
-
},
|
|
1527
|
-
children: /* @__PURE__ */ jsx3(
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
2224
|
+
) }),
|
|
2225
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: "Conference Call", children: /* @__PURE__ */ jsx3(
|
|
2226
|
+
Button2,
|
|
2227
|
+
{
|
|
2228
|
+
variant: open ? "contained" : "outlined",
|
|
2229
|
+
onClick: (e) => {
|
|
2230
|
+
var _a2, _b2;
|
|
2231
|
+
if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
|
|
2232
|
+
e.stopPropagation();
|
|
2233
|
+
setOpen(true);
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
sx: open ? __spreadValues({}, enabled) : ((_S = (_R = state.callData) == null ? void 0 : _R.status) == null ? void 0 : _S.toUpperCase()) === "ONCALL" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
2237
|
+
disabled: ((_U = (_T = state.callData) == null ? void 0 : _T.status) == null ? void 0 : _U.toUpperCase()) !== "ONCALL",
|
|
2238
|
+
children: /* @__PURE__ */ jsx3(Group, {})
|
|
2239
|
+
}
|
|
2240
|
+
) }),
|
|
2241
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: "Call History", children: /* @__PURE__ */ jsx3(
|
|
2242
|
+
Button2,
|
|
1536
2243
|
{
|
|
2244
|
+
variant: openCallHistoryDialog ? "contained" : "outlined",
|
|
1537
2245
|
onClick: (e) => {
|
|
1538
2246
|
e.stopPropagation();
|
|
1539
|
-
|
|
2247
|
+
setOpenCallHistoryDialog(true);
|
|
1540
2248
|
},
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
2249
|
+
sx: openCallHistoryDialog ? __spreadValues({}, enabled) : __spreadValues({}, outlined),
|
|
2250
|
+
children: /* @__PURE__ */ jsx3(History, {})
|
|
2251
|
+
}
|
|
2252
|
+
) }),
|
|
2253
|
+
/* @__PURE__ */ jsx3(Tooltip2, { title: "End Call", children: /* @__PURE__ */ jsx3(
|
|
2254
|
+
Button2,
|
|
2255
|
+
{
|
|
2256
|
+
variant: ((_W = (_V = state.callData) == null ? void 0 : _V.status) == null ? void 0 : _W.toUpperCase()) === "ONCALL" || ((_Y = (_X = state.callData) == null ? void 0 : _X.status) == null ? void 0 : _Y.toUpperCase()) === "RINGING" || ((__ = (_Z = state.callData) == null ? void 0 : _Z.status) == null ? void 0 : __.toUpperCase()) === "WRAPUP" ? "contained" : "outlined",
|
|
2257
|
+
onClick: (e) => {
|
|
2258
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
2259
|
+
if (((_b2 = (_a2 = state.callData) == null ? void 0 : _a2.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" || ((_d2 = (_c2 = state.callData) == null ? void 0 : _c2.status) == null ? void 0 : _d2.toUpperCase()) === "RINGING" || ((_f2 = (_e2 = state.callData) == null ? void 0 : _e2.status) == null ? void 0 : _f2.toUpperCase()) === "WRAPUP") {
|
|
2260
|
+
e.stopPropagation();
|
|
2261
|
+
setOpenCallDisposition(true);
|
|
1547
2262
|
}
|
|
1548
2263
|
},
|
|
2264
|
+
sx: ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" || ((_ca = (_ba = state.callData) == null ? void 0 : _ba.status) == null ? void 0 : _ca.toUpperCase()) === "RINGING" || ((_ea = (_da = state.callData) == null ? void 0 : _da.status) == null ? void 0 : _ea.toUpperCase()) === "WRAPUP" ? __spreadProps(__spreadValues({}, enabled), {
|
|
2265
|
+
borderRight: "1px",
|
|
2266
|
+
backgroundColor: "error.main",
|
|
2267
|
+
minWidth: "60px !important",
|
|
2268
|
+
boxShadow: " 0px 2px 1px #5f3f3f",
|
|
2269
|
+
border: `1px solid ${theme.palette.error.light}`,
|
|
2270
|
+
height: "40px",
|
|
2271
|
+
"&:hover": {
|
|
2272
|
+
bgcolor: "error.light",
|
|
2273
|
+
boxShadow: " 0px 2px 1px #5f3f3f",
|
|
2274
|
+
border: `0px solid ${theme.palette.error.light}`
|
|
2275
|
+
},
|
|
2276
|
+
"&:active": {
|
|
2277
|
+
bgcolor: "error.light",
|
|
2278
|
+
boxShadow: `inset 1px -2px 4px ${theme.palette.primary.light}`
|
|
2279
|
+
}
|
|
2280
|
+
}) : __spreadProps(__spreadValues({}, disabled), {
|
|
2281
|
+
minWidth: "60px !important"
|
|
2282
|
+
}),
|
|
2283
|
+
disabled: ((_ga = (_fa = state.callData) == null ? void 0 : _fa.status) == null ? void 0 : _ga.toUpperCase()) !== "ONCALL" && ((_ia = (_ha = state.callData) == null ? void 0 : _ha.status) == null ? void 0 : _ia.toUpperCase()) !== "RINGING" && ((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) !== "WRAPUP",
|
|
1549
2284
|
children: /* @__PURE__ */ jsx3(CallEnd2, {})
|
|
1550
2285
|
}
|
|
1551
|
-
)
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
2286
|
+
) })
|
|
2287
|
+
]
|
|
2288
|
+
}
|
|
2289
|
+
)
|
|
2290
|
+
]
|
|
2291
|
+
}
|
|
2292
|
+
)
|
|
1558
2293
|
}
|
|
1559
2294
|
)
|
|
1560
2295
|
}
|
|
1561
|
-
)
|
|
1562
|
-
|
|
1563
|
-
|
|
2296
|
+
),
|
|
2297
|
+
/* @__PURE__ */ jsx3(
|
|
2298
|
+
Fade,
|
|
1564
2299
|
{
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
sx: {
|
|
1568
|
-
position: "fixed",
|
|
1569
|
-
left: iframePosition.x,
|
|
1570
|
-
top: iframePosition.y,
|
|
1571
|
-
p: 1,
|
|
1572
|
-
height: "auto",
|
|
1573
|
-
borderRadius: 2,
|
|
1574
|
-
bgcolor: "background.paper",
|
|
1575
|
-
zIndex: 99999,
|
|
1576
|
-
transition: theme.transitions.create(
|
|
1577
|
-
["box-shadow", "transform"],
|
|
1578
|
-
{
|
|
1579
|
-
duration: theme.transitions.duration.short
|
|
1580
|
-
}
|
|
1581
|
-
),
|
|
1582
|
-
userSelect: "none"
|
|
1583
|
-
},
|
|
2300
|
+
in: true,
|
|
2301
|
+
timeout: 300,
|
|
1584
2302
|
children: /* @__PURE__ */ jsxs2(
|
|
1585
|
-
|
|
2303
|
+
Paper2,
|
|
1586
2304
|
{
|
|
2305
|
+
ref: iframeDragRef,
|
|
2306
|
+
elevation: iframeIsDragging ? 4 : 1,
|
|
1587
2307
|
sx: {
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
2308
|
+
position: "fixed",
|
|
2309
|
+
left: iframePosition.x,
|
|
2310
|
+
top: iframePosition.y,
|
|
2311
|
+
p: 1,
|
|
2312
|
+
height: "auto",
|
|
2313
|
+
borderRadius: 2,
|
|
2314
|
+
bgcolor: "background.paper",
|
|
2315
|
+
zIndex: 99999,
|
|
2316
|
+
transition: theme.transitions.create(["box-shadow", "transform"], {
|
|
2317
|
+
duration: theme.transitions.duration.short
|
|
2318
|
+
}),
|
|
2319
|
+
visibility: showIframe ? "visible" : "hidden",
|
|
2320
|
+
userSelect: "none"
|
|
1592
2321
|
},
|
|
1593
2322
|
children: [
|
|
1594
2323
|
/* @__PURE__ */ jsxs2(
|
|
1595
2324
|
Box2,
|
|
1596
2325
|
{
|
|
1597
2326
|
sx: {
|
|
1598
|
-
width: "100%",
|
|
1599
|
-
height: "auto",
|
|
1600
2327
|
display: "flex",
|
|
1601
2328
|
alignItems: "center",
|
|
1602
2329
|
justifyContent: "space-between",
|
|
@@ -1621,16 +2348,17 @@ function CallControlPanel({ onDataChange }) {
|
|
|
1621
2348
|
/* @__PURE__ */ jsx3(
|
|
1622
2349
|
"iframe",
|
|
1623
2350
|
{
|
|
1624
|
-
src:
|
|
1625
|
-
height:
|
|
1626
|
-
width:
|
|
2351
|
+
src: `https://h68.deepijatel.in/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_la = state.process) == null ? void 0 : _la.process_id}`,
|
|
2352
|
+
height: 380,
|
|
2353
|
+
width: 420,
|
|
2354
|
+
allow: "camera; microphone; autoplay"
|
|
1627
2355
|
}
|
|
1628
2356
|
)
|
|
1629
2357
|
]
|
|
1630
2358
|
}
|
|
1631
2359
|
)
|
|
1632
2360
|
}
|
|
1633
|
-
)
|
|
2361
|
+
),
|
|
1634
2362
|
/* @__PURE__ */ jsx3(
|
|
1635
2363
|
Menu,
|
|
1636
2364
|
{
|
|
@@ -1689,8 +2417,8 @@ function CallControlPanel({ onDataChange }) {
|
|
|
1689
2417
|
zIndex: 99999
|
|
1690
2418
|
},
|
|
1691
2419
|
children: [
|
|
1692
|
-
/* @__PURE__ */ jsx3(MenuItem, { onClick: () => handleUpdateAgentStatus("
|
|
1693
|
-
/* @__PURE__ */ jsx3(MenuItem, { onClick: () => handleUpdateAgentStatus("
|
|
2420
|
+
/* @__PURE__ */ jsx3(MenuItem, { onClick: () => handleUpdateAgentStatus("Lunch"), children: "- Lunch" }),
|
|
2421
|
+
/* @__PURE__ */ jsx3(MenuItem, { onClick: () => handleUpdateAgentStatus("Tea"), children: "- Tea" })
|
|
1694
2422
|
]
|
|
1695
2423
|
}
|
|
1696
2424
|
),
|
|
@@ -1759,18 +2487,7 @@ function CallControlPanel({ onDataChange }) {
|
|
|
1759
2487
|
ConferenceDialog,
|
|
1760
2488
|
{
|
|
1761
2489
|
open,
|
|
1762
|
-
setOpen
|
|
1763
|
-
agentName: "agent_Ravi",
|
|
1764
|
-
lines: [
|
|
1765
|
-
{ status: "ON CALL", type: "External", phone: "7032491730" },
|
|
1766
|
-
{ status: "IDLE", type: "Internal", phone: "" },
|
|
1767
|
-
{ status: "IDLE", type: "External", phone: "" },
|
|
1768
|
-
{ status: "IDLE", type: "Internal", phone: "" },
|
|
1769
|
-
{ status: "IDLE", type: "External", phone: "" }
|
|
1770
|
-
],
|
|
1771
|
-
onConference: () => console.log("Conference"),
|
|
1772
|
-
onExit: () => console.log("Exit"),
|
|
1773
|
-
onEndAllCalls: () => console.log("End All Calls")
|
|
2490
|
+
setOpen
|
|
1774
2491
|
}
|
|
1775
2492
|
),
|
|
1776
2493
|
Boolean(openCallTransfer) && /* @__PURE__ */ jsx3(
|
|
@@ -1787,6 +2504,13 @@ function CallControlPanel({ onDataChange }) {
|
|
|
1787
2504
|
setOpen: setOpenCallDisposition,
|
|
1788
2505
|
onSubmitDisposition: handleEndCall
|
|
1789
2506
|
}
|
|
2507
|
+
),
|
|
2508
|
+
Boolean(openCallHistoryDialog) && /* @__PURE__ */ jsx3(
|
|
2509
|
+
CallHistoryDialog,
|
|
2510
|
+
{
|
|
2511
|
+
open: openCallHistoryDialog,
|
|
2512
|
+
setOpen: setOpenCallHistoryDialog
|
|
2513
|
+
}
|
|
1790
2514
|
)
|
|
1791
2515
|
] });
|
|
1792
2516
|
}
|
|
@@ -2196,22 +2920,53 @@ if (typeof window !== "undefined") {
|
|
|
2196
2920
|
window.EventTracker = eventTracker;
|
|
2197
2921
|
}
|
|
2198
2922
|
|
|
2923
|
+
// call-control-sdk/lib/hooks/useLogout.ts
|
|
2924
|
+
import { useCallback as useCallback4 } from "react";
|
|
2925
|
+
var useLogout = (options = {}) => {
|
|
2926
|
+
const { onSuccess, onError, onComplete } = options;
|
|
2927
|
+
const state = useSDKState();
|
|
2928
|
+
const [logOutAgent, logoutState] = usePostRequest({
|
|
2929
|
+
onSuccess: (response) => {
|
|
2930
|
+
onSuccess == null ? void 0 : onSuccess(response);
|
|
2931
|
+
onComplete == null ? void 0 : onComplete();
|
|
2932
|
+
sdkStateManager.clearStorageAndReset();
|
|
2933
|
+
localStorage.clear();
|
|
2934
|
+
},
|
|
2935
|
+
onError: (error) => {
|
|
2936
|
+
onError == null ? void 0 : onError(error);
|
|
2937
|
+
onComplete == null ? void 0 : onComplete();
|
|
2938
|
+
}
|
|
2939
|
+
});
|
|
2940
|
+
const handleLogout = useCallback4(() => {
|
|
2941
|
+
const payload = {
|
|
2942
|
+
action: "LOGOUTUSER",
|
|
2943
|
+
userId: state.agentId || ""
|
|
2944
|
+
};
|
|
2945
|
+
logOutAgent(END_POINT.LOGOUT, payload);
|
|
2946
|
+
}, [logOutAgent]);
|
|
2947
|
+
return {
|
|
2948
|
+
logout: handleLogout,
|
|
2949
|
+
isLoading: logoutState.isLoading,
|
|
2950
|
+
isSuccess: logoutState.isSuccess,
|
|
2951
|
+
isError: logoutState.isError,
|
|
2952
|
+
error: logoutState.error,
|
|
2953
|
+
data: logoutState.data
|
|
2954
|
+
};
|
|
2955
|
+
};
|
|
2956
|
+
var useLogout_default = useLogout;
|
|
2957
|
+
|
|
2199
2958
|
// call-control-sdk/index.ts
|
|
2200
|
-
function initSDK({
|
|
2201
|
-
apiKey,
|
|
2202
|
-
tenantId,
|
|
2203
|
-
agentId,
|
|
2204
|
-
baseUrl
|
|
2205
|
-
}) {
|
|
2206
|
-
sdkStateManager.initialize(apiKey);
|
|
2959
|
+
function initSDK({ apiKey, tenantId, agentId }) {
|
|
2960
|
+
sdkStateManager.initialize(apiKey, agentId);
|
|
2207
2961
|
eventTracker.init({
|
|
2208
2962
|
apiKey,
|
|
2209
2963
|
tenantId,
|
|
2210
2964
|
agentId,
|
|
2211
|
-
baseUrl
|
|
2965
|
+
baseUrl: BASE_URL
|
|
2212
2966
|
});
|
|
2213
2967
|
}
|
|
2214
2968
|
export {
|
|
2215
2969
|
CallControlPanel,
|
|
2216
|
-
initSDK
|
|
2970
|
+
initSDK,
|
|
2971
|
+
useLogout_default as useLogout
|
|
2217
2972
|
};
|