call-control-sdk 6.5.5-uat.3 → 6.5.5-uat.5
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 +12 -114
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -114
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/incoming-4WP3FJI4.mp3 +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1162,7 +1162,7 @@ var styles_default = useStyles;
|
|
|
1162
1162
|
|
|
1163
1163
|
// call-control-sdk/lib/components/dialog.tsx
|
|
1164
1164
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1165
|
-
var ConferenceTableRow = ({ each }) => {
|
|
1165
|
+
var ConferenceTableRow = ({ each, isLineDialing }) => {
|
|
1166
1166
|
var _a2, _b, _c, _d, _e, _f;
|
|
1167
1167
|
const state = useSDKState();
|
|
1168
1168
|
const theme = useTheme2();
|
|
@@ -1352,7 +1352,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1352
1352
|
placeholder: "Phone Number",
|
|
1353
1353
|
fullWidth: true,
|
|
1354
1354
|
value: (each == null ? void 0 : each.phone) || "",
|
|
1355
|
-
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 : ""),
|
|
1355
|
+
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 : "") || isLineDialing,
|
|
1356
1356
|
onChange: (e) => {
|
|
1357
1357
|
onConferenceLineUpdate(each, { phone: e.target.value });
|
|
1358
1358
|
}
|
|
@@ -1480,7 +1480,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1480
1480
|
onClick: () => {
|
|
1481
1481
|
onConferenceCallStart(each, {});
|
|
1482
1482
|
},
|
|
1483
|
-
disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE
|
|
1483
|
+
disabled: (each == null ? void 0 : each.status) !== "IDLE" /* IDLE */ || isLineDialing,
|
|
1484
1484
|
children: conferenceCallStart ? /* @__PURE__ */ jsx2(
|
|
1485
1485
|
CircularProgress,
|
|
1486
1486
|
{
|
|
@@ -1581,7 +1581,7 @@ var ConferenceTableRow = ({ each }) => {
|
|
|
1581
1581
|
);
|
|
1582
1582
|
};
|
|
1583
1583
|
function ConferenceDialog() {
|
|
1584
|
-
var _a2;
|
|
1584
|
+
var _a2, _b;
|
|
1585
1585
|
const state = useSDKState();
|
|
1586
1586
|
const { showToast } = useToast();
|
|
1587
1587
|
const [conferenceCallEndAll, setConferenceCallEndAll] = useState8(false);
|
|
@@ -1589,12 +1589,12 @@ function ConferenceDialog() {
|
|
|
1589
1589
|
sdkStateManager.setOpenConferenceDialog(false);
|
|
1590
1590
|
};
|
|
1591
1591
|
const onEndAllConferenceCalls = () => {
|
|
1592
|
-
var _a3,
|
|
1592
|
+
var _a3, _b2, _c, _d;
|
|
1593
1593
|
setConferenceCallEndAll(true);
|
|
1594
1594
|
const payload = {
|
|
1595
1595
|
action: "EXTERNAL_CONFERENCE",
|
|
1596
1596
|
operation: "ENDCONFERENCE",
|
|
1597
|
-
userid: (
|
|
1597
|
+
userid: (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.agent_id) != null ? _b2 : "",
|
|
1598
1598
|
process: (_d = (_c = state.callData) == null ? void 0 : _c.process_name) != null ? _d : ""
|
|
1599
1599
|
};
|
|
1600
1600
|
axios_default.post(END_POINT.CONFERENCE_CALL_END_ALL, payload).then((res) => {
|
|
@@ -1603,13 +1603,15 @@ function ConferenceDialog() {
|
|
|
1603
1603
|
sdkStateManager.resetConferenceLines();
|
|
1604
1604
|
handleClose();
|
|
1605
1605
|
}).catch((err) => {
|
|
1606
|
-
var _a4,
|
|
1607
|
-
const message = ((
|
|
1606
|
+
var _a4, _b3, _c2, _d2;
|
|
1607
|
+
const message = ((_b3 = (_a4 = err.response) == null ? void 0 : _a4.data) == null ? void 0 : _b3.detail) || ((_d2 = (_c2 = err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || err.message || "An unknown error occurred";
|
|
1608
1608
|
showToast(message, "error");
|
|
1609
1609
|
}).finally(() => {
|
|
1610
1610
|
setConferenceCallEndAll(false);
|
|
1611
1611
|
});
|
|
1612
1612
|
};
|
|
1613
|
+
const isLineDialing = (_a2 = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _a2.some((item) => (item == null ? void 0 : item.status) === "DIALING" /* DIALING */);
|
|
1614
|
+
console.log("dataaaaa", state == null ? void 0 : state.conferenceLine, isLineDialing);
|
|
1613
1615
|
return /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
|
|
1614
1616
|
Dialog,
|
|
1615
1617
|
{
|
|
@@ -1629,7 +1631,7 @@ function ConferenceDialog() {
|
|
|
1629
1631
|
},
|
|
1630
1632
|
children: [
|
|
1631
1633
|
/* @__PURE__ */ jsxs2(Typography, { variant: "body1", children: [
|
|
1632
|
-
(
|
|
1634
|
+
(_b = state == null ? void 0 : state.agentId) != null ? _b : "",
|
|
1633
1635
|
" conference"
|
|
1634
1636
|
] }),
|
|
1635
1637
|
/* @__PURE__ */ jsx2(IconButton, { onClick: handleClose, children: /* @__PURE__ */ jsx2(Close, {}) })
|
|
@@ -1705,7 +1707,7 @@ function ConferenceDialog() {
|
|
|
1705
1707
|
]
|
|
1706
1708
|
}
|
|
1707
1709
|
) }),
|
|
1708
|
-
/* @__PURE__ */ jsx2(TableBody, { children: state == null ? void 0 : state.conferenceLine.map((each) => /* @__PURE__ */ jsx2(ConferenceTableRow, { each })) })
|
|
1710
|
+
/* @__PURE__ */ jsx2(TableBody, { children: state == null ? void 0 : state.conferenceLine.map((each) => /* @__PURE__ */ jsx2(ConferenceTableRow, { each, isLineDialing })) })
|
|
1709
1711
|
]
|
|
1710
1712
|
}
|
|
1711
1713
|
)
|
|
@@ -2898,83 +2900,6 @@ function createMicController(constraints = { audio: true }) {
|
|
|
2898
2900
|
};
|
|
2899
2901
|
}
|
|
2900
2902
|
|
|
2901
|
-
// call-control-sdk/lib/utils/audioLoader.ts
|
|
2902
|
-
import incomingRingtoneUrl from "./incoming-4WP3FJI4.mp3";
|
|
2903
|
-
var audioBlobUrl = null;
|
|
2904
|
-
var audioBuffer = null;
|
|
2905
|
-
async function loadAudioAsBlob() {
|
|
2906
|
-
if (audioBlobUrl) {
|
|
2907
|
-
return audioBlobUrl;
|
|
2908
|
-
}
|
|
2909
|
-
if (incomingRingtoneUrl.startsWith("data:") || incomingRingtoneUrl.startsWith("http://") || incomingRingtoneUrl.startsWith("https://") || incomingRingtoneUrl.startsWith("blob:")) {
|
|
2910
|
-
return incomingRingtoneUrl;
|
|
2911
|
-
}
|
|
2912
|
-
try {
|
|
2913
|
-
const response = await fetch(incomingRingtoneUrl);
|
|
2914
|
-
if (!response.ok) {
|
|
2915
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
2916
|
-
}
|
|
2917
|
-
const blob = await response.blob();
|
|
2918
|
-
if (blob.size === 0) {
|
|
2919
|
-
throw new Error("Empty blob");
|
|
2920
|
-
}
|
|
2921
|
-
audioBlobUrl = URL.createObjectURL(blob);
|
|
2922
|
-
return audioBlobUrl;
|
|
2923
|
-
} catch (error) {
|
|
2924
|
-
console.error("Could not create blob URL, using direct URL:", error);
|
|
2925
|
-
return incomingRingtoneUrl;
|
|
2926
|
-
}
|
|
2927
|
-
}
|
|
2928
|
-
async function createAudioElement() {
|
|
2929
|
-
const audio = new Audio();
|
|
2930
|
-
audio.loop = true;
|
|
2931
|
-
audio.volume = 0.7;
|
|
2932
|
-
audio.preload = "auto";
|
|
2933
|
-
let audioUrl = "";
|
|
2934
|
-
try {
|
|
2935
|
-
audioUrl = await loadAudioAsBlob();
|
|
2936
|
-
} catch (error) {
|
|
2937
|
-
console.warn("Failed to load audio as blob, trying direct URL:", error);
|
|
2938
|
-
audioUrl = incomingRingtoneUrl;
|
|
2939
|
-
}
|
|
2940
|
-
const tryLoadAudio = async (url) => {
|
|
2941
|
-
return new Promise((resolve) => {
|
|
2942
|
-
const checkCanPlay = () => {
|
|
2943
|
-
const canPlay = audio.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA;
|
|
2944
|
-
if (canPlay) {
|
|
2945
|
-
resolve(true);
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
if (audio.error) {
|
|
2949
|
-
resolve(false);
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
setTimeout(checkCanPlay, 100);
|
|
2953
|
-
};
|
|
2954
|
-
audio.addEventListener("canplay", () => resolve(true), { once: true });
|
|
2955
|
-
audio.addEventListener("error", () => resolve(false), { once: true });
|
|
2956
|
-
audio.src = url;
|
|
2957
|
-
audio.load();
|
|
2958
|
-
setTimeout(() => resolve(false), 2e3);
|
|
2959
|
-
});
|
|
2960
|
-
};
|
|
2961
|
-
let loaded = await tryLoadAudio(audioUrl);
|
|
2962
|
-
if (!loaded && audioUrl !== incomingRingtoneUrl) {
|
|
2963
|
-
loaded = await tryLoadAudio(incomingRingtoneUrl);
|
|
2964
|
-
if (loaded) {
|
|
2965
|
-
audioUrl = incomingRingtoneUrl;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
return audio;
|
|
2969
|
-
}
|
|
2970
|
-
function cleanupAudioResources() {
|
|
2971
|
-
if (audioBlobUrl) {
|
|
2972
|
-
URL.revokeObjectURL(audioBlobUrl);
|
|
2973
|
-
audioBlobUrl = null;
|
|
2974
|
-
}
|
|
2975
|
-
audioBuffer = null;
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
2903
|
// call-control-sdk/lib/components/callControls.tsx
|
|
2979
2904
|
import { getItem as getItem5 } from "@react-solutions/vault";
|
|
2980
2905
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -3018,7 +2943,6 @@ function CallControls({ onDataChange }) {
|
|
|
3018
2943
|
});
|
|
3019
2944
|
const micRef = useRef2(null);
|
|
3020
2945
|
const webSocketRef = useRef2(null);
|
|
3021
|
-
const audioRef = useRef2(null);
|
|
3022
2946
|
const reconnectTimeoutRef = useRef2(null);
|
|
3023
2947
|
const pingIntervalRef = useRef2(null);
|
|
3024
2948
|
const reconnectAttemptsRef = useRef2(0);
|
|
@@ -3279,22 +3203,6 @@ function CallControls({ onDataChange }) {
|
|
|
3279
3203
|
if (wrapUpinterval) clearInterval(wrapUpinterval);
|
|
3280
3204
|
};
|
|
3281
3205
|
}, [state.callData.status]);
|
|
3282
|
-
useEffect5(() => {
|
|
3283
|
-
createAudioElement().then((audio) => {
|
|
3284
|
-
audioRef.current = audio;
|
|
3285
|
-
}).catch((error) => {
|
|
3286
|
-
console.error("Failed to load audio element:", error);
|
|
3287
|
-
});
|
|
3288
|
-
return () => {
|
|
3289
|
-
if (audioRef.current) {
|
|
3290
|
-
audioRef.current.pause();
|
|
3291
|
-
audioRef.current.currentTime = 0;
|
|
3292
|
-
audioRef.current.src = "";
|
|
3293
|
-
audioRef.current = null;
|
|
3294
|
-
}
|
|
3295
|
-
cleanupAudioResources();
|
|
3296
|
-
};
|
|
3297
|
-
}, []);
|
|
3298
3206
|
useEffect5(() => {
|
|
3299
3207
|
if (onDataChange && state.callData) {
|
|
3300
3208
|
const { process_id, process_name, status, phone_number, agent_id, convox_id } = state.callData;
|
|
@@ -3443,16 +3351,6 @@ function CallControls({ onDataChange }) {
|
|
|
3443
3351
|
isMergeCall: false
|
|
3444
3352
|
}
|
|
3445
3353
|
]);
|
|
3446
|
-
if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
|
|
3447
|
-
audioRef.current.play().catch((error) => {
|
|
3448
|
-
console.error("Failed to play ringtone:", error);
|
|
3449
|
-
});
|
|
3450
|
-
}
|
|
3451
|
-
} else {
|
|
3452
|
-
if (audioRef.current) {
|
|
3453
|
-
audioRef.current.pause();
|
|
3454
|
-
audioRef.current.currentTime = 0;
|
|
3455
|
-
}
|
|
3456
3354
|
}
|
|
3457
3355
|
if (data.status === "ONCALL" /* ONCALL */) {
|
|
3458
3356
|
sdkStateManager.startCall();
|