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.mjs CHANGED
@@ -20,7 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
21
 
22
22
  // call-control-sdk/lib/services/endPoint.ts
23
- var IP = "uat-cti.aighospitals.com";
23
+ var IP = "cti.aighospitals.com";
24
24
  var BASE_URL = `https://${IP}:8095`;
25
25
  var WS_BASE_URL = `wss://${IP}:8095`;
26
26
  var VERSION = {
@@ -917,7 +917,7 @@ var useEndCall = () => {
917
917
  const [data, setData] = useState2(null);
918
918
  const handleEndCall = useCallback2(
919
919
  async (data2) => {
920
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
920
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
921
921
  const state = JSON.parse((_a2 = localStorage.getItem(STORAGE_KEY)) != null ? _a2 : "");
922
922
  setLoading(true);
923
923
  const payload = {
@@ -934,11 +934,7 @@ var useEndCall = () => {
934
934
  callback_mins: (_o = data2 == null ? void 0 : data2.callbackMins) != null ? _o : "",
935
935
  endcall_type: "CLOSE"
936
936
  };
937
- return axios_default.post(END_POINT.END_CALL, payload, {
938
- params: {
939
- isBreak: (_p = data2 == null ? void 0 : data2.isBreak) != null ? _p : false
940
- }
941
- }).then((res) => {
937
+ return axios_default.post(END_POINT.END_CALL, payload).then((res) => {
942
938
  sdkStateManager.resetConferenceLines();
943
939
  sdkStateManager.endCall();
944
940
  setData(res == null ? void 0 : res.data);
@@ -1378,8 +1374,7 @@ import {
1378
1374
  TableRow,
1379
1375
  TableCell,
1380
1376
  TableBody,
1381
- CircularProgress,
1382
- Checkbox
1377
+ CircularProgress
1383
1378
  } from "@mui/material";
1384
1379
  import { useEffect as useEffect4, useState as useState9 } from "react";
1385
1380
 
@@ -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
  const dispositionOptions = [
2487
2481
  { label: "Not Interested", value: "NI" },
@@ -2500,8 +2494,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2500
2494
  followUp: { label: "No", value: "N" },
2501
2495
  callbackDate: "",
2502
2496
  callbackHrs: "",
2503
- callbackMins: "",
2504
- selected_break: false
2497
+ callbackMins: ""
2505
2498
  });
2506
2499
  };
2507
2500
  const handleClose = () => {
@@ -2595,37 +2588,14 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2595
2588
  ]
2596
2589
  }
2597
2590
  ),
2598
- /* @__PURE__ */ jsxs2(
2591
+ ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs2(
2599
2592
  Box,
2600
2593
  {
2601
2594
  display: "flex",
2602
2595
  gap: 2,
2603
2596
  mt: 2,
2604
2597
  children: [
2605
- /* @__PURE__ */ jsxs2(Box, { sx: {
2606
- flex: "1",
2607
- border: "1px solid #bdbdbd",
2608
- borderRadius: "5px"
2609
- }, children: [
2610
- /* @__PURE__ */ jsx2(
2611
- Checkbox,
2612
- {
2613
- name: "selected_break",
2614
- sx: {
2615
- padding: "6px"
2616
- },
2617
- checked: formData.selected_break,
2618
- onChange: (event) => {
2619
- handleChange("selected_break", event.target.checked);
2620
- },
2621
- slotProps: {
2622
- input: { "aria-label": "controlled" }
2623
- }
2624
- }
2625
- ),
2626
- " Mark as break"
2627
- ] }),
2628
- ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" ? /* @__PURE__ */ jsx2(
2598
+ /* @__PURE__ */ jsx2(
2629
2599
  TextField,
2630
2600
  {
2631
2601
  size: "small",
@@ -2639,17 +2609,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2639
2609
  fullWidth: true,
2640
2610
  sx: { flex: 1 }
2641
2611
  }
2642
- ) : /* @__PURE__ */ jsx2(Box, { sx: { flex: 1 } })
2643
- ]
2644
- }
2645
- ),
2646
- ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs2(
2647
- Box,
2648
- {
2649
- display: "flex",
2650
- gap: 2,
2651
- mt: 2,
2652
- children: [
2612
+ ),
2653
2613
  /* @__PURE__ */ jsx2(
2654
2614
  TextField,
2655
2615
  {
@@ -2661,7 +2621,17 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2661
2621
  fullWidth: true,
2662
2622
  sx: { flex: 1 }
2663
2623
  }
2664
- ),
2624
+ )
2625
+ ]
2626
+ }
2627
+ ),
2628
+ ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ jsxs2(
2629
+ Box,
2630
+ {
2631
+ display: "flex",
2632
+ gap: 2,
2633
+ mt: 2,
2634
+ children: [
2665
2635
  /* @__PURE__ */ jsx2(
2666
2636
  TextField,
2667
2637
  {
@@ -2673,7 +2643,8 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
2673
2643
  fullWidth: true,
2674
2644
  sx: { flex: 1 }
2675
2645
  }
2676
- )
2646
+ ),
2647
+ /* @__PURE__ */ jsx2(Box, { sx: { flex: 1 } })
2677
2648
  ]
2678
2649
  }
2679
2650
  )
@@ -2935,57 +2906,6 @@ function cleanupAudioResources() {
2935
2906
  audioBuffer = null;
2936
2907
  }
2937
2908
 
2938
- // call-control-sdk/lib/services/micController.ts
2939
- function createMicController(constraints = { audio: true }) {
2940
- let stream = null;
2941
- let muted = false;
2942
- async function start() {
2943
- if (stream) return;
2944
- stream = await navigator.mediaDevices.getUserMedia(constraints);
2945
- stream.getAudioTracks().forEach((track) => track.enabled = true);
2946
- muted = false;
2947
- }
2948
- function setEnabled(enabled) {
2949
- if (!stream) return;
2950
- stream.getAudioTracks().forEach((track) => track.enabled = enabled);
2951
- muted = !enabled;
2952
- }
2953
- function mute() {
2954
- setEnabled(false);
2955
- }
2956
- function unmute() {
2957
- setEnabled(true);
2958
- }
2959
- function toggleMute() {
2960
- if (muted) {
2961
- unmute();
2962
- } else {
2963
- mute();
2964
- }
2965
- }
2966
- function stop() {
2967
- if (!stream) return;
2968
- stream.getTracks().forEach((t) => t.stop());
2969
- stream = null;
2970
- muted = false;
2971
- }
2972
- function isMuted() {
2973
- return muted;
2974
- }
2975
- function getStream() {
2976
- return stream;
2977
- }
2978
- return {
2979
- start,
2980
- stop,
2981
- mute,
2982
- unmute,
2983
- toggleMute,
2984
- isMuted,
2985
- getStream
2986
- };
2987
- }
2988
-
2989
2909
  // call-control-sdk/lib/components/callControls.tsx
2990
2910
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2991
2911
  var getCombineConfrenceData = (localState, apiData) => {
@@ -3026,7 +2946,6 @@ function CallControls({ onDataChange }) {
3026
2946
  enabled: ((_b = state.sdkConfig) == null ? void 0 : _b.enabled) || {},
3027
2947
  outlined: ((_c = state.sdkConfig) == null ? void 0 : _c.outlined) || {}
3028
2948
  });
3029
- const micRef = useRef2(null);
3030
2949
  const webSocketRef = useRef2(null);
3031
2950
  const audioRef = useRef2(null);
3032
2951
  const reconnectTimeoutRef = useRef2(null);
@@ -3163,7 +3082,7 @@ function CallControls({ onDataChange }) {
3163
3082
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3164
3083
  };
3165
3084
  const handleEndCall = (data) => {
3166
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
3085
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
3167
3086
  const payload = {
3168
3087
  action: "ENDCALL",
3169
3088
  userId: state.agentId,
@@ -3179,11 +3098,7 @@ function CallControls({ onDataChange }) {
3179
3098
  endcall_type: "CLOSE"
3180
3099
  };
3181
3100
  setPhoneNumber("");
3182
- endCall(END_POINT.END_CALL, payload, {
3183
- params: {
3184
- isBreak: (_q2 = data == null ? void 0 : data.selected_break) != null ? _q2 : false
3185
- }
3186
- });
3101
+ endCall(END_POINT.END_CALL, payload);
3187
3102
  sdkStateManager.endCall();
3188
3103
  setOpenCallDisposition(false);
3189
3104
  };
@@ -3197,13 +3112,8 @@ function CallControls({ onDataChange }) {
3197
3112
  };
3198
3113
  }, []);
3199
3114
  useEffect5(() => {
3200
- const mic = createMicController();
3201
- micRef.current = mic;
3202
- mic.start().catch((err) => {
3203
- console.error("Failed to start mic:", err);
3204
- });
3205
3115
  const handleKeyDown = (event) => {
3206
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
3116
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2;
3207
3117
  const fullState = JSON.parse((_a3 = localStorage.getItem("call-control-sdk-state")) != null ? _a3 : "");
3208
3118
  const key = (_b2 = event.key) == null ? void 0 : _b2.toLowerCase();
3209
3119
  if (!event.altKey || ((_c2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _c2.status) !== "ONCALL") {
@@ -3211,23 +3121,21 @@ function CallControls({ onDataChange }) {
3211
3121
  }
3212
3122
  if (key === "m" && String((_d2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _d2.mute) === "0") {
3213
3123
  event.preventDefault();
3214
- (_e2 = micRef.current) == null ? void 0 : _e2.mute();
3215
3124
  const payload = {
3216
3125
  action: "MUTE",
3217
3126
  userId: fullState.agentId
3218
3127
  };
3219
3128
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3220
3129
  }
3221
- if (key === "u" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.mute) === "1") {
3130
+ if (key === "u" && String((_e2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _e2.mute) === "1") {
3222
3131
  event.preventDefault();
3223
3132
  const payload = {
3224
3133
  action: "UNMUTE",
3225
3134
  userId: fullState.agentId
3226
3135
  };
3227
3136
  muteOrUnMute(END_POINT.MUTE_CALL, payload);
3228
- (_g2 = micRef.current) == null ? void 0 : _g2.unmute();
3229
3137
  }
3230
- if (key === "h" && String((_h2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _h2.hold) === "0") {
3138
+ if (key === "h" && String((_f2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _f2.hold) === "0") {
3231
3139
  event.preventDefault();
3232
3140
  const payload = {
3233
3141
  action: "HOLD",
@@ -3235,7 +3143,7 @@ function CallControls({ onDataChange }) {
3235
3143
  };
3236
3144
  holdOrUnHold(END_POINT.HOLD_CALL, payload);
3237
3145
  }
3238
- if (key === "r" && String((_i2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _i2.hold) === "1") {
3146
+ if (key === "r" && String((_g2 = fullState == null ? void 0 : fullState.callData) == null ? void 0 : _g2.hold) === "1") {
3239
3147
  event.preventDefault();
3240
3148
  const payload = {
3241
3149
  action: "UNHOLD",
@@ -4167,7 +4075,7 @@ async function initSDK({
4167
4075
  apiKey.trim(),
4168
4076
  tenantId.trim(),
4169
4077
  agentId.trim(),
4170
- __spreadValues(__spreadValues({}, initResult == null ? void 0 : initResult.call_controls), sdkConfig),
4078
+ sdkConfig,
4171
4079
  initResult
4172
4080
  );
4173
4081
  } else {