call-control-sdk 6.5.1-uat.6 → 6.5.1-uat.7
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/dist/index.js +387 -376
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +409 -398
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -129,9 +129,6 @@ var SDKStateManager = class {
|
|
|
129
129
|
enabled: {},
|
|
130
130
|
outlined: {}
|
|
131
131
|
},
|
|
132
|
-
isHolding: false,
|
|
133
|
-
isMuted: false,
|
|
134
|
-
status: "idle",
|
|
135
132
|
callStartTime: null,
|
|
136
133
|
controlPanelPosition: { x: 10, y: 10 },
|
|
137
134
|
iframePosition: { x: ((_a2 = window.screen) == null ? void 0 : _a2.availWidth) - 460, y: ((_b = window.screen) == null ? void 0 : _b.height) - 580 },
|
|
@@ -227,9 +224,6 @@ var SDKStateManager = class {
|
|
|
227
224
|
enabled: {},
|
|
228
225
|
outlined: {}
|
|
229
226
|
},
|
|
230
|
-
isHolding: parsedState.isHolding || false,
|
|
231
|
-
isMuted: parsedState.isMuted || false,
|
|
232
|
-
status: parsedState.status || "idle",
|
|
233
227
|
callStartTime: parsedState.callStartTime || null,
|
|
234
228
|
controlPanelPosition: parsedState.controlPanelPosition || {
|
|
235
229
|
x: 10,
|
|
@@ -248,7 +242,6 @@ var SDKStateManager = class {
|
|
|
248
242
|
event_time: "",
|
|
249
243
|
phone_number: ""
|
|
250
244
|
},
|
|
251
|
-
// Fix: Properly handle conferenceLine with fallback to initial state
|
|
252
245
|
conferenceLine: parsedState.conferenceLine && Array.isArray(parsedState.conferenceLine) && parsedState.conferenceLine.length > 0 ? parsedState.conferenceLine : this.state.conferenceLine
|
|
253
246
|
});
|
|
254
247
|
}
|
|
@@ -266,9 +259,6 @@ var SDKStateManager = class {
|
|
|
266
259
|
openConferenceDialog: this.state.openConferenceDialog,
|
|
267
260
|
openCallTransferDialog: this.state.openCallTransferDialog,
|
|
268
261
|
sdkConfig: this.state.sdkConfig,
|
|
269
|
-
isHolding: this.state.isHolding,
|
|
270
|
-
isMuted: this.state.isMuted,
|
|
271
|
-
status: this.state.status,
|
|
272
262
|
callStartTime: this.state.callStartTime,
|
|
273
263
|
controlPanelPosition: this.state.controlPanelPosition,
|
|
274
264
|
iframePosition: this.state.iframePosition,
|
|
@@ -339,21 +329,16 @@ var SDKStateManager = class {
|
|
|
339
329
|
}
|
|
340
330
|
};
|
|
341
331
|
}
|
|
342
|
-
setHolding(isHolding) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
setMuted(isMuted) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
setStatus(status) {
|
|
353
|
-
this.state.status = status;
|
|
354
|
-
this.saveToStorage();
|
|
355
|
-
this.notifyListeners();
|
|
356
|
-
}
|
|
332
|
+
// public setHolding(isHolding: boolean): void {
|
|
333
|
+
// this.state.isHolding = isHolding;
|
|
334
|
+
// this.saveToStorage();
|
|
335
|
+
// this.notifyListeners();
|
|
336
|
+
// }
|
|
337
|
+
// public setMuted(isMuted: boolean): void {
|
|
338
|
+
// this.state.isMuted = isMuted;
|
|
339
|
+
// this.saveToStorage();
|
|
340
|
+
// this.notifyListeners();
|
|
341
|
+
// }
|
|
357
342
|
setProcess(process) {
|
|
358
343
|
this.state.process = process;
|
|
359
344
|
this.saveToStorage();
|
|
@@ -371,15 +356,11 @@ var SDKStateManager = class {
|
|
|
371
356
|
}
|
|
372
357
|
startCall() {
|
|
373
358
|
this.state.callStartTime = Date.now();
|
|
374
|
-
this.state.status = "on call";
|
|
375
359
|
this.saveToStorage();
|
|
376
360
|
this.notifyListeners();
|
|
377
361
|
}
|
|
378
362
|
endCall() {
|
|
379
363
|
this.state.callStartTime = null;
|
|
380
|
-
this.state.status = "idle";
|
|
381
|
-
this.state.isHolding = false;
|
|
382
|
-
this.state.isMuted = false;
|
|
383
364
|
this.saveToStorage();
|
|
384
365
|
this.notifyListeners();
|
|
385
366
|
}
|
|
@@ -864,101 +845,16 @@ var import_icons_material2 = require("@mui/icons-material");
|
|
|
864
845
|
var import_material4 = require("@mui/material");
|
|
865
846
|
var import_react11 = require("react");
|
|
866
847
|
|
|
867
|
-
// call-control-sdk/lib/
|
|
868
|
-
var
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
const [isDragging, setIsDragging] = (0, import_react6.useState)(false);
|
|
872
|
-
const dragRef = (0, import_react6.useRef)();
|
|
873
|
-
const dragStart = (0, import_react6.useRef)({ x: 0, y: 0 });
|
|
874
|
-
const elementStart = (0, import_react6.useRef)({ x: 0, y: 0 });
|
|
875
|
-
const updatePosition = (0, import_react6.useCallback)(
|
|
876
|
-
(newPosition) => {
|
|
877
|
-
const element = dragRef.current;
|
|
878
|
-
if (!element) return;
|
|
879
|
-
const rect = element.getBoundingClientRect();
|
|
880
|
-
const viewportWidth = window.innerWidth;
|
|
881
|
-
const viewportHeight = window.innerHeight;
|
|
882
|
-
const constrainedPosition = {
|
|
883
|
-
x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
|
|
884
|
-
y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
|
|
885
|
-
};
|
|
886
|
-
setPosition(constrainedPosition);
|
|
887
|
-
onPositionChange == null ? void 0 : onPositionChange(constrainedPosition);
|
|
888
|
-
},
|
|
889
|
-
[onPositionChange]
|
|
890
|
-
);
|
|
891
|
-
const handleStart = (0, import_react6.useCallback)(
|
|
892
|
-
(clientX, clientY) => {
|
|
893
|
-
setIsDragging(true);
|
|
894
|
-
dragStart.current = { x: clientX, y: clientY };
|
|
895
|
-
elementStart.current = position;
|
|
896
|
-
const handleMove = (moveClientX, moveClientY) => {
|
|
897
|
-
const deltaX = moveClientX - dragStart.current.x;
|
|
898
|
-
const deltaY = moveClientY - dragStart.current.y;
|
|
899
|
-
updatePosition({
|
|
900
|
-
x: elementStart.current.x + deltaX,
|
|
901
|
-
y: elementStart.current.y + deltaY
|
|
902
|
-
});
|
|
903
|
-
};
|
|
904
|
-
const handleMouseMove = (e) => {
|
|
905
|
-
e.preventDefault();
|
|
906
|
-
handleMove(e.clientX, e.clientY);
|
|
907
|
-
};
|
|
908
|
-
const handleTouchMove = (e) => {
|
|
909
|
-
e.preventDefault();
|
|
910
|
-
const touch = e.touches[0];
|
|
911
|
-
if (touch) {
|
|
912
|
-
handleMove(touch.clientX, touch.clientY);
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
const handleEnd = () => {
|
|
916
|
-
setIsDragging(false);
|
|
917
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
918
|
-
document.removeEventListener("mouseup", handleEnd);
|
|
919
|
-
document.removeEventListener("touchmove", handleTouchMove);
|
|
920
|
-
document.removeEventListener("touchend", handleEnd);
|
|
921
|
-
};
|
|
922
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
923
|
-
document.addEventListener("mouseup", handleEnd);
|
|
924
|
-
document.addEventListener("touchmove", handleTouchMove, {
|
|
925
|
-
passive: false
|
|
926
|
-
});
|
|
927
|
-
document.addEventListener("touchend", handleEnd);
|
|
928
|
-
},
|
|
929
|
-
[position, updatePosition]
|
|
930
|
-
);
|
|
931
|
-
const handleMouseDown = (0, import_react6.useCallback)(
|
|
932
|
-
(e) => {
|
|
933
|
-
e.preventDefault();
|
|
934
|
-
handleStart(e.clientX, e.clientY);
|
|
935
|
-
},
|
|
936
|
-
[handleStart]
|
|
937
|
-
);
|
|
938
|
-
const handleTouchStart = (0, import_react6.useCallback)(
|
|
939
|
-
(e) => {
|
|
940
|
-
e.preventDefault();
|
|
941
|
-
const touch = e.touches[0];
|
|
942
|
-
if (touch) {
|
|
943
|
-
handleStart(touch.clientX, touch.clientY);
|
|
944
|
-
}
|
|
945
|
-
},
|
|
946
|
-
[handleStart]
|
|
947
|
-
);
|
|
948
|
-
return {
|
|
949
|
-
position,
|
|
950
|
-
isDragging,
|
|
951
|
-
dragRef,
|
|
952
|
-
handleMouseDown,
|
|
953
|
-
handleTouchStart
|
|
954
|
-
};
|
|
955
|
-
}
|
|
848
|
+
// call-control-sdk/lib/components/dialog.tsx
|
|
849
|
+
var import_icons_material = require("@mui/icons-material");
|
|
850
|
+
var import_material3 = require("@mui/material");
|
|
851
|
+
var import_react9 = require("react");
|
|
956
852
|
|
|
957
853
|
// call-control-sdk/lib/hooks/useSDKState.ts
|
|
958
|
-
var
|
|
854
|
+
var import_react6 = require("react");
|
|
959
855
|
function useSDKState() {
|
|
960
|
-
const [state, setState] = (0,
|
|
961
|
-
(0,
|
|
856
|
+
const [state, setState] = (0, import_react6.useState)(sdkStateManager.getState());
|
|
857
|
+
(0, import_react6.useEffect)(() => {
|
|
962
858
|
const unsubscribe = sdkStateManager.subscribe(() => {
|
|
963
859
|
setState(sdkStateManager.getState());
|
|
964
860
|
});
|
|
@@ -968,22 +864,22 @@ function useSDKState() {
|
|
|
968
864
|
}
|
|
969
865
|
|
|
970
866
|
// call-control-sdk/lib/services/request.ts
|
|
971
|
-
var
|
|
867
|
+
var import_react8 = require("react");
|
|
972
868
|
|
|
973
869
|
// call-control-sdk/lib/services/toastMessage.tsx
|
|
974
|
-
var
|
|
870
|
+
var import_react7 = require("react");
|
|
975
871
|
var import_material = require("@mui/material");
|
|
976
872
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
977
|
-
var ToastContext = (0,
|
|
873
|
+
var ToastContext = (0, import_react7.createContext)(void 0);
|
|
978
874
|
var useToast = () => {
|
|
979
|
-
const ctx = (0,
|
|
875
|
+
const ctx = (0, import_react7.useContext)(ToastContext);
|
|
980
876
|
if (!ctx) throw new Error("useToast must be used inside ToastProvider");
|
|
981
877
|
return ctx;
|
|
982
878
|
};
|
|
983
879
|
var ToastProvider = ({ children }) => {
|
|
984
|
-
const [open, setOpen] = (0,
|
|
985
|
-
const [message, setMessage] = (0,
|
|
986
|
-
const [severity, setSeverity] = (0,
|
|
880
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
881
|
+
const [message, setMessage] = (0, import_react7.useState)("");
|
|
882
|
+
const [severity, setSeverity] = (0, import_react7.useState)("info");
|
|
987
883
|
const showToast = (msg, sev = "info") => {
|
|
988
884
|
setMessage(msg);
|
|
989
885
|
setSeverity(sev);
|
|
@@ -1051,8 +947,8 @@ var reducer = (state, action) => {
|
|
|
1051
947
|
var useGetRequest = (props = {}) => {
|
|
1052
948
|
const { onSuccess = null, onError = null } = props;
|
|
1053
949
|
const { showToast } = useToast();
|
|
1054
|
-
const [state, dispatch] = (0,
|
|
1055
|
-
const getRequest = (0,
|
|
950
|
+
const [state, dispatch] = (0, import_react8.useReducer)(reducer, initialState);
|
|
951
|
+
const getRequest = (0, import_react8.useCallback)(
|
|
1056
952
|
(url, config = {}) => {
|
|
1057
953
|
dispatch({
|
|
1058
954
|
type: "isLoading",
|
|
@@ -1104,8 +1000,8 @@ var useGetRequest = (props = {}) => {
|
|
|
1104
1000
|
var usePostRequest = (props = {}) => {
|
|
1105
1001
|
const { onSuccess = null, onError = null, disabledSuccessToast = false } = props;
|
|
1106
1002
|
const { showToast } = useToast();
|
|
1107
|
-
const [state, dispatch] = (0,
|
|
1108
|
-
const postRequest = (0,
|
|
1003
|
+
const [state, dispatch] = (0, import_react8.useReducer)(reducer, initialState);
|
|
1004
|
+
const postRequest = (0, import_react8.useCallback)(
|
|
1109
1005
|
(url, payload, config = {}) => {
|
|
1110
1006
|
dispatch({
|
|
1111
1007
|
type: "isLoading",
|
|
@@ -1149,11 +1045,6 @@ var usePostRequest = (props = {}) => {
|
|
|
1149
1045
|
return [postRequest, state];
|
|
1150
1046
|
};
|
|
1151
1047
|
|
|
1152
|
-
// call-control-sdk/lib/components/dialog.tsx
|
|
1153
|
-
var import_icons_material = require("@mui/icons-material");
|
|
1154
|
-
var import_material3 = require("@mui/material");
|
|
1155
|
-
var import_react10 = require("react");
|
|
1156
|
-
|
|
1157
1048
|
// call-control-sdk/lib/components/styles.ts
|
|
1158
1049
|
var import_material2 = require("@mui/material");
|
|
1159
1050
|
var useStyles = ({
|
|
@@ -1221,19 +1112,19 @@ var styles_default = useStyles;
|
|
|
1221
1112
|
// call-control-sdk/lib/components/dialog.tsx
|
|
1222
1113
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1223
1114
|
var ConferenceTableRow = ({ each }) => {
|
|
1224
|
-
var _a2, _b, _c, _d, _e;
|
|
1115
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
1225
1116
|
const state = useSDKState();
|
|
1117
|
+
const theme = (0, import_material3.useTheme)();
|
|
1226
1118
|
const { showToast } = useToast();
|
|
1227
1119
|
const { disabled, enabled, outlined } = styles_default({
|
|
1228
1120
|
disabled: ((_a2 = state.sdkConfig) == null ? void 0 : _a2.disabled) || {},
|
|
1229
1121
|
enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
|
|
1230
1122
|
outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
|
|
1231
1123
|
});
|
|
1232
|
-
const
|
|
1233
|
-
const [
|
|
1234
|
-
const [
|
|
1235
|
-
const [
|
|
1236
|
-
const [conferenceCallEnd, setConferenceCallEnd] = (0, import_react10.useState)(false);
|
|
1124
|
+
const [conferenceCallStart, setConferenceCallStart] = (0, import_react9.useState)(false);
|
|
1125
|
+
const [conferenceCallMerge, setConferenceCallMerge] = (0, import_react9.useState)(false);
|
|
1126
|
+
const [conferenceCallHoldOrUnHold, setConferenceCallHoldOrUnHold] = (0, import_react9.useState)(false);
|
|
1127
|
+
const [conferenceCallEnd, setConferenceCallEnd] = (0, import_react9.useState)(false);
|
|
1237
1128
|
const onConferenceLineUpdate = (line, data) => {
|
|
1238
1129
|
sdkStateManager.setConferenceLine(__spreadValues(__spreadValues({}, line), data));
|
|
1239
1130
|
};
|
|
@@ -1242,7 +1133,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1242
1133
|
const line_used = __spreadValues(__spreadValues({}, line), data);
|
|
1243
1134
|
setConferenceCallStart(true);
|
|
1244
1135
|
const payload = {
|
|
1245
|
-
action: "
|
|
1136
|
+
action: "EXTERNAL_CONFERENCE",
|
|
1246
1137
|
operation: `CALL${line_used.line}`,
|
|
1247
1138
|
line_used: String(line_used.line),
|
|
1248
1139
|
thirdparty_no: line_used.phone,
|
|
@@ -1335,20 +1226,12 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1335
1226
|
setConferenceCallEnd(false);
|
|
1336
1227
|
});
|
|
1337
1228
|
};
|
|
1338
|
-
const [holdOrUnHold] = usePostRequest(
|
|
1339
|
-
|
|
1340
|
-
sdkStateManager.setHolding(!state.isHolding);
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1343
|
-
const [muteOrUnMute] = usePostRequest({
|
|
1344
|
-
onSuccess: () => {
|
|
1345
|
-
sdkStateManager.setMuted(!state.isMuted);
|
|
1346
|
-
}
|
|
1347
|
-
});
|
|
1229
|
+
const [holdOrUnHold] = usePostRequest();
|
|
1230
|
+
const [muteOrUnMute] = usePostRequest();
|
|
1348
1231
|
const handleHoldToggle = () => {
|
|
1349
1232
|
var _a3;
|
|
1350
1233
|
const payload = {
|
|
1351
|
-
action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" : "HOLD"
|
|
1234
|
+
action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" /* UNHOLD */ : "HOLD" /* HOLD */,
|
|
1352
1235
|
userId: state.agentId
|
|
1353
1236
|
};
|
|
1354
1237
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
@@ -1356,7 +1239,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1356
1239
|
const handleMuteToggle = () => {
|
|
1357
1240
|
var _a3;
|
|
1358
1241
|
const payload = {
|
|
1359
|
-
action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" : "MUTE"
|
|
1242
|
+
action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" /* UNMUTE */ : "MUTE" /* MUTE */,
|
|
1360
1243
|
userId: state.agentId
|
|
1361
1244
|
};
|
|
1362
1245
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
@@ -1418,7 +1301,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1418
1301
|
placeholder: "Phone Number",
|
|
1419
1302
|
fullWidth: true,
|
|
1420
1303
|
value: (each == null ? void 0 : each.phone) || "",
|
|
1421
|
-
disabled: (each == null ? void 0 : each.line) === 1 ||
|
|
1304
|
+
disabled: (each == null ? void 0 : each.line) === 1 || ["ONCALL" /* ONCALL */, "DISCONNECTED" /* DISCONNECTED */, "CONFERENCE" /* CONFERENCE */, "HOLD" /* HOLD */, "MUTE" /* MUTE */, "DIALING" /* DIALING */, "RINGING" /* RINGING */].includes((_f = each == null ? void 0 : each.status) != null ? _f : ""),
|
|
1422
1305
|
onChange: (e) => {
|
|
1423
1306
|
onConferenceLineUpdate(each, { phone: e.target.value });
|
|
1424
1307
|
}
|
|
@@ -1431,7 +1314,6 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1431
1314
|
{
|
|
1432
1315
|
sx: {
|
|
1433
1316
|
padding: "6px",
|
|
1434
|
-
// width: "200px",
|
|
1435
1317
|
flex: 1
|
|
1436
1318
|
},
|
|
1437
1319
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -1445,20 +1327,20 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1445
1327
|
gap: "10px"
|
|
1446
1328
|
},
|
|
1447
1329
|
children: [
|
|
1448
|
-
(each == null ? void 0 : each.line) === 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1330
|
+
(each == null ? void 0 : each.line) === 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1449
1331
|
import_material3.Button,
|
|
1450
1332
|
{
|
|
1451
|
-
variant: (each == null ? void 0 : each.status) === "HOLD" ? "contained" : "outlined",
|
|
1452
|
-
sx: (each == null ? void 0 : each.status) === "CONFERENCE" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
1333
|
+
variant: (each == null ? void 0 : each.status) === "HOLD" /* HOLD */ ? "contained" : "outlined",
|
|
1334
|
+
sx: (each == null ? void 0 : each.status) === "CONFERENCE" /* CONFERENCE */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
1453
1335
|
onClick: () => {
|
|
1454
|
-
if (each.status === "HOLD") {
|
|
1336
|
+
if (each.status === "HOLD" /* HOLD */) {
|
|
1455
1337
|
onHoldOrUnHoldConferenceCall(each, { isHold: false }, "UNHOLDUSER");
|
|
1456
1338
|
} else {
|
|
1457
1339
|
onHoldOrUnHoldConferenceCall(each, { isHold: true }, "HOLDUSER");
|
|
1458
1340
|
}
|
|
1459
1341
|
},
|
|
1460
|
-
disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" && (each == null ? void 0 : each.status) !== "HOLD" || conferenceCallHoldOrUnHold,
|
|
1461
|
-
children: each.status === "HOLD" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1342
|
+
disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" /* CONFERENCE */ && (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ || conferenceCallHoldOrUnHold,
|
|
1343
|
+
children: each.status === "HOLD" /* HOLD */ ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1462
1344
|
import_material3.Box,
|
|
1463
1345
|
{
|
|
1464
1346
|
sx: {
|
|
@@ -1475,7 +1357,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1475
1357
|
variant: "body2",
|
|
1476
1358
|
sx: {
|
|
1477
1359
|
fontSize: "12px",
|
|
1478
|
-
color: each.status === "HOLD" ? "#fff" : "initial"
|
|
1360
|
+
color: each.status === "HOLD" /* HOLD */ ? "#fff" : "initial"
|
|
1479
1361
|
},
|
|
1480
1362
|
children: "Unhold"
|
|
1481
1363
|
}
|
|
@@ -1507,7 +1389,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1507
1389
|
{
|
|
1508
1390
|
variant: "body2",
|
|
1509
1391
|
sx: {
|
|
1510
|
-
color: each.status === "HOLD" ? "#fff" : "#000",
|
|
1392
|
+
color: each.status === "HOLD" /* HOLD */ ? "#fff" : "#000",
|
|
1511
1393
|
fontSize: "12px"
|
|
1512
1394
|
},
|
|
1513
1395
|
children: "Hold"
|
|
@@ -1530,9 +1412,9 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1530
1412
|
(each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1531
1413
|
import_material3.Button,
|
|
1532
1414
|
{
|
|
1533
|
-
variant: (each == null ? void 0 : each.status) !== "IDLE" ? "outlined" : "contained",
|
|
1415
|
+
variant: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? "outlined" : "contained",
|
|
1534
1416
|
color: "success",
|
|
1535
|
-
sx: (each == null ? void 0 : each.status) !== "IDLE" ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
|
|
1417
|
+
sx: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? __spreadValues({}, disabled) : __spreadProps(__spreadValues({}, enabled), {
|
|
1536
1418
|
border: `0px solid ${theme.palette.success.light}`,
|
|
1537
1419
|
"&:hover": {
|
|
1538
1420
|
bgcolor: "success.light",
|
|
@@ -1547,7 +1429,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1547
1429
|
onClick: () => {
|
|
1548
1430
|
onConferenceCallStart(each, {});
|
|
1549
1431
|
},
|
|
1550
|
-
disabled: (each == null ? void 0 : each.status) !== "IDLE"
|
|
1432
|
+
disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */,
|
|
1551
1433
|
children: conferenceCallStart ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1552
1434
|
import_material3.CircularProgress,
|
|
1553
1435
|
{
|
|
@@ -1558,7 +1440,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1558
1440
|
import_icons_material.Call,
|
|
1559
1441
|
{
|
|
1560
1442
|
sx: {
|
|
1561
|
-
color: (each == null ? void 0 : each.status) !== "IDLE" ? "default" : "#f3f2f2"
|
|
1443
|
+
color: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ ? "default" : "#f3f2f2"
|
|
1562
1444
|
}
|
|
1563
1445
|
}
|
|
1564
1446
|
)
|
|
@@ -1567,34 +1449,30 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1567
1449
|
(each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "Merge Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1568
1450
|
import_material3.Button,
|
|
1569
1451
|
{
|
|
1570
|
-
variant: (each == null ? void 0 : each.status) === "ONCALL" ? "contained" : "outlined",
|
|
1571
|
-
sx: (each == null ? void 0 : each.status) === "ONCALL" ? __spreadValues({}, enabled) : __spreadValues({}, disabled),
|
|
1452
|
+
variant: (each == null ? void 0 : each.status) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
|
|
1453
|
+
sx: (each == null ? void 0 : each.status) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : __spreadValues({}, disabled),
|
|
1572
1454
|
onClick: () => {
|
|
1573
1455
|
onMergeConferenceCall(each, {
|
|
1574
1456
|
isMergeCall: true
|
|
1575
1457
|
});
|
|
1576
1458
|
},
|
|
1577
|
-
disabled: (each == null ? void 0 : each.status) !== "ONCALL"
|
|
1459
|
+
disabled: (each == null ? void 0 : each.status) !== "ONCALL" /* ONCALL */,
|
|
1578
1460
|
children: conferenceCallMerge ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.CircularProgress, { size: "20px" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.CallSplit, {})
|
|
1579
1461
|
}
|
|
1580
1462
|
) }),
|
|
1581
|
-
(each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1463
|
+
(each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ ? "Hold" : "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1582
1464
|
import_material3.Button,
|
|
1583
1465
|
{
|
|
1584
|
-
variant: (each == null ? void 0 : each.status) === "HOLD" ? "contained" : "outlined",
|
|
1585
|
-
sx: (each == null ? void 0 : each.status) === "CONFERENCE" ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
1466
|
+
variant: (each == null ? void 0 : each.status) === "HOLD" /* HOLD */ ? "contained" : "outlined",
|
|
1467
|
+
sx: (each == null ? void 0 : each.status) === "CONFERENCE" /* CONFERENCE */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
1586
1468
|
onClick: () => {
|
|
1587
|
-
if (each.status === "HOLD") {
|
|
1469
|
+
if (each.status === "HOLD" /* HOLD */) {
|
|
1588
1470
|
onHoldOrUnHoldConferenceCall(each, { isHold: false }, "UNHOLDUSER");
|
|
1589
1471
|
} else {
|
|
1590
1472
|
onHoldOrUnHoldConferenceCall(each, { isHold: true }, "HOLDUSER");
|
|
1591
1473
|
}
|
|
1592
1474
|
},
|
|
1593
|
-
disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" && (each == null ? void 0 : each.status) !== "HOLD"
|
|
1594
|
-
// each?.status === "ONCALL" ||
|
|
1595
|
-
// each?.status === "DIALING" ||
|
|
1596
|
-
// each?.status === "RINGING" ||
|
|
1597
|
-
conferenceCallHoldOrUnHold,
|
|
1475
|
+
disabled: (each == null ? void 0 : each.status) !== "CONFERENCE" /* CONFERENCE */ && (each == null ? void 0 : each.status) !== "HOLD" /* HOLD */ || conferenceCallHoldOrUnHold,
|
|
1598
1476
|
children: conferenceCallHoldOrUnHold ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1599
1477
|
import_material3.CircularProgress,
|
|
1600
1478
|
{
|
|
@@ -1603,15 +1481,15 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1603
1481
|
color: theme.palette.primary.main
|
|
1604
1482
|
}
|
|
1605
1483
|
}
|
|
1606
|
-
) : each.status === "HOLD" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Pause, {})
|
|
1484
|
+
) : each.status === "HOLD" /* HOLD */ ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.Pause, {})
|
|
1607
1485
|
}
|
|
1608
1486
|
) }),
|
|
1609
1487
|
(each == null ? void 0 : each.line) !== 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1610
1488
|
import_material3.Button,
|
|
1611
1489
|
{
|
|
1612
|
-
variant: (each == null ? void 0 : each.status) !== "IDLE" && (each == null ? void 0 : each.status) !== "DISCONNECTED" ? "contained" : "outlined",
|
|
1490
|
+
variant: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ && (each == null ? void 0 : each.status) !== "DISCONNECTED" /* DISCONNECTED */ ? "contained" : "outlined",
|
|
1613
1491
|
color: "error",
|
|
1614
|
-
sx: (each == null ? void 0 : each.status) !== "IDLE" && (each == null ? void 0 : each.status) !== "DISCONNECTED" ? __spreadProps(__spreadValues({}, enabled), {
|
|
1492
|
+
sx: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ && (each == null ? void 0 : each.status) !== "DISCONNECTED" /* DISCONNECTED */ ? __spreadProps(__spreadValues({}, enabled), {
|
|
1615
1493
|
border: `0px solid ${theme.palette.error.light}`,
|
|
1616
1494
|
"&:hover": {
|
|
1617
1495
|
bgcolor: "error.light",
|
|
@@ -1631,7 +1509,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1631
1509
|
isHold: false
|
|
1632
1510
|
});
|
|
1633
1511
|
},
|
|
1634
|
-
disabled: (each == null ? void 0 : each.status) === "IDLE" || (each == null ? void 0 : each.status) === "DISCONNECTED" || conferenceCallEnd,
|
|
1512
|
+
disabled: (each == null ? void 0 : each.status) === "IDLE" /* IDLE */ || (each == null ? void 0 : each.status) === "DISCONNECTED" /* DISCONNECTED */ || conferenceCallEnd,
|
|
1635
1513
|
children: conferenceCallEnd ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1636
1514
|
import_material3.CircularProgress,
|
|
1637
1515
|
{
|
|
@@ -1655,7 +1533,7 @@ function ConferenceDialog() {
|
|
|
1655
1533
|
var _a2;
|
|
1656
1534
|
const state = useSDKState();
|
|
1657
1535
|
const { showToast } = useToast();
|
|
1658
|
-
const [conferenceCallEndAll, setConferenceCallEndAll] = (0,
|
|
1536
|
+
const [conferenceCallEndAll, setConferenceCallEndAll] = (0, import_react9.useState)(false);
|
|
1659
1537
|
const handleClose = () => {
|
|
1660
1538
|
sdkStateManager.setOpenConferenceDialog(false);
|
|
1661
1539
|
};
|
|
@@ -1858,7 +1736,7 @@ function CallTransferDialog({ open }) {
|
|
|
1858
1736
|
sdkStateManager.setOpenCallTransferDialog(false);
|
|
1859
1737
|
}
|
|
1860
1738
|
});
|
|
1861
|
-
const [currentselecteTab, setCurrentselecteTab] = (0,
|
|
1739
|
+
const [currentselecteTab, setCurrentselecteTab] = (0, import_react9.useState)("process");
|
|
1862
1740
|
const [getIdelAgentsList, { data: idleAgentsList, isLoading: isIdleAgentsListLoading }] = usePostRequest({
|
|
1863
1741
|
disabledSuccessToast: true
|
|
1864
1742
|
});
|
|
@@ -1908,7 +1786,7 @@ function CallTransferDialog({ open }) {
|
|
|
1908
1786
|
transferCall(END_POINT.TRANSFER_CALL, payload);
|
|
1909
1787
|
}
|
|
1910
1788
|
};
|
|
1911
|
-
(0,
|
|
1789
|
+
(0, import_react9.useEffect)(() => {
|
|
1912
1790
|
getIdelAgentsList(END_POINT.AGENTS_LIST, {
|
|
1913
1791
|
status: "IDLE",
|
|
1914
1792
|
active: true
|
|
@@ -2241,7 +2119,7 @@ function CallTransferDialog({ open }) {
|
|
|
2241
2119
|
function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
2242
2120
|
var _a2, _b, _c, _d, _e;
|
|
2243
2121
|
const [getDispositions, data] = useGetRequest();
|
|
2244
|
-
const [formData, setFormData] = (0,
|
|
2122
|
+
const [formData, setFormData] = (0, import_react9.useState)({
|
|
2245
2123
|
disposition: { label: "Resolved", value: "RES" },
|
|
2246
2124
|
followUp: { label: "No", value: "N" },
|
|
2247
2125
|
callbackDate: "",
|
|
@@ -2270,10 +2148,10 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2270
2148
|
handleReset();
|
|
2271
2149
|
setOpen(false);
|
|
2272
2150
|
};
|
|
2273
|
-
(0,
|
|
2151
|
+
(0, import_react9.useEffect)(() => {
|
|
2274
2152
|
getDispositions(END_POINT.DISPOSITIONS);
|
|
2275
2153
|
}, []);
|
|
2276
|
-
const dispositionsOptions = (0,
|
|
2154
|
+
const dispositionsOptions = (0, import_react9.useMemo)(() => {
|
|
2277
2155
|
var _a3, _b2;
|
|
2278
2156
|
return ((_b2 = (_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.data) == null ? void 0 : _b2.map((item) => ({
|
|
2279
2157
|
label: item.name,
|
|
@@ -2626,6 +2504,147 @@ function CallHistoryDialog({ open, setOpen }) {
|
|
|
2626
2504
|
) });
|
|
2627
2505
|
}
|
|
2628
2506
|
|
|
2507
|
+
// call-control-sdk/lib/hooks/useDraggable.ts
|
|
2508
|
+
var import_react10 = require("react");
|
|
2509
|
+
function useDraggable(initialPosition, onPositionChange) {
|
|
2510
|
+
const [position, setPosition] = (0, import_react10.useState)(initialPosition);
|
|
2511
|
+
const [isDragging, setIsDragging] = (0, import_react10.useState)(false);
|
|
2512
|
+
const dragRef = (0, import_react10.useRef)();
|
|
2513
|
+
const dragStart = (0, import_react10.useRef)({ x: 0, y: 0 });
|
|
2514
|
+
const elementStart = (0, import_react10.useRef)({ x: 0, y: 0 });
|
|
2515
|
+
const updatePosition = (0, import_react10.useCallback)(
|
|
2516
|
+
(newPosition) => {
|
|
2517
|
+
const element = dragRef.current;
|
|
2518
|
+
if (!element) return;
|
|
2519
|
+
const rect = element.getBoundingClientRect();
|
|
2520
|
+
const viewportWidth = window.innerWidth;
|
|
2521
|
+
const viewportHeight = window.innerHeight;
|
|
2522
|
+
const constrainedPosition = {
|
|
2523
|
+
x: Math.max(0, Math.min(newPosition.x, viewportWidth - rect.width)),
|
|
2524
|
+
y: Math.max(0, Math.min(newPosition.y, viewportHeight - rect.height))
|
|
2525
|
+
};
|
|
2526
|
+
setPosition(constrainedPosition);
|
|
2527
|
+
onPositionChange == null ? void 0 : onPositionChange(constrainedPosition);
|
|
2528
|
+
},
|
|
2529
|
+
[onPositionChange]
|
|
2530
|
+
);
|
|
2531
|
+
const handleStart = (0, import_react10.useCallback)(
|
|
2532
|
+
(clientX, clientY) => {
|
|
2533
|
+
setIsDragging(true);
|
|
2534
|
+
dragStart.current = { x: clientX, y: clientY };
|
|
2535
|
+
elementStart.current = position;
|
|
2536
|
+
const handleMove = (moveClientX, moveClientY) => {
|
|
2537
|
+
const deltaX = moveClientX - dragStart.current.x;
|
|
2538
|
+
const deltaY = moveClientY - dragStart.current.y;
|
|
2539
|
+
updatePosition({
|
|
2540
|
+
x: elementStart.current.x + deltaX,
|
|
2541
|
+
y: elementStart.current.y + deltaY
|
|
2542
|
+
});
|
|
2543
|
+
};
|
|
2544
|
+
const handleMouseMove = (e) => {
|
|
2545
|
+
e.preventDefault();
|
|
2546
|
+
handleMove(e.clientX, e.clientY);
|
|
2547
|
+
};
|
|
2548
|
+
const handleTouchMove = (e) => {
|
|
2549
|
+
e.preventDefault();
|
|
2550
|
+
const touch = e.touches[0];
|
|
2551
|
+
if (touch) {
|
|
2552
|
+
handleMove(touch.clientX, touch.clientY);
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
const handleEnd = () => {
|
|
2556
|
+
setIsDragging(false);
|
|
2557
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2558
|
+
document.removeEventListener("mouseup", handleEnd);
|
|
2559
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
2560
|
+
document.removeEventListener("touchend", handleEnd);
|
|
2561
|
+
};
|
|
2562
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
2563
|
+
document.addEventListener("mouseup", handleEnd);
|
|
2564
|
+
document.addEventListener("touchmove", handleTouchMove, {
|
|
2565
|
+
passive: false
|
|
2566
|
+
});
|
|
2567
|
+
document.addEventListener("touchend", handleEnd);
|
|
2568
|
+
},
|
|
2569
|
+
[position, updatePosition]
|
|
2570
|
+
);
|
|
2571
|
+
const handleMouseDown = (0, import_react10.useCallback)(
|
|
2572
|
+
(e) => {
|
|
2573
|
+
e.preventDefault();
|
|
2574
|
+
handleStart(e.clientX, e.clientY);
|
|
2575
|
+
},
|
|
2576
|
+
[handleStart]
|
|
2577
|
+
);
|
|
2578
|
+
const handleTouchStart = (0, import_react10.useCallback)(
|
|
2579
|
+
(e) => {
|
|
2580
|
+
e.preventDefault();
|
|
2581
|
+
const touch = e.touches[0];
|
|
2582
|
+
if (touch) {
|
|
2583
|
+
handleStart(touch.clientX, touch.clientY);
|
|
2584
|
+
}
|
|
2585
|
+
},
|
|
2586
|
+
[handleStart]
|
|
2587
|
+
);
|
|
2588
|
+
return {
|
|
2589
|
+
position,
|
|
2590
|
+
isDragging,
|
|
2591
|
+
dragRef,
|
|
2592
|
+
handleMouseDown,
|
|
2593
|
+
handleTouchStart
|
|
2594
|
+
};
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
// call-control-sdk/lib/services/micController.ts
|
|
2598
|
+
function createMicController(constraints = { audio: true }) {
|
|
2599
|
+
let stream = null;
|
|
2600
|
+
let muted = false;
|
|
2601
|
+
async function start() {
|
|
2602
|
+
if (stream) return;
|
|
2603
|
+
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
2604
|
+
stream.getAudioTracks().forEach((track) => track.enabled = true);
|
|
2605
|
+
muted = false;
|
|
2606
|
+
}
|
|
2607
|
+
function setEnabled(enabled) {
|
|
2608
|
+
if (!stream) return;
|
|
2609
|
+
stream.getAudioTracks().forEach((track) => track.enabled = enabled);
|
|
2610
|
+
muted = !enabled;
|
|
2611
|
+
}
|
|
2612
|
+
function mute() {
|
|
2613
|
+
setEnabled(false);
|
|
2614
|
+
}
|
|
2615
|
+
function unmute() {
|
|
2616
|
+
setEnabled(true);
|
|
2617
|
+
}
|
|
2618
|
+
function toggleMute() {
|
|
2619
|
+
if (muted) {
|
|
2620
|
+
unmute();
|
|
2621
|
+
} else {
|
|
2622
|
+
mute();
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
function stop() {
|
|
2626
|
+
if (!stream) return;
|
|
2627
|
+
stream.getTracks().forEach((t) => t.stop());
|
|
2628
|
+
stream = null;
|
|
2629
|
+
muted = false;
|
|
2630
|
+
}
|
|
2631
|
+
function isMuted() {
|
|
2632
|
+
return muted;
|
|
2633
|
+
}
|
|
2634
|
+
function getStream() {
|
|
2635
|
+
return stream;
|
|
2636
|
+
}
|
|
2637
|
+
return {
|
|
2638
|
+
start,
|
|
2639
|
+
stop,
|
|
2640
|
+
mute,
|
|
2641
|
+
unmute,
|
|
2642
|
+
toggleMute,
|
|
2643
|
+
isMuted,
|
|
2644
|
+
getStream
|
|
2645
|
+
};
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2629
2648
|
// call-control-sdk/lib/utils/audioLoader.ts
|
|
2630
2649
|
var import_incoming = __toESM(require("./incoming-4WP3FJI4.mp3"));
|
|
2631
2650
|
var audioBlobUrl = null;
|
|
@@ -2703,57 +2722,6 @@ function cleanupAudioResources() {
|
|
|
2703
2722
|
audioBuffer = null;
|
|
2704
2723
|
}
|
|
2705
2724
|
|
|
2706
|
-
// call-control-sdk/lib/services/micController.ts
|
|
2707
|
-
function createMicController(constraints = { audio: true }) {
|
|
2708
|
-
let stream = null;
|
|
2709
|
-
let muted = false;
|
|
2710
|
-
async function start() {
|
|
2711
|
-
if (stream) return;
|
|
2712
|
-
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
2713
|
-
stream.getAudioTracks().forEach((track) => track.enabled = true);
|
|
2714
|
-
muted = false;
|
|
2715
|
-
}
|
|
2716
|
-
function setEnabled(enabled) {
|
|
2717
|
-
if (!stream) return;
|
|
2718
|
-
stream.getAudioTracks().forEach((track) => track.enabled = enabled);
|
|
2719
|
-
muted = !enabled;
|
|
2720
|
-
}
|
|
2721
|
-
function mute() {
|
|
2722
|
-
setEnabled(false);
|
|
2723
|
-
}
|
|
2724
|
-
function unmute() {
|
|
2725
|
-
setEnabled(true);
|
|
2726
|
-
}
|
|
2727
|
-
function toggleMute() {
|
|
2728
|
-
if (muted) {
|
|
2729
|
-
unmute();
|
|
2730
|
-
} else {
|
|
2731
|
-
mute();
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
function stop() {
|
|
2735
|
-
if (!stream) return;
|
|
2736
|
-
stream.getTracks().forEach((t) => t.stop());
|
|
2737
|
-
stream = null;
|
|
2738
|
-
muted = false;
|
|
2739
|
-
}
|
|
2740
|
-
function isMuted() {
|
|
2741
|
-
return muted;
|
|
2742
|
-
}
|
|
2743
|
-
function getStream() {
|
|
2744
|
-
return stream;
|
|
2745
|
-
}
|
|
2746
|
-
return {
|
|
2747
|
-
start,
|
|
2748
|
-
stop,
|
|
2749
|
-
mute,
|
|
2750
|
-
unmute,
|
|
2751
|
-
toggleMute,
|
|
2752
|
-
isMuted,
|
|
2753
|
-
getStream
|
|
2754
|
-
};
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
2725
|
// call-control-sdk/lib/components/callControls.tsx
|
|
2758
2726
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2759
2727
|
var getCombineConfrenceData = (localState, apiData) => {
|
|
@@ -2785,7 +2753,7 @@ var formatDuration = (seconds) => {
|
|
|
2785
2753
|
return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
2786
2754
|
};
|
|
2787
2755
|
function CallControls({ onDataChange }) {
|
|
2788
|
-
var _a2, _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, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va
|
|
2756
|
+
var _a2, _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, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va;
|
|
2789
2757
|
const theme = (0, import_material4.useTheme)();
|
|
2790
2758
|
const state = useSDKState();
|
|
2791
2759
|
const { showToast } = useToast();
|
|
@@ -2804,10 +2772,10 @@ function CallControls({ onDataChange }) {
|
|
|
2804
2772
|
const baseReconnectDelay = 2e3;
|
|
2805
2773
|
const maxReconnectDelay = 3e4;
|
|
2806
2774
|
const [anchorEl, setAnchorEl] = (0, import_react11.useState)(null);
|
|
2807
|
-
const [showIframe, setShowIframe] = (0, import_react11.useState)(true);
|
|
2808
2775
|
const [statusAnchorEl, setStatusAnchorEl] = (0, import_react11.useState)(null);
|
|
2809
2776
|
const [dialerAnchorEl, setDialerAnchorEl] = (0, import_react11.useState)(null);
|
|
2810
2777
|
const [ambulanceAnchorEl, setAmbulanceAnchorEl] = (0, import_react11.useState)(null);
|
|
2778
|
+
const [showIframe, setShowIframe] = (0, import_react11.useState)(true);
|
|
2811
2779
|
const [openCallDisposition, setOpenCallDisposition] = (0, import_react11.useState)(false);
|
|
2812
2780
|
const [openProcessorDialog, setOpenProcessorDialog] = (0, import_react11.useState)(false);
|
|
2813
2781
|
const [openCallHistoryDialog, setOpenCallHistoryDialog] = (0, import_react11.useState)(false);
|
|
@@ -2836,20 +2804,22 @@ function CallControls({ onDataChange }) {
|
|
|
2836
2804
|
}
|
|
2837
2805
|
});
|
|
2838
2806
|
const [holdOrUnHold, { isLoading: holdOrUnHoldLoading }] = usePostRequest({
|
|
2839
|
-
onSuccess: () => {
|
|
2840
|
-
|
|
2841
|
-
}
|
|
2807
|
+
// onSuccess: () => {
|
|
2808
|
+
// sdkStateManager.setHolding(!state.isHolding);
|
|
2809
|
+
// },
|
|
2842
2810
|
});
|
|
2843
2811
|
const [muteOrUnMute, { isLoading: muteOrUnMuteLoading }] = usePostRequest({
|
|
2844
|
-
onSuccess: () => {
|
|
2845
|
-
|
|
2846
|
-
}
|
|
2812
|
+
// onSuccess: () => {
|
|
2813
|
+
// sdkStateManager.setMuted(!state.isMuted);
|
|
2814
|
+
// },
|
|
2847
2815
|
});
|
|
2848
2816
|
const [readyAgentStatus, { isLoading: agentReadyLoading }] = usePostRequest();
|
|
2849
2817
|
const [updateAgentStatus, { isLoading }] = usePostRequest();
|
|
2850
2818
|
const [sendNotification] = usePostRequest();
|
|
2851
2819
|
const [endCall, { isLoading: endCallLoading }] = usePostRequest({
|
|
2852
2820
|
onSuccess: () => {
|
|
2821
|
+
sdkStateManager.endCall();
|
|
2822
|
+
setOpenCallDisposition(false);
|
|
2853
2823
|
sdkStateManager.resetConferenceLines();
|
|
2854
2824
|
}
|
|
2855
2825
|
});
|
|
@@ -2859,15 +2829,11 @@ function CallControls({ onDataChange }) {
|
|
|
2859
2829
|
const handleOpenDialer = (event) => {
|
|
2860
2830
|
setShowIframe(true);
|
|
2861
2831
|
setDialerAnchorEl(event.currentTarget);
|
|
2862
|
-
sdkStateManager.setStatus("dial");
|
|
2863
2832
|
};
|
|
2864
2833
|
const handleOpenAbulanceServices = (event) => {
|
|
2865
2834
|
setAmbulanceAnchorEl(event.currentTarget);
|
|
2866
2835
|
};
|
|
2867
2836
|
const handleCloseDialer = () => {
|
|
2868
|
-
if (state.status !== "on call") {
|
|
2869
|
-
sdkStateManager.setStatus("idle");
|
|
2870
|
-
}
|
|
2871
2837
|
setDialerAnchorEl(null);
|
|
2872
2838
|
};
|
|
2873
2839
|
const handleCloseAmbulance = () => {
|
|
@@ -2912,7 +2878,7 @@ function CallControls({ onDataChange }) {
|
|
|
2912
2878
|
const handleHoldToggle = () => {
|
|
2913
2879
|
var _a3;
|
|
2914
2880
|
const payload = {
|
|
2915
|
-
action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" : "HOLD"
|
|
2881
|
+
action: ((_a3 = state.callData) == null ? void 0 : _a3.hold) === 1 ? "UNHOLD" /* UNHOLD */ : "HOLD" /* HOLD */,
|
|
2916
2882
|
userId: state.agentId
|
|
2917
2883
|
};
|
|
2918
2884
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
@@ -2920,7 +2886,7 @@ function CallControls({ onDataChange }) {
|
|
|
2920
2886
|
const handleMuteToggle = () => {
|
|
2921
2887
|
var _a3;
|
|
2922
2888
|
const payload = {
|
|
2923
|
-
action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" : "MUTE"
|
|
2889
|
+
action: ((_a3 = state.callData) == null ? void 0 : _a3.mute) === 1 ? "UNMUTE" /* UNMUTE */ : "MUTE" /* MUTE */,
|
|
2924
2890
|
userId: state.agentId
|
|
2925
2891
|
};
|
|
2926
2892
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
@@ -2947,8 +2913,6 @@ function CallControls({ onDataChange }) {
|
|
|
2947
2913
|
isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
|
|
2948
2914
|
}
|
|
2949
2915
|
});
|
|
2950
|
-
sdkStateManager.endCall();
|
|
2951
|
-
setOpenCallDisposition(false);
|
|
2952
2916
|
};
|
|
2953
2917
|
(0, import_react11.useEffect)(() => {
|
|
2954
2918
|
const handleBeforeUnload = (e) => {
|
|
@@ -2969,14 +2933,14 @@ function CallControls({ onDataChange }) {
|
|
|
2969
2933
|
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
2970
2934
|
const fullState = JSON.parse((_a3 = localStorage.getItem("call-control-sdk-state")) != null ? _a3 : "");
|
|
2971
2935
|
const key = (_b2 = event.key) == null ? void 0 : _b2.toLowerCase();
|
|
2972
|
-
if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL") {
|
|
2936
|
+
if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL" /* ONCALL */) {
|
|
2973
2937
|
return;
|
|
2974
2938
|
}
|
|
2975
2939
|
if (key === "m" && String((_d2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _d2.mute) === "0") {
|
|
2976
2940
|
event.preventDefault();
|
|
2977
2941
|
(_e2 = micRef.current) == null ? void 0 : _e2.mute();
|
|
2978
2942
|
const payload = {
|
|
2979
|
-
action: "MUTE"
|
|
2943
|
+
action: "MUTE" /* MUTE */,
|
|
2980
2944
|
userId: fullState.agentId
|
|
2981
2945
|
};
|
|
2982
2946
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
@@ -2984,7 +2948,7 @@ function CallControls({ onDataChange }) {
|
|
|
2984
2948
|
if (key === "u" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.mute) === "1") {
|
|
2985
2949
|
event.preventDefault();
|
|
2986
2950
|
const payload = {
|
|
2987
|
-
action: "UNMUTE"
|
|
2951
|
+
action: "UNMUTE" /* UNMUTE */,
|
|
2988
2952
|
userId: fullState.agentId
|
|
2989
2953
|
};
|
|
2990
2954
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
@@ -2993,7 +2957,7 @@ function CallControls({ onDataChange }) {
|
|
|
2993
2957
|
if (key === "h" && String((_h2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _h2.hold) === "0") {
|
|
2994
2958
|
event.preventDefault();
|
|
2995
2959
|
const payload = {
|
|
2996
|
-
action: "HOLD"
|
|
2960
|
+
action: "HOLD" /* HOLD */,
|
|
2997
2961
|
userId: fullState.agentId
|
|
2998
2962
|
};
|
|
2999
2963
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
@@ -3001,7 +2965,7 @@ function CallControls({ onDataChange }) {
|
|
|
3001
2965
|
if (key === "r" && String((_i2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _i2.hold) === "1") {
|
|
3002
2966
|
event.preventDefault();
|
|
3003
2967
|
const payload = {
|
|
3004
|
-
action: "UNHOLD"
|
|
2968
|
+
action: "UNHOLD" /* UNHOLD */,
|
|
3005
2969
|
userId: fullState.agentId
|
|
3006
2970
|
};
|
|
3007
2971
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
@@ -3015,7 +2979,7 @@ function CallControls({ onDataChange }) {
|
|
|
3015
2979
|
(0, import_react11.useEffect)(() => {
|
|
3016
2980
|
let interval;
|
|
3017
2981
|
let wrapUpinterval;
|
|
3018
|
-
if (state.callData.status && state.callData.status === "ONCALL") {
|
|
2982
|
+
if (state.callData.status && state.callData.status === "ONCALL" /* ONCALL */) {
|
|
3019
2983
|
interval = setInterval(() => {
|
|
3020
2984
|
const elapsed = Math.floor((Date.now() - state.callStartTime) / 1e3);
|
|
3021
2985
|
setCallDuration(elapsed);
|
|
@@ -3023,7 +2987,7 @@ function CallControls({ onDataChange }) {
|
|
|
3023
2987
|
} else {
|
|
3024
2988
|
setCallDuration(0);
|
|
3025
2989
|
}
|
|
3026
|
-
if (state.callData.status && state.callData.status === "WRAPUP" && callWrapuptime !== null) {
|
|
2990
|
+
if (state.callData.status && state.callData.status === "WRAPUP" /* WRAPUP */ && callWrapuptime !== null) {
|
|
3027
2991
|
wrapUpinterval = setInterval(() => {
|
|
3028
2992
|
setCallWrapuptime((prevTime) => {
|
|
3029
2993
|
if (prevTime === null || prevTime <= 1) {
|
|
@@ -3130,65 +3094,82 @@ function CallControls({ onDataChange }) {
|
|
|
3130
3094
|
if (data.type === "pong") {
|
|
3131
3095
|
return;
|
|
3132
3096
|
}
|
|
3133
|
-
const
|
|
3134
|
-
const confrence = getCombineConfrenceData(
|
|
3135
|
-
|
|
3097
|
+
const sdkState = JSON.parse((_a3 = localStorage.getItem(STORAGE_KEY)) != null ? _a3 : "{}");
|
|
3098
|
+
const confrence = getCombineConfrenceData(sdkState, data);
|
|
3099
|
+
const callData = {
|
|
3100
|
+
"agent_id": data == null ? void 0 : data.agent_id,
|
|
3101
|
+
"status": data == null ? void 0 : data.status,
|
|
3102
|
+
"type": data == null ? void 0 : data.type,
|
|
3103
|
+
"event_time": data == null ? void 0 : data.event_time,
|
|
3104
|
+
"phone_number": data == null ? void 0 : data.phone_number,
|
|
3105
|
+
"convox_id": data == null ? void 0 : data.convox_id,
|
|
3106
|
+
"process_id": data == null ? void 0 : data.process_id,
|
|
3107
|
+
"process_name": data == null ? void 0 : data.process_name,
|
|
3108
|
+
"hold": data == null ? void 0 : data.hold,
|
|
3109
|
+
"mute": data == null ? void 0 : data.mute,
|
|
3110
|
+
"mode": data == null ? void 0 : data.mode,
|
|
3111
|
+
"queue_name": data == null ? void 0 : data.queue_name
|
|
3112
|
+
};
|
|
3113
|
+
sdkStateManager.updateCallData(callData);
|
|
3136
3114
|
sdkStateManager.updateConferenceData([...confrence]);
|
|
3137
|
-
if (
|
|
3115
|
+
if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
|
|
3138
3116
|
setShowIframe(true);
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3117
|
+
setCallWrapuptime((_c2 = (_b2 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _b2.auto_wrapup_time) != null ? _c2 : null);
|
|
3118
|
+
sdkStateManager.updateConferenceData(
|
|
3119
|
+
[
|
|
3120
|
+
{
|
|
3121
|
+
line: 1,
|
|
3122
|
+
status: "IDLE",
|
|
3123
|
+
type: "",
|
|
3124
|
+
phone: "",
|
|
3125
|
+
isMute: false,
|
|
3126
|
+
isHold: false,
|
|
3127
|
+
isCallStart: false,
|
|
3128
|
+
isMergeCall: false
|
|
3129
|
+
},
|
|
3130
|
+
{
|
|
3131
|
+
line: 2,
|
|
3132
|
+
status: "IDLE",
|
|
3133
|
+
type: "",
|
|
3134
|
+
phone: "",
|
|
3135
|
+
isMute: false,
|
|
3136
|
+
isHold: false,
|
|
3137
|
+
isCallStart: false,
|
|
3138
|
+
isMergeCall: false
|
|
3139
|
+
},
|
|
3140
|
+
{
|
|
3141
|
+
line: 3,
|
|
3142
|
+
status: "IDLE",
|
|
3143
|
+
type: "",
|
|
3144
|
+
phone: "",
|
|
3145
|
+
isMute: false,
|
|
3146
|
+
isHold: false,
|
|
3147
|
+
isCallStart: false,
|
|
3148
|
+
isMergeCall: false
|
|
3149
|
+
},
|
|
3150
|
+
{
|
|
3151
|
+
line: 4,
|
|
3152
|
+
status: "IDLE",
|
|
3153
|
+
type: "",
|
|
3154
|
+
phone: "",
|
|
3155
|
+
isMute: false,
|
|
3156
|
+
isHold: false,
|
|
3157
|
+
isCallStart: false,
|
|
3158
|
+
isMergeCall: false
|
|
3159
|
+
},
|
|
3160
|
+
{
|
|
3161
|
+
line: 5,
|
|
3162
|
+
status: "IDLE",
|
|
3163
|
+
type: "",
|
|
3164
|
+
phone: "",
|
|
3165
|
+
isMute: false,
|
|
3166
|
+
isHold: false,
|
|
3167
|
+
isCallStart: false,
|
|
3168
|
+
isMergeCall: false
|
|
3169
|
+
}
|
|
3170
|
+
]
|
|
3171
|
+
);
|
|
3172
|
+
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
|
|
3192
3173
|
audioRef.current.play().catch((error) => {
|
|
3193
3174
|
console.error("Failed to play ringtone:", error);
|
|
3194
3175
|
});
|
|
@@ -3199,14 +3180,13 @@ function CallControls({ onDataChange }) {
|
|
|
3199
3180
|
audioRef.current.currentTime = 0;
|
|
3200
3181
|
}
|
|
3201
3182
|
}
|
|
3202
|
-
if (data.status === "ONCALL") {
|
|
3183
|
+
if (data.status === "ONCALL" /* ONCALL */) {
|
|
3203
3184
|
sdkStateManager.startCall();
|
|
3204
|
-
setCallWrapuptime((_c2 = (_b2 = rls == null ? void 0 : rls.sdkConfig) == null ? void 0 : _b2.auto_wrapup_time) != null ? _c2 : null);
|
|
3205
3185
|
if (!showIframe) {
|
|
3206
3186
|
setShowIframe(true);
|
|
3207
3187
|
}
|
|
3208
3188
|
}
|
|
3209
|
-
if (data.status === "WRAPUP") {
|
|
3189
|
+
if (data.status === "WRAPUP" /* WRAPUP */) {
|
|
3210
3190
|
sdkStateManager.endCall();
|
|
3211
3191
|
}
|
|
3212
3192
|
} catch (e) {
|
|
@@ -3353,32 +3333,29 @@ function CallControls({ onDataChange }) {
|
|
|
3353
3333
|
}
|
|
3354
3334
|
),
|
|
3355
3335
|
((_k = state.sdkConfig) == null ? void 0 : _k.enableQueueName) && ((_l = state == null ? void 0 : state.callData) == null ? void 0 : _l.queue_name) && ((_m = state == null ? void 0 : state.callData) == null ? void 0 : _m.mode) !== "manual" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Chip, { label: (_n = state == null ? void 0 : state.callData) == null ? void 0 : _n.queue_name }),
|
|
3356
|
-
|
|
3336
|
+
!((_o = state.sdkConfig) == null ? void 0 : _o.disabledDialButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Dial", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3357
3337
|
import_material4.IconButton,
|
|
3358
3338
|
{
|
|
3359
3339
|
size: "small",
|
|
3360
3340
|
onClick: (e) => {
|
|
3361
|
-
var _a3, _b2
|
|
3362
|
-
if (
|
|
3341
|
+
var _a3, _b2;
|
|
3342
|
+
if (!["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(
|
|
3343
|
+
(_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
|
|
3344
|
+
)) {
|
|
3363
3345
|
handleOpenDialer(e);
|
|
3364
3346
|
}
|
|
3365
3347
|
},
|
|
3366
|
-
|
|
3367
|
-
bgcolor: "action.hover",
|
|
3368
|
-
"&:hover": {
|
|
3369
|
-
bgcolor: "warning"
|
|
3370
|
-
}
|
|
3371
|
-
},
|
|
3348
|
+
disabled: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()),
|
|
3372
3349
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3373
3350
|
import_icons_material2.WifiCalling3,
|
|
3374
3351
|
{
|
|
3375
3352
|
sx: {
|
|
3376
|
-
color:
|
|
3353
|
+
color: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
|
|
3377
3354
|
}
|
|
3378
3355
|
}
|
|
3379
3356
|
)
|
|
3380
3357
|
}
|
|
3381
|
-
) })
|
|
3358
|
+
) }),
|
|
3382
3359
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { onClick: () => setShowIframe(true), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3383
3360
|
import_material4.Typography,
|
|
3384
3361
|
{
|
|
@@ -3390,7 +3367,7 @@ function CallControls({ onDataChange }) {
|
|
|
3390
3367
|
fontWeight: "600",
|
|
3391
3368
|
cursor: "pointer"
|
|
3392
3369
|
},
|
|
3393
|
-
children: state.callData.status === "WRAPUP" && callWrapuptime !== null ? formatDuration(callWrapuptime) : formatDuration(callDuration)
|
|
3370
|
+
children: state.callData.status === "WRAPUP" /* WRAPUP */ && callWrapuptime !== null ? formatDuration(callWrapuptime) : formatDuration(callDuration)
|
|
3394
3371
|
}
|
|
3395
3372
|
) }),
|
|
3396
3373
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -3420,7 +3397,7 @@ function CallControls({ onDataChange }) {
|
|
|
3420
3397
|
width: "60px",
|
|
3421
3398
|
textAlign: "center"
|
|
3422
3399
|
},
|
|
3423
|
-
children: (
|
|
3400
|
+
children: (_r = (_q = (_p = state.callData) == null ? void 0 : _p.status) == null ? void 0 : _q.toUpperCase()) != null ? _r : "N/A"
|
|
3424
3401
|
}
|
|
3425
3402
|
),
|
|
3426
3403
|
onClick: handleOpenAgentStatus,
|
|
@@ -3444,32 +3421,32 @@ function CallControls({ onDataChange }) {
|
|
|
3444
3421
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Agent Ready", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3445
3422
|
import_material4.Button,
|
|
3446
3423
|
{
|
|
3447
|
-
variant:
|
|
3424
|
+
variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()) ? "outlined" : "contained",
|
|
3448
3425
|
onClick: (e) => {
|
|
3449
|
-
var _a3, _b2
|
|
3450
|
-
if (
|
|
3426
|
+
var _a3, _b2;
|
|
3427
|
+
if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
|
|
3451
3428
|
e.stopPropagation();
|
|
3452
3429
|
handleAgentReady();
|
|
3453
3430
|
}
|
|
3454
3431
|
},
|
|
3455
3432
|
classes: {
|
|
3456
|
-
root:
|
|
3433
|
+
root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()) ? "outlined" : "enabled"
|
|
3457
3434
|
},
|
|
3458
|
-
sx: __spreadValues({},
|
|
3435
|
+
sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()) ? outlined : enabled),
|
|
3459
3436
|
disabled: agentReadyLoading,
|
|
3460
3437
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SupportAgent, {})
|
|
3461
3438
|
}
|
|
3462
3439
|
) }),
|
|
3463
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_y = state.callData) == null ? void 0 : _y.hold) === 1 ? "Resume" : "Hold", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3464
3441
|
import_material4.Button,
|
|
3465
3442
|
{
|
|
3466
|
-
variant: ((
|
|
3443
|
+
variant: ((_z = state.callData) == null ? void 0 : _z.hold) === 1 && ((_B = (_A = state.callData) == null ? void 0 : _A.status) == null ? void 0 : _B.toUpperCase()) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
|
|
3467
3444
|
onClick: (e) => {
|
|
3468
3445
|
e.stopPropagation();
|
|
3469
3446
|
handleHoldToggle();
|
|
3470
3447
|
},
|
|
3471
|
-
sx: ((
|
|
3472
|
-
disabled: ((
|
|
3448
|
+
sx: ((_C = state.callData) == null ? void 0 : _C.hold) === 1 && ((_E = (_D = state.callData) == null ? void 0 : _D.status) == null ? void 0 : _E.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : ((_G = (_F = state.callData) == null ? void 0 : _F.status) == null ? void 0 : _G.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
3449
|
+
disabled: ((_I = (_H = state.callData) == null ? void 0 : _H.status) == null ? void 0 : _I.toUpperCase()) !== "ONCALL" /* ONCALL */ && ((_J = state.callData) == null ? void 0 : _J.hold) !== 1 || holdOrUnHoldLoading,
|
|
3473
3450
|
children: holdOrUnHoldLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3474
3451
|
import_material4.CircularProgress,
|
|
3475
3452
|
{
|
|
@@ -3478,19 +3455,19 @@ function CallControls({ onDataChange }) {
|
|
|
3478
3455
|
color: theme.palette.primary.main
|
|
3479
3456
|
}
|
|
3480
3457
|
}
|
|
3481
|
-
) : ((
|
|
3458
|
+
) : ((_K = state.callData) == null ? void 0 : _K.hold) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.PlayArrow, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Pause, {})
|
|
3482
3459
|
}
|
|
3483
3460
|
) }),
|
|
3484
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: ((_L = state.callData) == null ? void 0 : _L.mute) === 1 ? "Unmute" : "Mute", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3485
3462
|
import_material4.Button,
|
|
3486
3463
|
{
|
|
3487
|
-
variant: ((
|
|
3464
|
+
variant: ((_M = state.callData) == null ? void 0 : _M.mute) === 1 && ((_O = (_N = state.callData) == null ? void 0 : _N.status) == null ? void 0 : _O.toUpperCase()) === "ONCALL" /* ONCALL */ ? "contained" : "outlined",
|
|
3488
3465
|
onClick: (e) => {
|
|
3489
3466
|
e.stopPropagation();
|
|
3490
3467
|
handleMuteToggle();
|
|
3491
3468
|
},
|
|
3492
|
-
sx: ((
|
|
3493
|
-
disabled: ((
|
|
3469
|
+
sx: ((_P = state.callData) == null ? void 0 : _P.hold) === 1 ? __spreadValues({}, disabled) : ((_Q = state.callData) == null ? void 0 : _Q.mute) === 1 && ((_S = (_R = state.callData) == null ? void 0 : _R.status) == null ? void 0 : _S.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, enabled) : ((_U = (_T = state.callData) == null ? void 0 : _T.status) == null ? void 0 : _U.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
3470
|
+
disabled: ((_W = (_V = state.callData) == null ? void 0 : _V.status) == null ? void 0 : _W.toUpperCase()) !== "ONCALL" /* ONCALL */ && ((_X = state.callData) == null ? void 0 : _X.mute) !== 1 || muteOrUnMuteLoading || ((_Y = state.callData) == null ? void 0 : _Y.hold) === 1,
|
|
3494
3471
|
children: muteOrUnMuteLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3495
3472
|
import_material4.CircularProgress,
|
|
3496
3473
|
{
|
|
@@ -3499,69 +3476,93 @@ function CallControls({ onDataChange }) {
|
|
|
3499
3476
|
color: theme.palette.primary.main
|
|
3500
3477
|
}
|
|
3501
3478
|
}
|
|
3502
|
-
) : ((
|
|
3479
|
+
) : ((_Z = state.callData) == null ? void 0 : _Z.mute) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.MicOff, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Mic, {})
|
|
3503
3480
|
}
|
|
3504
3481
|
) }),
|
|
3505
|
-
!((
|
|
3482
|
+
!((__ = state.sdkConfig) == null ? void 0 : __.disableCallTransferButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Transfer Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3506
3483
|
import_material4.Button,
|
|
3507
3484
|
{
|
|
3508
3485
|
variant: state.openCallTransferDialog ? "contained" : "outlined",
|
|
3509
3486
|
onClick: (e) => {
|
|
3510
3487
|
var _a3, _b2;
|
|
3511
|
-
if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
|
|
3488
|
+
if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
|
|
3512
3489
|
e.stopPropagation();
|
|
3513
3490
|
sdkStateManager.setOpenCallTransferDialog(true);
|
|
3514
3491
|
}
|
|
3515
3492
|
},
|
|
3516
|
-
sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((
|
|
3517
|
-
disabled: ((
|
|
3493
|
+
sx: state.openCallTransferDialog ? __spreadValues({}, enabled) : ((_aa = (_$ = state.callData) == null ? void 0 : _$.status) == null ? void 0 : _aa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
3494
|
+
disabled: ((_ca = (_ba = state.callData) == null ? void 0 : _ba.status) == null ? void 0 : _ca.toUpperCase()) !== "ONCALL" /* ONCALL */,
|
|
3518
3495
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.TransferWithinAStation, {})
|
|
3519
3496
|
}
|
|
3520
3497
|
) }),
|
|
3521
|
-
!((
|
|
3498
|
+
!((_da = state.sdkConfig) == null ? void 0 : _da.disableConferenceButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Conference Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3522
3499
|
import_material4.Button,
|
|
3523
3500
|
{
|
|
3524
3501
|
variant: state.openConferenceDialog ? "contained" : "outlined",
|
|
3525
3502
|
onClick: (e) => {
|
|
3526
3503
|
var _a3, _b2;
|
|
3527
|
-
if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL") {
|
|
3504
|
+
if (((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()) === "ONCALL" /* ONCALL */) {
|
|
3528
3505
|
e.stopPropagation();
|
|
3529
3506
|
sdkStateManager.setOpenConferenceDialog(true);
|
|
3530
3507
|
}
|
|
3531
3508
|
},
|
|
3532
|
-
sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((
|
|
3533
|
-
disabled: ((
|
|
3509
|
+
sx: state.openConferenceDialog ? __spreadValues({}, enabled) : ((_fa = (_ea = state.callData) == null ? void 0 : _ea.status) == null ? void 0 : _fa.toUpperCase()) === "ONCALL" /* ONCALL */ ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
3510
|
+
disabled: ((_ha = (_ga = state.callData) == null ? void 0 : _ga.status) == null ? void 0 : _ha.toUpperCase()) !== "ONCALL" /* ONCALL */,
|
|
3534
3511
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.Group, {})
|
|
3535
3512
|
}
|
|
3536
3513
|
) }),
|
|
3537
|
-
((
|
|
3514
|
+
((_ia = state.sdkConfig) == null ? void 0 : _ia.enableSmsServices) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "Send SMS", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3538
3515
|
import_material4.Button,
|
|
3539
3516
|
{
|
|
3540
3517
|
variant: Boolean(ambulanceAnchorEl) ? "contained" : "outlined",
|
|
3541
3518
|
onClick: (e) => {
|
|
3542
|
-
var _a3, _b2
|
|
3543
|
-
if (
|
|
3519
|
+
var _a3, _b2;
|
|
3520
|
+
if ([
|
|
3521
|
+
"ONCALL" /* ONCALL */,
|
|
3522
|
+
"WRAPUP" /* WRAPUP */
|
|
3523
|
+
].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
|
|
3544
3524
|
e.stopPropagation();
|
|
3545
3525
|
handleOpenAbulanceServices(e);
|
|
3546
3526
|
}
|
|
3547
3527
|
},
|
|
3548
|
-
sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) :
|
|
3549
|
-
|
|
3528
|
+
sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : [
|
|
3529
|
+
"ONCALL" /* ONCALL */,
|
|
3530
|
+
"WRAPUP" /* WRAPUP */
|
|
3531
|
+
].includes((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
|
|
3532
|
+
disabled: ![
|
|
3533
|
+
"ONCALL" /* ONCALL */,
|
|
3534
|
+
"WRAPUP" /* WRAPUP */
|
|
3535
|
+
].includes((_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()),
|
|
3550
3536
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.SmsSharp, {})
|
|
3551
3537
|
}
|
|
3552
3538
|
) }),
|
|
3553
|
-
!((
|
|
3539
|
+
!((_na = state.sdkConfig) == null ? void 0 : _na.disableEndCallButton) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Tooltip, { title: "End Call", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3554
3540
|
import_material4.Button,
|
|
3555
3541
|
{
|
|
3556
|
-
variant:
|
|
3542
|
+
variant: [
|
|
3543
|
+
"ONCALL" /* ONCALL */,
|
|
3544
|
+
"RINGING" /* RINGING */,
|
|
3545
|
+
"DIALING" /* DIALING */,
|
|
3546
|
+
"WRAPUP" /* WRAPUP */
|
|
3547
|
+
].includes((_pa = (_oa = state.callData) == null ? void 0 : _oa.status) == null ? void 0 : _pa.toUpperCase()) ? "contained" : "outlined",
|
|
3557
3548
|
onClick: (e) => {
|
|
3558
|
-
var _a3, _b2
|
|
3559
|
-
if (
|
|
3549
|
+
var _a3, _b2;
|
|
3550
|
+
if ([
|
|
3551
|
+
"ONCALL" /* ONCALL */,
|
|
3552
|
+
"RINGING" /* RINGING */,
|
|
3553
|
+
"DIALING" /* DIALING */,
|
|
3554
|
+
"WRAPUP" /* WRAPUP */
|
|
3555
|
+
].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
|
|
3560
3556
|
e.stopPropagation();
|
|
3561
3557
|
setOpenCallDisposition(true);
|
|
3562
3558
|
}
|
|
3563
3559
|
},
|
|
3564
|
-
sx:
|
|
3560
|
+
sx: [
|
|
3561
|
+
"ONCALL" /* ONCALL */,
|
|
3562
|
+
"RINGING" /* RINGING */,
|
|
3563
|
+
"DIALING" /* DIALING */,
|
|
3564
|
+
"WRAPUP" /* WRAPUP */
|
|
3565
|
+
].includes((_ra = (_qa = state.callData) == null ? void 0 : _qa.status) == null ? void 0 : _ra.toUpperCase()) ? __spreadProps(__spreadValues({}, enabled), {
|
|
3565
3566
|
borderRight: "1px",
|
|
3566
3567
|
backgroundColor: "error.main",
|
|
3567
3568
|
minWidth: "60px !important",
|
|
@@ -3580,7 +3581,12 @@ function CallControls({ onDataChange }) {
|
|
|
3580
3581
|
}) : __spreadProps(__spreadValues({}, disabled), {
|
|
3581
3582
|
minWidth: "60px !important"
|
|
3582
3583
|
}),
|
|
3583
|
-
disabled:
|
|
3584
|
+
disabled: ![
|
|
3585
|
+
"ONCALL" /* ONCALL */,
|
|
3586
|
+
"RINGING" /* RINGING */,
|
|
3587
|
+
"DIALING" /* DIALING */,
|
|
3588
|
+
"WRAPUP" /* WRAPUP */
|
|
3589
|
+
].includes((_ta = (_sa = state.callData) == null ? void 0 : _sa.status) == null ? void 0 : _ta.toUpperCase()) || endCallLoading,
|
|
3584
3590
|
children: endCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3585
3591
|
import_material4.CircularProgress,
|
|
3586
3592
|
{
|
|
@@ -3620,7 +3626,7 @@ function CallControls({ onDataChange }) {
|
|
|
3620
3626
|
transition: theme.transitions.create(["box-shadow", "transform"], {
|
|
3621
3627
|
duration: theme.transitions.duration.short
|
|
3622
3628
|
}),
|
|
3623
|
-
visibility: showIframe && !((
|
|
3629
|
+
visibility: showIframe && !((_ua = state.sdkConfig) == null ? void 0 : _ua.disableSoftPhone) ? "visible" : "hidden",
|
|
3624
3630
|
userSelect: "none"
|
|
3625
3631
|
},
|
|
3626
3632
|
children: [
|
|
@@ -3654,7 +3660,7 @@ function CallControls({ onDataChange }) {
|
|
|
3654
3660
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material4.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3655
3661
|
"iframe",
|
|
3656
3662
|
{
|
|
3657
|
-
src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(
|
|
3663
|
+
src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_va = state.process) == null ? void 0 : _va.process_id}`,
|
|
3658
3664
|
height: 380,
|
|
3659
3665
|
width: 420,
|
|
3660
3666
|
allow: "camera; microphone; autoplay",
|
|
@@ -3939,6 +3945,11 @@ async function initSDK({
|
|
|
3939
3945
|
agentId: agentId.trim(),
|
|
3940
3946
|
baseUrl: BASE_URL
|
|
3941
3947
|
});
|
|
3948
|
+
const res = {
|
|
3949
|
+
accessToken: initResult == null ? void 0 : initResult.accessToken,
|
|
3950
|
+
expiration: initResult == null ? void 0 : initResult.expiration,
|
|
3951
|
+
ticketId: initResult == null ? void 0 : initResult.ticketId
|
|
3952
|
+
};
|
|
3942
3953
|
if (initResult) {
|
|
3943
3954
|
console.info("SDK initialized successfully");
|
|
3944
3955
|
sdkStateManager.initialize(
|
|
@@ -3946,7 +3957,7 @@ async function initSDK({
|
|
|
3946
3957
|
tenantId.trim(),
|
|
3947
3958
|
agentId.trim(),
|
|
3948
3959
|
__spreadValues(__spreadValues({}, initResult == null ? void 0 : initResult.call_controls), sdkConfig),
|
|
3949
|
-
|
|
3960
|
+
res
|
|
3950
3961
|
);
|
|
3951
3962
|
} else {
|
|
3952
3963
|
sdkStateManager.setInitCheck();
|