call-control-sdk 6.5.1-uat.3 → 6.5.1-uat.4
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 +118 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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, _p;
|
|
962
962
|
const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
|
|
963
963
|
setLoading(true);
|
|
964
964
|
const payload = {
|
|
@@ -975,7 +975,11 @@ 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
|
|
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) => {
|
|
979
983
|
sdkStateManager.resetConferenceLines();
|
|
980
984
|
sdkStateManager.endCall();
|
|
981
985
|
setData(res == null ? void 0 : res.data);
|
|
@@ -2456,7 +2460,8 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2456
2460
|
followUp: { label: "No", value: "N" },
|
|
2457
2461
|
callbackDate: "",
|
|
2458
2462
|
callbackHrs: "",
|
|
2459
|
-
callbackMins: ""
|
|
2463
|
+
callbackMins: "",
|
|
2464
|
+
selected_break: false
|
|
2460
2465
|
});
|
|
2461
2466
|
const dispositionOptions = [
|
|
2462
2467
|
{ label: "Not Interested", value: "NI" },
|
|
@@ -2475,7 +2480,8 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2475
2480
|
followUp: { label: "No", value: "N" },
|
|
2476
2481
|
callbackDate: "",
|
|
2477
2482
|
callbackHrs: "",
|
|
2478
|
-
callbackMins: ""
|
|
2483
|
+
callbackMins: "",
|
|
2484
|
+
selected_break: false
|
|
2479
2485
|
});
|
|
2480
2486
|
};
|
|
2481
2487
|
const handleClose = () => {
|
|
@@ -2569,14 +2575,37 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2569
2575
|
]
|
|
2570
2576
|
}
|
|
2571
2577
|
),
|
|
2572
|
-
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2573
2579
|
import_material3.Box,
|
|
2574
2580
|
{
|
|
2575
2581
|
display: "flex",
|
|
2576
2582
|
gap: 2,
|
|
2577
2583
|
mt: 2,
|
|
2578
2584
|
children: [
|
|
2579
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: {
|
|
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)(
|
|
2580
2609
|
import_material3.TextField,
|
|
2581
2610
|
{
|
|
2582
2611
|
size: "small",
|
|
@@ -2590,7 +2619,17 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2590
2619
|
fullWidth: true,
|
|
2591
2620
|
sx: { flex: 1 }
|
|
2592
2621
|
}
|
|
2593
|
-
),
|
|
2622
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
|
|
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: [
|
|
2594
2633
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2595
2634
|
import_material3.TextField,
|
|
2596
2635
|
{
|
|
@@ -2602,17 +2641,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2602
2641
|
fullWidth: true,
|
|
2603
2642
|
sx: { flex: 1 }
|
|
2604
2643
|
}
|
|
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: [
|
|
2644
|
+
),
|
|
2616
2645
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2617
2646
|
import_material3.TextField,
|
|
2618
2647
|
{
|
|
@@ -2624,8 +2653,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
|
|
|
2624
2653
|
fullWidth: true,
|
|
2625
2654
|
sx: { flex: 1 }
|
|
2626
2655
|
}
|
|
2627
|
-
)
|
|
2628
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
|
|
2656
|
+
)
|
|
2629
2657
|
]
|
|
2630
2658
|
}
|
|
2631
2659
|
)
|
|
@@ -2887,6 +2915,57 @@ function cleanupAudioResources() {
|
|
|
2887
2915
|
audioBuffer = null;
|
|
2888
2916
|
}
|
|
2889
2917
|
|
|
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
|
+
|
|
2890
2969
|
// call-control-sdk/lib/components/callControls.tsx
|
|
2891
2970
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2892
2971
|
var getCombineConfrenceData = (localState, apiData) => {
|
|
@@ -2927,6 +3006,7 @@ function CallControls({ onDataChange }) {
|
|
|
2927
3006
|
enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
|
|
2928
3007
|
outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
|
|
2929
3008
|
});
|
|
3009
|
+
const micRef = (0, import_react11.useRef)(null);
|
|
2930
3010
|
const webSocketRef = (0, import_react11.useRef)(null);
|
|
2931
3011
|
const audioRef = (0, import_react11.useRef)(null);
|
|
2932
3012
|
const reconnectTimeoutRef = (0, import_react11.useRef)(null);
|
|
@@ -3063,7 +3143,7 @@ function CallControls({ onDataChange }) {
|
|
|
3063
3143
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
3064
3144
|
};
|
|
3065
3145
|
const handleEndCall = (data) => {
|
|
3066
|
-
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
3146
|
+
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
|
|
3067
3147
|
const payload = {
|
|
3068
3148
|
action: "ENDCALL",
|
|
3069
3149
|
userId: state.agentId,
|
|
@@ -3079,7 +3159,11 @@ function CallControls({ onDataChange }) {
|
|
|
3079
3159
|
endcall_type: "CLOSE"
|
|
3080
3160
|
};
|
|
3081
3161
|
setPhoneNumber("");
|
|
3082
|
-
endCall(END_POINT.END_CALL, payload
|
|
3162
|
+
endCall(END_POINT.END_CALL, payload, {
|
|
3163
|
+
params: {
|
|
3164
|
+
isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
|
|
3165
|
+
}
|
|
3166
|
+
});
|
|
3083
3167
|
sdkStateManager.endCall();
|
|
3084
3168
|
setOpenCallDisposition(false);
|
|
3085
3169
|
};
|
|
@@ -3093,8 +3177,13 @@ function CallControls({ onDataChange }) {
|
|
|
3093
3177
|
};
|
|
3094
3178
|
}, []);
|
|
3095
3179
|
(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
|
+
});
|
|
3096
3185
|
const handleKeyDown = (event) => {
|
|
3097
|
-
var _a3, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
3186
|
+
var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
3098
3187
|
const fullState = JSON.parse((_a3 = localStorage.getItem("call-control-sdk-state")) != null ? _a3 : "");
|
|
3099
3188
|
const key = (_b2 = event.key) == null ? void 0 : _b2.toLowerCase();
|
|
3100
3189
|
if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL") {
|
|
@@ -3102,21 +3191,23 @@ function CallControls({ onDataChange }) {
|
|
|
3102
3191
|
}
|
|
3103
3192
|
if (key === "m" && String((_d2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _d2.mute) === "0") {
|
|
3104
3193
|
event.preventDefault();
|
|
3194
|
+
(_e2 = micRef.current) == null ? void 0 : _e2.mute();
|
|
3105
3195
|
const payload = {
|
|
3106
3196
|
action: "MUTE",
|
|
3107
3197
|
userId: fullState.agentId
|
|
3108
3198
|
};
|
|
3109
3199
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
3110
3200
|
}
|
|
3111
|
-
if (key === "u" && String((
|
|
3201
|
+
if (key === "u" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.mute) === "1") {
|
|
3112
3202
|
event.preventDefault();
|
|
3113
3203
|
const payload = {
|
|
3114
3204
|
action: "UNMUTE",
|
|
3115
3205
|
userId: fullState.agentId
|
|
3116
3206
|
};
|
|
3117
3207
|
muteOrUnMute(END_POINT.MUTE_CALL, payload);
|
|
3208
|
+
(_g2 = micRef.current) == null ? void 0 : _g2.unmute();
|
|
3118
3209
|
}
|
|
3119
|
-
if (key === "h" && String((
|
|
3210
|
+
if (key === "h" && String((_h2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _h2.hold) === "0") {
|
|
3120
3211
|
event.preventDefault();
|
|
3121
3212
|
const payload = {
|
|
3122
3213
|
action: "HOLD",
|
|
@@ -3124,7 +3215,7 @@ function CallControls({ onDataChange }) {
|
|
|
3124
3215
|
};
|
|
3125
3216
|
holdOrUnHold(END_POINT.HOLD_CALL, payload);
|
|
3126
3217
|
}
|
|
3127
|
-
if (key === "r" && String((
|
|
3218
|
+
if (key === "r" && String((_i2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _i2.hold) === "1") {
|
|
3128
3219
|
event.preventDefault();
|
|
3129
3220
|
const payload = {
|
|
3130
3221
|
action: "UNHOLD",
|
|
@@ -4056,7 +4147,7 @@ async function initSDK({
|
|
|
4056
4147
|
apiKey.trim(),
|
|
4057
4148
|
tenantId.trim(),
|
|
4058
4149
|
agentId.trim(),
|
|
4059
|
-
sdkConfig,
|
|
4150
|
+
__spreadValues(__spreadValues({}, initResult == null ? void 0 : initResult.call_controls), sdkConfig),
|
|
4060
4151
|
initResult
|
|
4061
4152
|
);
|
|
4062
4153
|
} else {
|