call-control-sdk 6.5.1-uat.4 → 6.5.2
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 +28 -119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -121
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ __export(index_exports, {
|
|
|
61
61
|
module.exports = __toCommonJS(index_exports);
|
|
62
62
|
|
|
63
63
|
// call-control-sdk/lib/services/endPoint.ts
|
|
64
|
-
var IP = "
|
|
64
|
+
var IP = "cti.aighospitals.com";
|
|
65
65
|
var BASE_URL = `https://${IP}:8095`;
|
|
66
66
|
var WS_BASE_URL = `wss://${IP}:8095`;
|
|
67
67
|
var VERSION = {
|
|
@@ -958,7 +958,7 @@ var useEndCall = () => {
|
|
|
958
958
|
const [data, setData] = (0, import_react2.useState)(null);
|
|
959
959
|
const handleEndCall = (0, import_react2.useCallback)(
|
|
960
960
|
async (data2) => {
|
|
961
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o
|
|
961
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
962
962
|
const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
|
|
963
963
|
setLoading(true);
|
|
964
964
|
const payload = {
|
|
@@ -975,11 +975,7 @@ var useEndCall = () => {
|
|
|
975
975
|
callback_mins: (_o = data2 == null ? void 0 : data2.callbackMins) != null ? _o : "",
|
|
976
976
|
endcall_type: "CLOSE"
|
|
977
977
|
};
|
|
978
|
-
return axios_default.post(END_POINT.END_CALL, payload
|
|
979
|
-
params: {
|
|
980
|
-
isBreak: (_p = data2 == null ? void 0 : data2.isBreak) != null ? _p : false
|
|
981
|
-
}
|
|
982
|
-
}).then((res) => {
|
|
978
|
+
return axios_default.post(END_POINT.END_CALL, payload).then((res) => {
|
|
983
979
|
sdkStateManager.resetConferenceLines();
|
|
984
980
|
sdkStateManager.endCall();
|
|
985
981
|
setData(res == null ? void 0 : res.data);
|
|
@@ -2460,8 +2456,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2460
2456
|
followUp: { label: "No", value: "N" },
|
|
2461
2457
|
callbackDate: "",
|
|
2462
2458
|
callbackHrs: "",
|
|
2463
|
-
callbackMins: ""
|
|
2464
|
-
selected_break: false
|
|
2459
|
+
callbackMins: ""
|
|
2465
2460
|
});
|
|
2466
2461
|
const dispositionOptions = [
|
|
2467
2462
|
{ label: "Not Interested", value: "NI" },
|
|
@@ -2480,8 +2475,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2480
2475
|
followUp: { label: "No", value: "N" },
|
|
2481
2476
|
callbackDate: "",
|
|
2482
2477
|
callbackHrs: "",
|
|
2483
|
-
callbackMins: ""
|
|
2484
|
-
selected_break: false
|
|
2478
|
+
callbackMins: ""
|
|
2485
2479
|
});
|
|
2486
2480
|
};
|
|
2487
2481
|
const handleClose = () => {
|
|
@@ -2575,37 +2569,14 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2575
2569
|
]
|
|
2576
2570
|
}
|
|
2577
2571
|
),
|
|
2578
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2572
|
+
((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2579
2573
|
import_material3.Box,
|
|
2580
2574
|
{
|
|
2581
2575
|
display: "flex",
|
|
2582
2576
|
gap: 2,
|
|
2583
2577
|
mt: 2,
|
|
2584
2578
|
children: [
|
|
2585
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
2586
|
-
flex: "1",
|
|
2587
|
-
border: "1px solid #bdbdbd",
|
|
2588
|
-
borderRadius: "5px"
|
|
2589
|
-
}, children: [
|
|
2590
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2591
|
-
import_material3.Checkbox,
|
|
2592
|
-
{
|
|
2593
|
-
name: "selected_break",
|
|
2594
|
-
sx: {
|
|
2595
|
-
padding: "6px"
|
|
2596
|
-
},
|
|
2597
|
-
checked: formData.selected_break,
|
|
2598
|
-
onChange: (event) => {
|
|
2599
|
-
handleChange("selected_break", event.target.checked);
|
|
2600
|
-
},
|
|
2601
|
-
slotProps: {
|
|
2602
|
-
input: { "aria-label": "controlled" }
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
),
|
|
2606
|
-
" Mark as break"
|
|
2607
|
-
] }),
|
|
2608
|
-
((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2609
2580
|
import_material3.TextField,
|
|
2610
2581
|
{
|
|
2611
2582
|
size: "small",
|
|
@@ -2619,17 +2590,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2619
2590
|
fullWidth: true,
|
|
2620
2591
|
sx: { flex: 1 }
|
|
2621
2592
|
}
|
|
2622
|
-
)
|
|
2623
|
-
]
|
|
2624
|
-
}
|
|
2625
|
-
),
|
|
2626
|
-
((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2627
|
-
import_material3.Box,
|
|
2628
|
-
{
|
|
2629
|
-
display: "flex",
|
|
2630
|
-
gap: 2,
|
|
2631
|
-
mt: 2,
|
|
2632
|
-
children: [
|
|
2593
|
+
),
|
|
2633
2594
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2634
2595
|
import_material3.TextField,
|
|
2635
2596
|
{
|
|
@@ -2641,7 +2602,17 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2641
2602
|
fullWidth: true,
|
|
2642
2603
|
sx: { flex: 1 }
|
|
2643
2604
|
}
|
|
2644
|
-
)
|
|
2605
|
+
)
|
|
2606
|
+
]
|
|
2607
|
+
}
|
|
2608
|
+
),
|
|
2609
|
+
((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2610
|
+
import_material3.Box,
|
|
2611
|
+
{
|
|
2612
|
+
display: "flex",
|
|
2613
|
+
gap: 2,
|
|
2614
|
+
mt: 2,
|
|
2615
|
+
children: [
|
|
2645
2616
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2646
2617
|
import_material3.TextField,
|
|
2647
2618
|
{
|
|
@@ -2653,7 +2624,8 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2653
2624
|
fullWidth: true,
|
|
2654
2625
|
sx: { flex: 1 }
|
|
2655
2626
|
}
|
|
2656
|
-
)
|
|
2627
|
+
),
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
|
|
2657
2629
|
]
|
|
2658
2630
|
}
|
|
2659
2631
|
)
|
|
@@ -2915,57 +2887,6 @@ function cleanupAudioResources() {
|
|
|
2915
2887
|
audioBuffer = null;
|
|
2916
2888
|
}
|
|
2917
2889
|
|
|
2918
|
-
// call-control-sdk/lib/services/micController.ts
|
|
2919
|
-
function createMicController(constraints = { audio: true }) {
|
|
2920
|
-
let stream = null;
|
|
2921
|
-
let muted = false;
|
|
2922
|
-
async function start() {
|
|
2923
|
-
if (stream) return;
|
|
2924
|
-
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
2925
|
-
stream.getAudioTracks().forEach((track) => track.enabled = true);
|
|
2926
|
-
muted = false;
|
|
2927
|
-
}
|
|
2928
|
-
function setEnabled(enabled) {
|
|
2929
|
-
if (!stream) return;
|
|
2930
|
-
stream.getAudioTracks().forEach((track) => track.enabled = enabled);
|
|
2931
|
-
muted = !enabled;
|
|
2932
|
-
}
|
|
2933
|
-
function mute() {
|
|
2934
|
-
setEnabled(false);
|
|
2935
|
-
}
|
|
2936
|
-
function unmute() {
|
|
2937
|
-
setEnabled(true);
|
|
2938
|
-
}
|
|
2939
|
-
function toggleMute() {
|
|
2940
|
-
if (muted) {
|
|
2941
|
-
unmute();
|
|
2942
|
-
} else {
|
|
2943
|
-
mute();
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
function stop() {
|
|
2947
|
-
if (!stream) return;
|
|
2948
|
-
stream.getTracks().forEach((t) => t.stop());
|
|
2949
|
-
stream = null;
|
|
2950
|
-
muted = false;
|
|
2951
|
-
}
|
|
2952
|
-
function isMuted() {
|
|
2953
|
-
return muted;
|
|
2954
|
-
}
|
|
2955
|
-
function getStream() {
|
|
2956
|
-
return stream;
|
|
2957
|
-
}
|
|
2958
|
-
return {
|
|
2959
|
-
start,
|
|
2960
|
-
stop,
|
|
2961
|
-
mute,
|
|
2962
|
-
unmute,
|
|
2963
|
-
toggleMute,
|
|
2964
|
-
isMuted,
|
|
2965
|
-
getStream
|
|
2966
|
-
};
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
2890
|
// call-control-sdk/lib/components/callControls.tsx
|
|
2970
2891
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2971
2892
|
var getCombineConfrenceData = (localState, apiData) => {
|
|
@@ -3006,7 +2927,6 @@ function CallControls({ onDataChange }) {
|
|
|
3006
2927
|
enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
|
|
3007
2928
|
outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
|
|
3008
2929
|
});
|
|
3009
|
-
const micRef = (0, import_react11.useRef)(null);
|
|
3010
2930
|
const webSocketRef = (0, import_react11.useRef)(null);
|
|
3011
2931
|
const audioRef = (0, import_react11.useRef)(null);
|
|
3012
2932
|
const reconnectTimeoutRef = (0, import_react11.useRef)(null);
|
|
@@ -3143,7 +3063,7 @@ function CallControls({ onDataChange }) {
|
|
|
3143
3063
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
3144
3064
|
};
|
|
3145
3065
|
const handleEndCall = (data) => {
|
|
3146
|
-
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2
|
|
3066
|
+
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
3147
3067
|
const payload = {
|
|
3148
3068
|
action: "ENDCALL",
|
|
3149
3069
|
userId: state.agentId,
|
|
@@ -3159,11 +3079,7 @@ function CallControls({ onDataChange }) {
|
|
|
3159
3079
|
endcall_type: "CLOSE"
|
|
3160
3080
|
};
|
|
3161
3081
|
setPhoneNumber("");
|
|
3162
|
-
endCall(END_POINT.END_CALL, payload
|
|
3163
|
-
params: {
|
|
3164
|
-
isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
|
|
3165
|
-
}
|
|
3166
|
-
});
|
|
3082
|
+
endCall(END_POINT.END_CALL, payload);
|
|
3167
3083
|
sdkStateManager.endCall();
|
|
3168
3084
|
setOpenCallDisposition(false);
|
|
3169
3085
|
};
|
|
@@ -3177,13 +3093,8 @@ function CallControls({ onDataChange }) {
|
|
|
3177
3093
|
};
|
|
3178
3094
|
}, []);
|
|
3179
3095
|
(0, import_react11.useEffect)(() => {
|
|
3180
|
-
const mic = createMicController();
|
|
3181
|
-
micRef.current = mic;
|
|
3182
|
-
mic.start().catch((err) => {
|
|
3183
|
-
console.error("Failed to start mic:", err);
|
|
3184
|
-
});
|
|
3185
3096
|
const handleKeyDown = (event) => {
|
|
3186
|
-
var _a3, _b2, _c2, _d2, _e2, _f2, _g2
|
|
3097
|
+
var _a3, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
3187
3098
|
const fullState = JSON.parse((_a3 = localStorage.getItem("call-control-sdk-state")) != null ? _a3 : "");
|
|
3188
3099
|
const key = (_b2 = event.key) == null ? void 0 : _b2.toLowerCase();
|
|
3189
3100
|
if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL") {
|
|
@@ -3191,23 +3102,21 @@ function CallControls({ onDataChange }) {
|
|
|
3191
3102
|
}
|
|
3192
3103
|
if (key === "m" && String((_d2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _d2.mute) === "0") {
|
|
3193
3104
|
event.preventDefault();
|
|
3194
|
-
(_e2 = micRef.current) == null ? void 0 : _e2.mute();
|
|
3195
3105
|
const payload = {
|
|
3196
3106
|
action: "MUTE",
|
|
3197
3107
|
userId: fullState.agentId
|
|
3198
3108
|
};
|
|
3199
3109
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
3200
3110
|
}
|
|
3201
|
-
if (key === "u" && String((
|
|
3111
|
+
if (key === "u" && String((_e2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _e2.mute) === "1") {
|
|
3202
3112
|
event.preventDefault();
|
|
3203
3113
|
const payload = {
|
|
3204
3114
|
action: "UNMUTE",
|
|
3205
3115
|
userId: fullState.agentId
|
|
3206
3116
|
};
|
|
3207
3117
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
3208
|
-
(_g2 = micRef.current) == null ? void 0 : _g2.unmute();
|
|
3209
3118
|
}
|
|
3210
|
-
if (key === "h" && String((
|
|
3119
|
+
if (key === "h" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.hold) === "0") {
|
|
3211
3120
|
event.preventDefault();
|
|
3212
3121
|
const payload = {
|
|
3213
3122
|
action: "HOLD",
|
|
@@ -3215,7 +3124,7 @@ function CallControls({ onDataChange }) {
|
|
|
3215
3124
|
};
|
|
3216
3125
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
3217
3126
|
}
|
|
3218
|
-
if (key === "r" && String((
|
|
3127
|
+
if (key === "r" && String((_g2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _g2.hold) === "1") {
|
|
3219
3128
|
event.preventDefault();
|
|
3220
3129
|
const payload = {
|
|
3221
3130
|
action: "UNHOLD",
|
|
@@ -4147,7 +4056,7 @@ async function initSDK({
|
|
|
4147
4056
|
apiKey.trim(),
|
|
4148
4057
|
tenantId.trim(),
|
|
4149
4058
|
agentId.trim(),
|
|
4150
|
-
|
|
4059
|
+
sdkConfig,
|
|
4151
4060
|
initResult
|
|
4152
4061
|
);
|
|
4153
4062
|
} else {
|