ahs-cti 1.0.0-beta.26 → 1.0.0-beta.28

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 CHANGED
@@ -1599,26 +1599,28 @@ var useClickToCall = () => {
1599
1599
  var import_react5 = require("react");
1600
1600
  init_sdk_state();
1601
1601
  var useGetCallerData = () => {
1602
- const { process_id, process_name, status, phone_number, agent_id, convox_id } = sdkStateManager.getState().callData;
1602
+ const { process_id, process_name, status, phone_number, agent_id, convox_id, call_details } = sdkStateManager.getState().callData;
1603
1603
  const initialCallData = {
1604
1604
  phone_number,
1605
1605
  status,
1606
1606
  callReferenceId: convox_id,
1607
1607
  agent_id,
1608
1608
  process_id,
1609
- process_name
1609
+ process_name,
1610
+ call_details
1610
1611
  };
1611
1612
  const [callData, setCallData] = (0, import_react5.useState)(initialCallData);
1612
1613
  (0, import_react5.useEffect)(() => {
1613
1614
  const unsubscribe = sdkStateManager.subscribe(() => {
1614
- const { process_id: process_id2, process_name: process_name2, status: status2, phone_number: phone_number2, agent_id: agent_id2, convox_id: convox_id2 } = sdkStateManager.getState().callData;
1615
+ const { process_id: process_id2, process_name: process_name2, status: status2, phone_number: phone_number2, agent_id: agent_id2, convox_id: convox_id2, call_details: call_details2 } = sdkStateManager.getState().callData;
1615
1616
  const currentCallData = {
1616
1617
  phone_number: phone_number2,
1617
1618
  status: status2,
1618
1619
  callReferenceId: convox_id2,
1619
1620
  agent_id: agent_id2,
1620
1621
  process_id: process_id2,
1621
- process_name: process_name2
1622
+ process_name: process_name2,
1623
+ call_details: call_details2
1622
1624
  };
1623
1625
  setCallData(currentCallData);
1624
1626
  });
@@ -3363,7 +3365,7 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
3363
3365
  "aria-labelledby": "alert-dialog-title",
3364
3366
  "aria-describedby": "alert-dialog-description",
3365
3367
  maxWidth: "xs",
3366
- slotProps: { paper: { sx: { minWidth: 500 } } },
3368
+ slotProps: { paper: { sx: { minWidth: 650 } } },
3367
3369
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
3368
3370
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3369
3371
  import_material3.Box,
@@ -4420,7 +4422,8 @@ function CallControls({ onDataChange }) {
4420
4422
  hold: data == null ? void 0 : data.hold,
4421
4423
  mute: data == null ? void 0 : data.mute,
4422
4424
  mode: data == null ? void 0 : data.mode,
4423
- queue_name: data == null ? void 0 : data.queue_name
4425
+ queue_name: data == null ? void 0 : data.queue_name,
4426
+ call_details: data == null ? void 0 : data.call_details
4424
4427
  };
4425
4428
  sdkStateManager.updateCallData(callData);
4426
4429
  sdkStateManager.updateConferenceData([...confrence]);
@@ -5764,34 +5767,34 @@ function clickToCall(payload) {
5764
5767
  }
5765
5768
  return Promise.reject(new Error("Agent is not ready"));
5766
5769
  }
5767
- async function clickToConference(payload) {
5768
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5770
+ function clickToConference(payload) {
5771
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
5769
5772
  const state = (0, import_vault7.getSession)(STORAGE_KEY);
5770
- const availableLine = payload.lineNumber != null ? (_a2 = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _a2.find((l) => l.line === payload.lineNumber) : (_c = (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.filter((l) => l.line !== 1)) == null ? void 0 : _c.find((l) => l.status === "IDLE" && !(l == null ? void 0 : l.isCallStart));
5773
+ if (((_a2 = state == null ? void 0 : state.callData) == null ? void 0 : _a2.status) !== "ONCALL") {
5774
+ return Promise.reject(new Error("Conference call requires an active call (ONCALL status)"));
5775
+ }
5776
+ const availableLine = payload.lineNumber != null ? (_b = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _b.find((l) => l.line === payload.lineNumber) : (_d = (_c = state == null ? void 0 : state.conferenceLine) == null ? void 0 : _c.filter((l) => l.line !== 1)) == null ? void 0 : _d.find((l) => l.status === "IDLE" && !(l == null ? void 0 : l.isCallStart));
5771
5777
  if (!availableLine) {
5772
- throw new Error("No available conference line found");
5778
+ return Promise.reject(new Error("No available conference line found"));
5773
5779
  }
5774
5780
  const body = {
5775
5781
  action: "EXTERNAL_CONFERENCE",
5776
5782
  operation: `CALL${availableLine.line}`,
5777
5783
  target: payload.mobileNumber,
5778
5784
  line_number: Number(availableLine.line),
5779
- userid: (_e = (_d = state.callData) == null ? void 0 : _d.agent_id) != null ? _e : -1,
5780
- process: (_g = (_f = state.callData) == null ? void 0 : _f.process_name) != null ? _g : ""
5785
+ userid: (_f = (_e = state.callData) == null ? void 0 : _e.agent_id) != null ? _f : -1,
5786
+ process: (_h = (_g = state.callData) == null ? void 0 : _g.process_name) != null ? _h : ""
5781
5787
  };
5782
- try {
5783
- const res = await axios_default.post(END_POINT.CONFERENCE_CALL, body);
5788
+ return axios_default.post(END_POINT.CONFERENCE_CALL, body).then((res) => {
5784
5789
  try {
5785
5790
  sdkStateManager.setOpenConferenceDialog(true);
5786
5791
  } catch (_) {
5787
5792
  }
5788
- if (!((_h = res == null ? void 0 : res.data) == null ? void 0 : _h.success)) {
5789
- throw res.data;
5790
- }
5791
5793
  return res.data;
5792
- } catch (err) {
5793
- throw new Error((_k = (_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) != null ? _k : "Conference call API failed");
5794
- }
5794
+ }).catch((err) => {
5795
+ var _a3;
5796
+ return (_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.data;
5797
+ });
5795
5798
  }
5796
5799
  async function endCall(options = {}) {
5797
5800
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;