call-control-sdk 6.5.4 → 6.5.5-uat.1

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
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
23
23
  import { getItem, removeItem, setItem } from "@react-solutions/vault";
24
24
 
25
25
  // call-control-sdk/lib/services/endPoint.ts
26
- var IP = "cti.aighospitals.com";
26
+ var IP = "uat-cti.aighospitals.com";
27
27
  var BASE_URL = `https://${IP}:8095`;
28
28
  var WS_BASE_URL = `wss://${IP}:8095`;
29
29
  var VERSION = {
@@ -83,6 +83,7 @@ var SDKStateManager = class {
83
83
  sdkConfig: {
84
84
  disableEndCallButton: false,
85
85
  disabledDialButton: false,
86
+ disabledMoreOptionsButton: false,
86
87
  enableSmsServices: false,
87
88
  enableQueueName: false,
88
89
  disableCallTransferButton: false,
@@ -177,6 +178,7 @@ var SDKStateManager = class {
177
178
  isInitialized: parsedState.isInitialized || false,
178
179
  sdkConfig: parsedState.sdkConfig || {
179
180
  disableEndCallButton: false,
181
+ disabledMoreOptionsButton: false,
180
182
  enableSmsServices: false,
181
183
  enableQueueName: false,
182
184
  disabledDialButton: false,
@@ -260,6 +262,7 @@ var SDKStateManager = class {
260
262
  disableEndCallButton: false,
261
263
  disabledDialButton: false,
262
264
  enableSmsServices: false,
265
+ disabledMoreOptionsButton: false,
263
266
  enableQueueName: false,
264
267
  disableCallTransferButton: false,
265
268
  isDraggable: true,
@@ -825,7 +828,8 @@ import {
825
828
  Upcoming as Upcoming2,
826
829
  WifiCalling3,
827
830
  SendRounded,
828
- SmsSharp
831
+ SmsSharp,
832
+ MoreVert
829
833
  } from "@mui/icons-material";
830
834
  import {
831
835
  Box as Box2,
@@ -2987,7 +2991,7 @@ var formatDuration = (seconds) => {
2987
2991
  return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
2988
2992
  };
2989
2993
  function CallControls({ onDataChange }) {
2990
- 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;
2994
+ 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, _wa, _xa, _ya;
2991
2995
  const theme = useTheme3();
2992
2996
  const state = useSDKState();
2993
2997
  const { showToast } = useToast();
@@ -3009,6 +3013,7 @@ function CallControls({ onDataChange }) {
3009
3013
  const [statusAnchorEl, setStatusAnchorEl] = useState10(null);
3010
3014
  const [dialerAnchorEl, setDialerAnchorEl] = useState10(null);
3011
3015
  const [ambulanceAnchorEl, setAmbulanceAnchorEl] = useState10(null);
3016
+ const [moreOptionsAnchorEl, setMoreOptionsAnchorEl] = useState10(null);
3012
3017
  const [showIframe, setShowIframe] = useState10(true);
3013
3018
  const [openCallDisposition, setOpenCallDisposition] = useState10(false);
3014
3019
  const [openProcessorDialog, setOpenProcessorDialog] = useState10(false);
@@ -3067,12 +3072,18 @@ function CallControls({ onDataChange }) {
3067
3072
  const handleOpenAbulanceServices = (event) => {
3068
3073
  setAmbulanceAnchorEl(event.currentTarget);
3069
3074
  };
3075
+ const handleOpenMoreOptions = (event) => {
3076
+ setMoreOptionsAnchorEl(event.currentTarget);
3077
+ };
3070
3078
  const handleCloseDialer = () => {
3071
3079
  setDialerAnchorEl(null);
3072
3080
  };
3073
3081
  const handleCloseAmbulance = () => {
3074
3082
  setAmbulanceAnchorEl(null);
3075
3083
  };
3084
+ const handleCloseMoreOptions = () => {
3085
+ setMoreOptionsAnchorEl(null);
3086
+ };
3076
3087
  const handleOpenAgentStatus = (event) => {
3077
3088
  setStatusAnchorEl(event.currentTarget);
3078
3089
  };
@@ -3282,12 +3293,12 @@ function CallControls({ onDataChange }) {
3282
3293
  action: "GETAGENTPROCESSLIST",
3283
3294
  refno: "1234221233"
3284
3295
  }).then((res) => {
3285
- var _a3, _b2;
3286
- if (res && res.data && ((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.length) > 1) {
3296
+ var _a3, _b2, _c2, _d2;
3297
+ if (res && ((_a3 = res.data) == null ? void 0 : _a3.data) && ((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.length) > 1) {
3287
3298
  setProcessList(res.data.data);
3288
3299
  setOpenProcessorDialog(true);
3289
3300
  } else {
3290
- sdkStateManager.setProcess((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data[0]);
3301
+ sdkStateManager.setProcess((_d2 = res == null ? void 0 : res.data) == null ? void 0 : _d2.data[0]);
3291
3302
  setOpenProcessorDialog(false);
3292
3303
  }
3293
3304
  }).catch((err) => {
@@ -3331,78 +3342,76 @@ function CallControls({ onDataChange }) {
3331
3342
  const sdkState = getItem5(STORAGE_KEY);
3332
3343
  const confrence = getCombineConfrenceData(sdkState, data);
3333
3344
  const callData = {
3334
- "agent_id": data == null ? void 0 : data.agent_id,
3335
- "status": data == null ? void 0 : data.status,
3336
- "type": data == null ? void 0 : data.type,
3337
- "event_time": data == null ? void 0 : data.event_time,
3338
- "phone_number": data == null ? void 0 : data.phone_number,
3339
- "convox_id": data == null ? void 0 : data.convox_id,
3340
- "process_id": data == null ? void 0 : data.process_id,
3341
- "process_name": data == null ? void 0 : data.process_name,
3342
- "hold": data == null ? void 0 : data.hold,
3343
- "mute": data == null ? void 0 : data.mute,
3344
- "mode": data == null ? void 0 : data.mode,
3345
- "queue_name": data == null ? void 0 : data.queue_name
3345
+ agent_id: data == null ? void 0 : data.agent_id,
3346
+ status: data == null ? void 0 : data.status,
3347
+ type: data == null ? void 0 : data.type,
3348
+ event_time: data == null ? void 0 : data.event_time,
3349
+ phone_number: data == null ? void 0 : data.phone_number,
3350
+ convox_id: data == null ? void 0 : data.convox_id,
3351
+ process_id: data == null ? void 0 : data.process_id,
3352
+ process_name: data == null ? void 0 : data.process_name,
3353
+ hold: data == null ? void 0 : data.hold,
3354
+ mute: data == null ? void 0 : data.mute,
3355
+ mode: data == null ? void 0 : data.mode,
3356
+ queue_name: data == null ? void 0 : data.queue_name
3346
3357
  };
3347
3358
  sdkStateManager.updateCallData(callData);
3348
3359
  sdkStateManager.updateConferenceData([...confrence]);
3349
3360
  if (["RINGING" /* RINGING */, "DIALING" /* DIALING */].includes(data.status)) {
3350
3361
  setShowIframe(true);
3351
3362
  setCallWrapuptime((_b2 = (_a3 = sdkState == null ? void 0 : sdkState.sdkConfig) == null ? void 0 : _a3.auto_wrapup_time) != null ? _b2 : null);
3352
- sdkStateManager.updateConferenceData(
3353
- [
3354
- {
3355
- line: 1,
3356
- status: "IDLE",
3357
- type: "",
3358
- phone: "",
3359
- isMute: false,
3360
- isHold: false,
3361
- isCallStart: false,
3362
- isMergeCall: false
3363
- },
3364
- {
3365
- line: 2,
3366
- status: "IDLE",
3367
- type: "",
3368
- phone: "",
3369
- isMute: false,
3370
- isHold: false,
3371
- isCallStart: false,
3372
- isMergeCall: false
3373
- },
3374
- {
3375
- line: 3,
3376
- status: "IDLE",
3377
- type: "",
3378
- phone: "",
3379
- isMute: false,
3380
- isHold: false,
3381
- isCallStart: false,
3382
- isMergeCall: false
3383
- },
3384
- {
3385
- line: 4,
3386
- status: "IDLE",
3387
- type: "",
3388
- phone: "",
3389
- isMute: false,
3390
- isHold: false,
3391
- isCallStart: false,
3392
- isMergeCall: false
3393
- },
3394
- {
3395
- line: 5,
3396
- status: "IDLE",
3397
- type: "",
3398
- phone: "",
3399
- isMute: false,
3400
- isHold: false,
3401
- isCallStart: false,
3402
- isMergeCall: false
3403
- }
3404
- ]
3405
- );
3363
+ sdkStateManager.updateConferenceData([
3364
+ {
3365
+ line: 1,
3366
+ status: "IDLE",
3367
+ type: "",
3368
+ phone: "",
3369
+ isMute: false,
3370
+ isHold: false,
3371
+ isCallStart: false,
3372
+ isMergeCall: false
3373
+ },
3374
+ {
3375
+ line: 2,
3376
+ status: "IDLE",
3377
+ type: "",
3378
+ phone: "",
3379
+ isMute: false,
3380
+ isHold: false,
3381
+ isCallStart: false,
3382
+ isMergeCall: false
3383
+ },
3384
+ {
3385
+ line: 3,
3386
+ status: "IDLE",
3387
+ type: "",
3388
+ phone: "",
3389
+ isMute: false,
3390
+ isHold: false,
3391
+ isCallStart: false,
3392
+ isMergeCall: false
3393
+ },
3394
+ {
3395
+ line: 4,
3396
+ status: "IDLE",
3397
+ type: "",
3398
+ phone: "",
3399
+ isMute: false,
3400
+ isHold: false,
3401
+ isCallStart: false,
3402
+ isMergeCall: false
3403
+ },
3404
+ {
3405
+ line: 5,
3406
+ status: "IDLE",
3407
+ type: "",
3408
+ phone: "",
3409
+ isMute: false,
3410
+ isHold: false,
3411
+ isCallStart: false,
3412
+ isMergeCall: false
3413
+ }
3414
+ ]);
3406
3415
  if ((data == null ? void 0 : data.mode) !== "manual" && audioRef.current) {
3407
3416
  audioRef.current.play().catch((error) => {
3408
3417
  console.error("Failed to play ringtone:", error);
@@ -3573,18 +3582,31 @@ function CallControls({ onDataChange }) {
3573
3582
  size: "small",
3574
3583
  onClick: (e) => {
3575
3584
  var _a3, _b2;
3576
- if (!["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(
3577
- (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3578
- )) {
3585
+ if (![
3586
+ "BREAK" /* BREAK */,
3587
+ "ONCALL" /* ONCALL */,
3588
+ "RINGING" /* RINGING */,
3589
+ "WRAPUP" /* WRAPUP */
3590
+ ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3579
3591
  handleOpenDialer(e);
3580
3592
  }
3581
3593
  },
3582
- disabled: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()),
3594
+ disabled: [
3595
+ "BREAK" /* BREAK */,
3596
+ "ONCALL" /* ONCALL */,
3597
+ "RINGING" /* RINGING */,
3598
+ "WRAPUP" /* WRAPUP */
3599
+ ].includes(state.callData.status.toUpperCase()),
3583
3600
  children: /* @__PURE__ */ jsx3(
3584
3601
  WifiCalling3,
3585
3602
  {
3586
3603
  sx: {
3587
- color: ["BREAK" /* BREAK */, "ONCALL" /* ONCALL */, "RINGING" /* RINGING */, "WRAPUP" /* WRAPUP */].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
3604
+ color: [
3605
+ "BREAK" /* BREAK */,
3606
+ "ONCALL" /* ONCALL */,
3607
+ "RINGING" /* RINGING */,
3608
+ "WRAPUP" /* WRAPUP */
3609
+ ].includes(state.callData.status.toUpperCase()) ? "action.selected" : "success.main"
3588
3610
  }
3589
3611
  }
3590
3612
  )
@@ -3655,18 +3677,26 @@ function CallControls({ onDataChange }) {
3655
3677
  /* @__PURE__ */ jsx3(Tooltip2, { title: "Agent Ready", children: /* @__PURE__ */ jsx3(
3656
3678
  Button2,
3657
3679
  {
3658
- variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()) ? "outlined" : "contained",
3680
+ variant: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3681
+ (_t = (_s = state.callData) == null ? void 0 : _s.status) == null ? void 0 : _t.toUpperCase()
3682
+ ) ? "outlined" : "contained",
3659
3683
  onClick: (e) => {
3660
3684
  var _a3, _b2;
3661
- if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3685
+ if (["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3686
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3687
+ )) {
3662
3688
  e.stopPropagation();
3663
3689
  handleAgentReady();
3664
3690
  }
3665
3691
  },
3666
3692
  classes: {
3667
- root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()) ? "outlined" : "enabled"
3693
+ root: ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3694
+ (_v = (_u = state.callData) == null ? void 0 : _u.status) == null ? void 0 : _v.toUpperCase()
3695
+ ) ? "outlined" : "enabled"
3668
3696
  },
3669
- sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes((_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()) ? outlined : enabled),
3697
+ sx: __spreadValues({}, ["BREAK" /* BREAK */, "MISSED" /* MISSED */].includes(
3698
+ (_x = (_w = state.callData) == null ? void 0 : _w.status) == null ? void 0 : _x.toUpperCase()
3699
+ ) ? outlined : enabled),
3670
3700
  disabled: agentReadyLoading,
3671
3701
  children: /* @__PURE__ */ jsx3(SupportAgent2, {})
3672
3702
  }
@@ -3751,22 +3781,19 @@ function CallControls({ onDataChange }) {
3751
3781
  variant: Boolean(ambulanceAnchorEl) ? "contained" : "outlined",
3752
3782
  onClick: (e) => {
3753
3783
  var _a3, _b2;
3754
- if ([
3755
- "ONCALL" /* ONCALL */,
3756
- "WRAPUP" /* WRAPUP */
3757
- ].includes((_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase())) {
3784
+ if (["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
3785
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3786
+ )) {
3758
3787
  e.stopPropagation();
3759
3788
  handleOpenAbulanceServices(e);
3760
3789
  }
3761
3790
  },
3762
- sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : [
3763
- "ONCALL" /* ONCALL */,
3764
- "WRAPUP" /* WRAPUP */
3765
- ].includes((_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3766
- disabled: ![
3767
- "ONCALL" /* ONCALL */,
3768
- "WRAPUP" /* WRAPUP */
3769
- ].includes((_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()),
3791
+ sx: Boolean(ambulanceAnchorEl) ? __spreadValues({}, enabled) : ["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
3792
+ (_ka = (_ja = state.callData) == null ? void 0 : _ja.status) == null ? void 0 : _ka.toUpperCase()
3793
+ ) ? __spreadValues({}, outlined) : __spreadValues({}, disabled),
3794
+ disabled: !["ONCALL" /* ONCALL */, "WRAPUP" /* WRAPUP */].includes(
3795
+ (_ma = (_la = state.callData) == null ? void 0 : _la.status) == null ? void 0 : _ma.toUpperCase()
3796
+ ),
3770
3797
  children: /* @__PURE__ */ jsx3(SmsSharp, {})
3771
3798
  }
3772
3799
  ) }),
@@ -3829,6 +3856,26 @@ function CallControls({ onDataChange }) {
3829
3856
  }
3830
3857
  ) : /* @__PURE__ */ jsx3(CallEnd2, {})
3831
3858
  }
3859
+ ) }),
3860
+ !((_ua = state.sdkConfig) == null ? void 0 : _ua.disabledMoreOptionsButton) && /* @__PURE__ */ jsx3(Tooltip2, { title: "More Options", children: /* @__PURE__ */ jsx3(
3861
+ Button2,
3862
+ {
3863
+ variant: Boolean(moreOptionsAnchorEl) ? "contained" : "outlined",
3864
+ onClick: (e) => {
3865
+ var _a3, _b2;
3866
+ if (["BREAK" /* BREAK */, "IDLE" /* IDLE */].includes(
3867
+ (_b2 = (_a3 = state.callData) == null ? void 0 : _a3.status) == null ? void 0 : _b2.toUpperCase()
3868
+ )) {
3869
+ e.stopPropagation();
3870
+ handleOpenMoreOptions(e);
3871
+ }
3872
+ },
3873
+ sx: Boolean(moreOptionsAnchorEl) ? __spreadValues({}, enabled) : __spreadValues({}, outlined),
3874
+ disabled: !["BREAK" /* BREAK */, "IDLE" /* IDLE */].includes(
3875
+ (_wa = (_va = state.callData) == null ? void 0 : _va.status) == null ? void 0 : _wa.toUpperCase()
3876
+ ),
3877
+ children: /* @__PURE__ */ jsx3(MoreVert, {})
3878
+ }
3832
3879
  ) })
3833
3880
  ]
3834
3881
  }
@@ -3860,7 +3907,7 @@ function CallControls({ onDataChange }) {
3860
3907
  transition: theme.transitions.create(["box-shadow", "transform"], {
3861
3908
  duration: theme.transitions.duration.short
3862
3909
  }),
3863
- visibility: showIframe && !((_ua = state.sdkConfig) == null ? void 0 : _ua.disableSoftPhone) ? "visible" : "hidden",
3910
+ visibility: showIframe && !((_xa = state.sdkConfig) == null ? void 0 : _xa.disableSoftPhone) ? "visible" : "hidden",
3864
3911
  userSelect: "none"
3865
3912
  },
3866
3913
  children: [
@@ -3894,7 +3941,7 @@ function CallControls({ onDataChange }) {
3894
3941
  /* @__PURE__ */ jsx3(Box2, { children: /* @__PURE__ */ jsx3(
3895
3942
  "iframe",
3896
3943
  {
3897
- src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_va = state.process) == null ? void 0 : _va.process_id}`,
3944
+ src: `https://${IP}/ConVoxCCS/iframe?agent_id=${state.agentId}&process_id=${(_ya = state.process) == null ? void 0 : _ya.process_id}`,
3898
3945
  height: 380,
3899
3946
  width: 420,
3900
3947
  allow: "camera; microphone; autoplay",
@@ -4029,6 +4076,60 @@ function CallControls({ onDataChange }) {
4029
4076
  )
4030
4077
  }
4031
4078
  ),
4079
+ /* @__PURE__ */ jsx3(
4080
+ Menu,
4081
+ {
4082
+ anchorEl: moreOptionsAnchorEl,
4083
+ open: Boolean(moreOptionsAnchorEl),
4084
+ onClose: handleCloseMoreOptions,
4085
+ onClick: (e) => e.stopPropagation(),
4086
+ sx: {
4087
+ zIndex: 99999
4088
+ },
4089
+ children: /* @__PURE__ */ jsx3(
4090
+ Box2,
4091
+ {
4092
+ sx: {
4093
+ all: "unset",
4094
+ padding: " 0px 20px",
4095
+ "&hover": {
4096
+ backgroundColor: "white"
4097
+ },
4098
+ display: "flex",
4099
+ alignItems: "center",
4100
+ flexDirection: "column",
4101
+ gap: 1
4102
+ },
4103
+ children: processList == null ? void 0 : processList.map((item) => {
4104
+ var _a3, _b2, _c2;
4105
+ return /* @__PURE__ */ jsx3(
4106
+ Box2,
4107
+ {
4108
+ sx: {
4109
+ width: "100%"
4110
+ },
4111
+ children: /* @__PURE__ */ jsx3(Tooltip2, { title: (_a3 = item == null ? void 0 : item.process_name) != null ? _a3 : "", children: /* @__PURE__ */ jsx3(
4112
+ Button2,
4113
+ {
4114
+ color: "primary",
4115
+ variant: ((_b2 = state == null ? void 0 : state.process) == null ? void 0 : _b2.process_id) === (item == null ? void 0 : item.process_id) ? "contained" : "outlined",
4116
+ onClick: () => {
4117
+ sdkStateManager.setProcess(item);
4118
+ },
4119
+ sx: {
4120
+ width: "100%"
4121
+ },
4122
+ children: (_c2 = item == null ? void 0 : item.process_name) != null ? _c2 : ""
4123
+ }
4124
+ ) })
4125
+ },
4126
+ item == null ? void 0 : item.process_id
4127
+ );
4128
+ })
4129
+ }
4130
+ )
4131
+ }
4132
+ ),
4032
4133
  /* @__PURE__ */ jsx3(
4033
4134
  Menu,
4034
4135
  {