@sawport/react-sdk 0.1.0-alpha.82.1 → 0.1.0-alpha.82.3

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
@@ -26474,6 +26474,7 @@ const SvgCloseLine = (props) => /* @__PURE__ */ reactExports.createElement("svg"
26474
26474
  const SvgMinimize = (props) => /* @__PURE__ */ reactExports.createElement("svg", { fill: "#fff", height: "15px", width: "15px", id: "Layer_1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: "0 0 512 512", xmlSpace: "preserve", ...props }, /* @__PURE__ */ reactExports.createElement("g", null, /* @__PURE__ */ reactExports.createElement("g", null, /* @__PURE__ */ reactExports.createElement("g", null, /* @__PURE__ */ reactExports.createElement("path", { d: "M213.333,42.667C201.551,42.667,192,52.218,192,64v97.83L36.418,6.248c-8.331-8.331-21.839-8.331-30.17,0 c-8.331,8.331-8.331,21.839,0,30.17L161.83,192H64c-11.782,0-21.333,9.551-21.333,21.333c0,11.782,9.551,21.333,21.333,21.333 h149.333c0.007,0,0.014-0.001,0.021-0.001c0.696-0.001,1.391-0.037,2.084-0.105c0.318-0.031,0.627-0.091,0.94-0.136 c0.375-0.054,0.75-0.098,1.122-0.171c0.359-0.071,0.708-0.17,1.061-0.259c0.322-0.081,0.645-0.151,0.964-0.248 c0.346-0.105,0.68-0.234,1.018-0.356c0.318-0.114,0.639-0.219,0.953-0.349c0.316-0.131,0.618-0.284,0.926-0.43 c0.323-0.152,0.649-0.296,0.966-0.465c0.295-0.158,0.575-0.338,0.861-0.509c0.311-0.186,0.626-0.361,0.929-0.564 c0.316-0.211,0.613-0.447,0.917-0.674c0.253-0.19,0.513-0.365,0.759-0.568c1.087-0.892,2.085-1.889,2.977-2.977 c0.202-0.246,0.378-0.506,0.568-0.759c0.228-0.304,0.463-0.601,0.674-0.917c0.203-0.303,0.379-0.618,0.564-0.929 c0.171-0.286,0.351-0.566,0.509-0.861c0.169-0.317,0.313-0.643,0.465-0.966c0.145-0.308,0.299-0.611,0.43-0.926 c0.13-0.314,0.235-0.635,0.349-0.953c0.122-0.338,0.251-0.672,0.356-1.018c0.096-0.318,0.167-0.642,0.248-0.964 c0.089-0.353,0.188-0.701,0.259-1.061c0.074-0.372,0.118-0.748,0.171-1.122c0.045-0.314,0.104-0.622,0.136-0.94 c0.069-0.7,0.106-1.402,0.106-2.105V64C234.667,52.218,225.115,42.667,213.333,42.667z" }), /* @__PURE__ */ reactExports.createElement("path", { d: "M505.752,475.582L350.17,320H448c11.782,0,21.333-9.551,21.333-21.333c0-11.782-9.551-21.333-21.333-21.333H298.667 c-0.703,0-1.405,0.037-2.105,0.106c-0.318,0.031-0.627,0.091-0.94,0.136c-0.375,0.054-0.75,0.098-1.122,0.171 c-0.359,0.071-0.708,0.17-1.061,0.259c-0.322,0.081-0.645,0.151-0.964,0.248c-0.346,0.105-0.68,0.234-1.018,0.356 c-0.318,0.114-0.639,0.219-0.953,0.349c-0.316,0.131-0.618,0.284-0.926,0.43c-0.323,0.152-0.649,0.296-0.966,0.465 c-0.295,0.158-0.575,0.338-0.861,0.509c-0.311,0.186-0.626,0.361-0.929,0.564c-0.316,0.211-0.613,0.447-0.917,0.674 c-0.253,0.19-0.513,0.365-0.759,0.568c-1.087,0.892-2.085,1.889-2.977,2.977c-0.202,0.246-0.378,0.506-0.568,0.759 c-0.228,0.304-0.463,0.601-0.674,0.917c-0.203,0.303-0.379,0.618-0.564,0.929c-0.171,0.286-0.351,0.566-0.509,0.861 c-0.169,0.317-0.313,0.643-0.465,0.966c-0.145,0.308-0.299,0.611-0.43,0.926c-0.13,0.314-0.235,0.635-0.349,0.953 c-0.122,0.338-0.251,0.672-0.356,1.018c-0.096,0.318-0.167,0.642-0.248,0.964c-0.089,0.353-0.188,0.701-0.259,1.061 c-0.074,0.372-0.118,0.748-0.171,1.122c-0.045,0.314-0.104,0.622-0.136,0.94c-0.068,0.693-0.105,1.388-0.105,2.084 c0,0.007-0.001,0.014-0.001,0.021V448c0,11.782,9.551,21.333,21.333,21.333c11.782,0,21.333-9.551,21.333-21.333v-97.83 l155.582,155.582c8.331,8.331,21.839,8.331,30.17,0C514.083,497.42,514.083,483.913,505.752,475.582z" })))));
26475
26475
  const SvgDoubleTick = (props) => /* @__PURE__ */ reactExports.createElement("svg", { id: "Layer_1", "data-name": "Layer 1", width: "10px", height: "10px", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 122.88 74.46", ...props }, /* @__PURE__ */ reactExports.createElement("defs", null), /* @__PURE__ */ reactExports.createElement("title", null, "double-tick"), /* @__PURE__ */ reactExports.createElement("g", null, /* @__PURE__ */ reactExports.createElement("path", { d: "M1.87,47.2a6.33,6.33,0,1,1,8.92-9c8.88,8.85,17.53,17.66,26.53,26.45l-3.76,4.45-.35.37a6.33,6.33,0,0,1-8.95,0L1.87,47.2ZM30,43.55a6.33,6.33,0,1,1,8.82-9.07l25,24.38L111.64,2.29c5.37-6.35,15,1.84,9.66,8.18L69.07,72.22l-.3.33a6.33,6.33,0,0,1-8.95.12L30,43.55Zm28.76-4.21-.31.33-9.07-8.85L71.67,4.42c5.37-6.35,15,1.83,9.67,8.18L58.74,39.34Z" })));
26476
26476
  const SvgTick = (props) => /* @__PURE__ */ reactExports.createElement("svg", { id: "Layer_1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", x: "0px", y: "0px", width: "10px", height: "10px", viewBox: "0 0 122.881 89.842", enableBackground: "new 0 0 122.881 89.842", xmlSpace: "preserve", ...props }, /* @__PURE__ */ reactExports.createElement("g", null, /* @__PURE__ */ reactExports.createElement("path", { d: "M1.232,55.541c-1.533-1.388-1.652-3.756-0.265-5.289c1.388-1.534,3.756-1.652,5.29-0.265l34.053,30.878l76.099-79.699 c1.429-1.501,3.804-1.561,5.305-0.132c1.502,1.428,1.561,3.803,0.133,5.305L43.223,88.683l-0.005-0.005 c-1.396,1.468-3.716,1.563-5.227,0.196L1.232,55.541L1.232,55.541z" })));
26477
+ const SvgStopScreen = (props) => /* @__PURE__ */ reactExports.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 20", width: 24, height: 24, fill: "currentColor", ...props }, /* @__PURE__ */ reactExports.createElement("rect", { x: 1, y: 1, width: 22, height: 16, rx: 2, ry: 2, stroke: "white", fill: "none", strokeWidth: 2 }), /* @__PURE__ */ reactExports.createElement("rect", { x: 7, y: 5, width: 10, height: 6, fill: "white" }));
26477
26478
  const calendars = (params) => api("/calendars", params);
26478
26479
  const viewCalendar = (id2, params) => api("/calendars/" + id2, params);
26479
26480
  const updateCalendar = (id2, params) => api("/calendars/" + id2, params, "put");
@@ -75464,7 +75465,7 @@ const ChatMessage = reactExports.memo(function({
75464
75465
  ext: attachment == null ? void 0 : attachment.split(".").pop()
75465
75466
  }, [attachment]);
75466
75467
  return msg.isSender ? /* @__PURE__ */ jsx("div", {
75467
- className: "chat-send-container mb-5",
75468
+ className: "chat-send-container mb-2",
75468
75469
  children: ((_a = msg.message) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxs(Fragment, {
75469
75470
  children: [/* @__PURE__ */ jsx("p", {
75470
75471
  className: "widget-chat-send",
@@ -75556,7 +75557,7 @@ const ChatMessage = reactExports.memo(function({
75556
75557
  })]
75557
75558
  }) : null
75558
75559
  }, msg.id) : /* @__PURE__ */ jsxs("div", {
75559
- className: "chat-receive-container mb-4 d-flex align-items-center",
75560
+ className: "chat-receive-container mb-2 d-flex align-items-center",
75560
75561
  children: [/* @__PURE__ */ jsxs("div", {
75561
75562
  className: "pt-3 mr-1",
75562
75563
  children: [/* @__PURE__ */ jsx(Avatar, {
@@ -75738,30 +75739,13 @@ function ChatWidgetScreen({
75738
75739
  setChatClose,
75739
75740
  videoRef,
75740
75741
  company,
75741
- isOngoingChat,
75742
- handleOk,
75743
- popupVisible,
75744
- handleCancel,
75745
- setPopupVisible
75742
+ isOngoingChat
75746
75743
  }) {
75747
75744
  var _a, _b, _c, _d, _e, _f;
75748
75745
  const {
75749
75746
  socket: socket2
75750
75747
  } = useSocket();
75751
75748
  const timeoutRef = reactExports.useRef();
75752
- const [{
75753
- typingEvent,
75754
- agentDetails,
75755
- waitlistTransferredStatus,
75756
- transferredAgent,
75757
- agentConnected
75758
- }, setEvent] = useState({
75759
- typingEvent: false,
75760
- agentDetails: void 0,
75761
- waitlistTransferredStatus: null,
75762
- transferredAgent: null,
75763
- agentConnected: false
75764
- });
75765
75749
  const [{
75766
75750
  pdfModal,
75767
75751
  selectedPdfURL
@@ -75798,18 +75782,13 @@ function ChatWidgetScreen({
75798
75782
  const el2 = document.getElementById("widget-chat-send");
75799
75783
  el2.scrollTop = el2.scrollHeight;
75800
75784
  }, []);
75801
- if (typingEvent && waitlistTransferredStatus)
75802
- setEvent((state) => {
75803
- state.waitlistTransferredStatus = false;
75804
- state.transferredAgent = null;
75805
- });
75806
75785
  const listeners2 = reactExports.useMemo(() => {
75807
- var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j;
75786
+ var _a2, _b2, _c2, _d2, _e2;
75808
75787
  return {
75809
75788
  [`message.new.${((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation)}`]: async ({
75810
75789
  message
75811
75790
  }) => {
75812
- var _a3, _b3, _c3, _d3, _e3, _f3, _g2;
75791
+ var _a3, _b3, _c3, _d3, _e3, _f2, _g;
75813
75792
  const sender = ((_a3 = message.user) == null ? void 0 : _a3.id) || message.user;
75814
75793
  const customer = (_b3 = dataRef.current) == null ? void 0 : _b3.customer;
75815
75794
  const isSender = ((_c3 = customer == null ? void 0 : customer.user) == null ? void 0 : _c3.id) === (((_d3 = message.user) == null ? void 0 : _d3.id) || message.user);
@@ -75822,8 +75801,8 @@ function ChatWidgetScreen({
75822
75801
  if (sender !== ((_e3 = customer == null ? void 0 : customer.user) == null ? void 0 : _e3.id)) {
75823
75802
  t$5.emit("agent-joined", message.user);
75824
75803
  }
75825
- if (agentDetails == null ? void 0 : agentDetails.userId) {
75826
- await readConversation(((_f3 = dataRef.current) == null ? void 0 : _f3.wait.conversation.id) || ((_g2 = dataRef.current) == null ? void 0 : _g2.wait.conversation), agentDetails == null ? void 0 : agentDetails.userId);
75804
+ if (!isSender) {
75805
+ readConversation((_f2 = dataRef.current) == null ? void 0 : _f2.wait.conversation.id, (_g = message.user) == null ? void 0 : _g.id);
75827
75806
  }
75828
75807
  },
75829
75808
  [`Conversation.read.${((_c2 = dataRef.current) == null ? void 0 : _c2.wait.conversation.id) || ((_d2 = dataRef.current) == null ? void 0 : _d2.wait.conversation)}`]: async ({
@@ -75844,47 +75823,6 @@ function ChatWidgetScreen({
75844
75823
  },
75845
75824
  [`WaitList.closed.${(_e2 = dataRef.current) == null ? void 0 : _e2.wait.id}`]: () => {
75846
75825
  setChatClose(false, false);
75847
- },
75848
- [`agent.connected.${(_f2 = dataRef.current) == null ? void 0 : _f2.wait.id}`]: ({
75849
- agent
75850
- }) => {
75851
- const audio = new Audio(connectedSound);
75852
- audio.play();
75853
- setEvent((state) => {
75854
- state.agentConnected = true;
75855
- state.transferredAgent = agent;
75856
- });
75857
- },
75858
- [`WaitList.transferred.${((_g = dataRef.current) == null ? void 0 : _g.wait.conversation.id) || ((_h = dataRef.current) == null ? void 0 : _h.wait.conversation)}`]: ({
75859
- agent
75860
- }) => {
75861
- setEvent((state) => {
75862
- state.waitlistTransferredStatus = true;
75863
- state.transferredAgent = agent;
75864
- });
75865
- t$5.emit("agent-joined", {
75866
- ...agent.user,
75867
- agent
75868
- });
75869
- },
75870
- [`typing.${((_i = dataRef.current) == null ? void 0 : _i.wait.conversation.id) || ((_j = dataRef.current) == null ? void 0 : _j.wait.conversation)}`]: ({
75871
- data: data2
75872
- }) => {
75873
- setEvent((state) => {
75874
- state.typingEvent = true;
75875
- state.agentDetails = data2 == null ? void 0 : data2.agentDetails;
75876
- state.agentConnected = false;
75877
- if (state.timeOut) {
75878
- clearTimeout(state.timeOut);
75879
- }
75880
- state.timeOut = setTimeout(() => {
75881
- setEvent({
75882
- timeOut: true,
75883
- typingEvent: false
75884
- });
75885
- }, 2e3);
75886
- return state;
75887
- });
75888
75826
  }
75889
75827
  };
75890
75828
  }, [(_c = (_b = dataRef.current) == null ? void 0 : _b.customer) == null ? void 0 : _c.id, t$5, setChatClose, ((_d = dataRef.current) == null ? void 0 : _d.wait.conversation.id) || ((_e = dataRef.current) == null ? void 0 : _e.wait.conversation), (_f = dataRef.current) == null ? void 0 : _f.wait.id]);
@@ -75894,17 +75832,6 @@ function ChatWidgetScreen({
75894
75832
  reactExports.useEffect(() => {
75895
75833
  isOngoingChat && clearInterval(timeoutRef.current);
75896
75834
  }, [timeoutRef, isOngoingChat]);
75897
- reactExports.useEffect(() => {
75898
- var _a2;
75899
- if (!agentConnected && !agentDetails) {
75900
- const intervalId = setInterval(() => {
75901
- setPopupVisible(true);
75902
- }, (_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime);
75903
- return () => clearInterval(intervalId);
75904
- } else {
75905
- setPopupVisible(false);
75906
- }
75907
- }, [agentConnected, agentDetails]);
75908
75835
  reactExports.useEffect(() => {
75909
75836
  var _a2, _b2, _c2;
75910
75837
  socket2.connected && socket2.emit("customer-joined-conversation", {
@@ -75922,7 +75849,7 @@ function ChatWidgetScreen({
75922
75849
  id: "widget-chat-send",
75923
75850
  className: "widget-chat-display-container",
75924
75851
  children: [/* @__PURE__ */ jsx("div", {
75925
- className: "chat-receive-container mb-4 d-flex align-items-center",
75852
+ className: "chat-receive-container mb-2 d-flex align-items-center",
75926
75853
  children: /* @__PURE__ */ jsx("p", {
75927
75854
  className: `widget-chat-receive mb-0`,
75928
75855
  children: welcome_message
@@ -75934,15 +75861,6 @@ function ChatWidgetScreen({
75934
75861
  setPDFstate,
75935
75862
  setViewstate
75936
75863
  })]
75937
- }), /* @__PURE__ */ jsx(ChatInput, {
75938
- dataRef,
75939
- agentDetails,
75940
- transferredAgent,
75941
- waitlistTransferredStatus,
75942
- agentConnected,
75943
- popupVisible,
75944
- handleCancel,
75945
- handleOk
75946
75864
  }), /* @__PURE__ */ jsx(ViewDocument$1, {
75947
75865
  open: pdfModal,
75948
75866
  fileURL: selectedPdfURL,
@@ -75951,26 +75869,47 @@ function ChatWidgetScreen({
75951
75869
  open: videoModal,
75952
75870
  fileURL: selectedVideoFileURL,
75953
75871
  setVideoState: setViewstate
75954
- }), /* @__PURE__ */ jsx("span", {
75955
- style: {
75956
- fontStyle: "italic",
75957
- fontSize: "10px"
75958
- },
75959
- children: agentDetails && typingEvent ? `${agentDetails == null ? void 0 : agentDetails.firstName} is typing...` : ""
75960
75872
  })]
75961
75873
  });
75962
75874
  }
75963
75875
  const ChatInput = reactExports.memo(function({
75964
75876
  dataRef,
75965
- agentDetails,
75966
- transferredAgent,
75967
- waitlistTransferredStatus,
75968
- agentConnected,
75969
75877
  popupVisible,
75970
75878
  handleCancel,
75971
- handleOk
75879
+ handleOk,
75880
+ setPopupVisible,
75881
+ company
75972
75882
  }) {
75973
- var _a;
75883
+ var _a, _b, _c, _d;
75884
+ const [{
75885
+ typingEvent,
75886
+ agentDetails,
75887
+ waitlistTransferredStatus,
75888
+ transferredAgent,
75889
+ agentConnected
75890
+ }, setEvent] = useState({
75891
+ typingEvent: false,
75892
+ agentDetails: void 0,
75893
+ waitlistTransferredStatus: null,
75894
+ transferredAgent: null,
75895
+ agentConnected: false
75896
+ });
75897
+ if (typingEvent && waitlistTransferredStatus)
75898
+ setEvent((state) => {
75899
+ state.waitlistTransferredStatus = false;
75900
+ state.transferredAgent = null;
75901
+ });
75902
+ reactExports.useEffect(() => {
75903
+ var _a2;
75904
+ if (!agentConnected && !agentDetails) {
75905
+ const intervalId = setInterval(() => {
75906
+ setPopupVisible(true);
75907
+ }, (_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime);
75908
+ return () => clearInterval(intervalId);
75909
+ } else {
75910
+ setPopupVisible(false);
75911
+ }
75912
+ }, [agentConnected, agentDetails, company]);
75974
75913
  const [{
75975
75914
  chatFiles
75976
75915
  }, setState, stateRef] = useState({
@@ -75981,12 +75920,12 @@ const ChatInput = reactExports.memo(function({
75981
75920
  socket: socket2
75982
75921
  } = useSocket();
75983
75922
  const sendMessage = async () => {
75984
- var _a2, _b, _c, _d;
75923
+ var _a2, _b2, _c2, _d2;
75985
75924
  if (((_a2 = stateRef.current.messageText) == null ? void 0 : _a2.length) || stateRef.current.chatFiles) {
75986
75925
  socket2.emit("messageFromClient", {
75987
75926
  message: stateRef.current.messageText,
75988
- conversation: (_b = dataRef.current) == null ? void 0 : _b.wait.conversation.id,
75989
- customer: ((_c = dataRef.current) == null ? void 0 : _c.customer.id) || ((_d = dataRef.current) == null ? void 0 : _d.customer)
75927
+ conversation: (_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation.id,
75928
+ customer: ((_c2 = dataRef.current) == null ? void 0 : _c2.customer.id) || ((_d2 = dataRef.current) == null ? void 0 : _d2.customer)
75990
75929
  });
75991
75930
  }
75992
75931
  document.getElementById("widget-chat-input-field").value = "";
@@ -75997,11 +75936,11 @@ const ChatInput = reactExports.memo(function({
75997
75936
  });
75998
75937
  };
75999
75938
  const sendFile = reactExports.useCallback(async () => {
76000
- var _a2, _b, _c;
75939
+ var _a2, _b2, _c2;
76001
75940
  try {
76002
75941
  const data2 = new FormData();
76003
75942
  data2.append("customer", (_a2 = dataRef.current) == null ? void 0 : _a2.customer.id);
76004
- data2.append("conversation", (_c = (_b = dataRef.current) == null ? void 0 : _b.wait) == null ? void 0 : _c.conversation.id);
75943
+ data2.append("conversation", (_c2 = (_b2 = dataRef.current) == null ? void 0 : _b2.wait) == null ? void 0 : _c2.conversation.id);
76005
75944
  data2.append("message", stateRef == null ? void 0 : stateRef.current.messageText);
76006
75945
  data2.append("attachment", stateRef == null ? void 0 : stateRef.current.chatFiles);
76007
75946
  await createMessage(data2, {
@@ -76020,9 +75959,9 @@ const ChatInput = reactExports.memo(function({
76020
75959
  }
76021
75960
  }, [stateRef, dataRef, socket2.connected, stateRef]);
76022
75961
  const handleFileUpload = (event) => {
76023
- var _a2, _b, _c;
75962
+ var _a2, _b2, _c2;
76024
75963
  if ((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.files[0]) {
76025
- const fileExtension = (_c = (_b = event == null ? void 0 : event.target) == null ? void 0 : _b.files[0]) == null ? void 0 : _c.type.split("/").pop();
75964
+ const fileExtension = (_c2 = (_b2 = event == null ? void 0 : event.target) == null ? void 0 : _b2.files[0]) == null ? void 0 : _c2.type.split("/").pop();
76026
75965
  if (["image", "video", "document"].includes(isFileType(fileExtension))) {
76027
75966
  const file = event.target.files[0];
76028
75967
  const fileSizeLimit = 4 * 1024 * 1024;
@@ -76045,20 +75984,69 @@ const ChatInput = reactExports.memo(function({
76045
75984
  }
76046
75985
  };
76047
75986
  const onChange = (e2) => {
76048
- var _a2, _b;
75987
+ var _a2, _b2;
76049
75988
  setState({
76050
75989
  messageText: e2.target.value
76051
75990
  });
76052
75991
  (agentDetails == null ? void 0 : agentDetails.userId) && socket2.emit("typing", {
76053
75992
  to: agentDetails == null ? void 0 : agentDetails.userId,
76054
- conversation: ((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b = dataRef.current) == null ? void 0 : _b.wait.conversation),
75993
+ conversation: ((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation),
76055
75994
  message: e2.target.value
76056
75995
  });
76057
75996
  };
76058
- return /* @__PURE__ */ jsx(Fragment, {
76059
- children: /* @__PURE__ */ jsxs("div", {
75997
+ const listeners2 = reactExports.useMemo(() => {
75998
+ var _a2, _b2, _c2, _d2, _e;
75999
+ return {
76000
+ [`agent.connected.${(_a2 = dataRef.current) == null ? void 0 : _a2.wait.id}`]: ({
76001
+ agent
76002
+ }) => {
76003
+ const audio = new Audio(connectedSound);
76004
+ audio.play();
76005
+ setEvent((state) => {
76006
+ state.agentConnected = true;
76007
+ state.transferredAgent = agent;
76008
+ });
76009
+ },
76010
+ [`WaitList.transferred.${((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation.id) || ((_c2 = dataRef.current) == null ? void 0 : _c2.wait.conversation)}`]: ({
76011
+ agent
76012
+ }) => {
76013
+ setEvent((state) => {
76014
+ state.waitlistTransferredStatus = true;
76015
+ state.transferredAgent = agent;
76016
+ });
76017
+ t$5.emit("agent-joined", {
76018
+ ...agent.user,
76019
+ agent
76020
+ });
76021
+ },
76022
+ [`typing.${((_d2 = dataRef.current) == null ? void 0 : _d2.wait.conversation.id) || ((_e = dataRef.current) == null ? void 0 : _e.wait.conversation)}`]: ({
76023
+ data: data2
76024
+ }) => {
76025
+ setEvent((state) => {
76026
+ state.typingEvent = true;
76027
+ state.agentDetails = data2 == null ? void 0 : data2.agentDetails;
76028
+ state.agentConnected = false;
76029
+ if (state.timeOut) {
76030
+ clearTimeout(state.timeOut);
76031
+ }
76032
+ state.timeOut = setTimeout(() => {
76033
+ setEvent({
76034
+ timeOut: true,
76035
+ typingEvent: false
76036
+ });
76037
+ }, 2e3);
76038
+ return state;
76039
+ });
76040
+ }
76041
+ };
76042
+ }, [t$5, ((_a = dataRef.current) == null ? void 0 : _a.wait.conversation.id) || ((_b = dataRef.current) == null ? void 0 : _b.wait.conversation), (_c = dataRef.current) == null ? void 0 : _c.wait.id]);
76043
+ useSocketListeners({
76044
+ listeners: listeners2
76045
+ });
76046
+ return /* @__PURE__ */ jsxs(Fragment, {
76047
+ children: [/* @__PURE__ */ jsxs("div", {
76060
76048
  className: "widget-chat-form-container w-100 justify-content-between align-items-center",
76061
- children: [/* @__PURE__ */ jsx("p", {
76049
+ children: [(waitlistTransferredStatus || agentConnected) && /* @__PURE__ */ jsx("p", {
76062
76050
  className: "transfer-notification",
76063
76051
  children: waitlistTransferredStatus ? `You have been transferred to ${transferredAgent == null ? void 0 : transferredAgent.first_name} from ${transferredAgent == null ? void 0 : transferredAgent.team}
76064
76052
  Team` : agentConnected ? `You are now connected to ${transferredAgent == null ? void 0 : transferredAgent.first_name} ${transferredAgent == null ? void 0 : transferredAgent.last_name}` : ""
@@ -76093,7 +76081,7 @@ const ChatInput = reactExports.memo(function({
76093
76081
  id: "widget-chat-input-field",
76094
76082
  autoComplete: "off",
76095
76083
  autoFocus: true,
76096
- disabled: ((_a = document.getElementById("widget-file-upload-input")) == null ? void 0 : _a.value) !== ""
76084
+ disabled: ((_d = document.getElementById("widget-file-upload-input")) == null ? void 0 : _d.value) !== ""
76097
76085
  }), /* @__PURE__ */ jsx("img", {
76098
76086
  onClick: chatFiles ? sendFile : sendMessage,
76099
76087
  className: "widget-send-img",
@@ -76111,7 +76099,13 @@ const ChatInput = reactExports.memo(function({
76111
76099
  onCancel: handleCancel
76112
76100
  })]
76113
76101
  })]
76114
- })
76102
+ }), /* @__PURE__ */ jsx("span", {
76103
+ style: {
76104
+ fontStyle: "italic",
76105
+ fontSize: "10px"
76106
+ },
76107
+ children: agentDetails && typingEvent ? `${agentDetails == null ? void 0 : agentDetails.firstName} is typing...` : ""
76108
+ })]
76115
76109
  });
76116
76110
  });
76117
76111
  const Messages = reactExports.memo(function({
@@ -77077,6 +77071,7 @@ function useVideoCalling({ userId, conversation_id }) {
77077
77071
  otherUserScreenShared: false,
77078
77072
  ...append2
77079
77073
  });
77074
+ t$5.emit("video-state", false);
77080
77075
  stopSound();
77081
77076
  };
77082
77077
  const initPeer = reactExports.useCallback(
@@ -77201,6 +77196,7 @@ function useVideoCalling({ userId, conversation_id }) {
77201
77196
  if (userId) {
77202
77197
  const incoming = async (data2) => {
77203
77198
  ref.current.data = data2;
77199
+ t$5.emit("video-state", true);
77204
77200
  if (!stateRef.current.getCalled) {
77205
77201
  playSound(callignSound, (sound2) => sound2.loop = true);
77206
77202
  setState({ isIncoming: true });
@@ -77270,7 +77266,8 @@ function useVideoCalling({ userId, conversation_id }) {
77270
77266
  ref,
77271
77267
  initPeer,
77272
77268
  sendOffer,
77273
- playSound
77269
+ playSound,
77270
+ t$5
77274
77271
  ]);
77275
77272
  useSocketListeners({ listeners: listeners2 });
77276
77273
  reactExports.useEffect(() => {
@@ -77573,7 +77570,10 @@ const Controls = ({
77573
77570
  })
77574
77571
  }), !!(startScreenSharing || stopScreenSharing) && /* @__PURE__ */ jsx(ActionBtn, {
77575
77572
  onClick: screenShared ? stopScreenSharing : startScreenSharing,
77576
- children: /* @__PURE__ */ jsx(SvgDesktop, {
77573
+ children: screenShared ? /* @__PURE__ */ jsx(SvgStopScreen, {
77574
+ width: 20,
77575
+ height: 20
77576
+ }) : /* @__PURE__ */ jsx(SvgDesktop, {
77577
77577
  width: 20,
77578
77578
  height: 20
77579
77579
  })
@@ -78603,18 +78603,27 @@ const ChatMode = reactExports.memo(({
78603
78603
  fields: company == null ? void 0 : company.fields,
78604
78604
  widgetColor: company == null ? void 0 : company.hex_code,
78605
78605
  customer
78606
- }) : /* @__PURE__ */ jsx(ChatWidgetScreen$1, {
78607
- welcome_message: company == null ? void 0 : company.welcome_message,
78608
- dataRef,
78609
- setChatClose,
78610
- videoRef,
78611
- company,
78612
- agent: agent_,
78613
- isOngoingChat,
78614
- handleOk,
78615
- popupVisible,
78616
- handleCancel,
78617
- setPopupVisible
78606
+ }) : /* @__PURE__ */ jsxs(Fragment, {
78607
+ children: [/* @__PURE__ */ jsx(ChatWidgetScreen$1, {
78608
+ welcome_message: company == null ? void 0 : company.welcome_message,
78609
+ dataRef,
78610
+ setChatClose,
78611
+ videoRef,
78612
+ company,
78613
+ agent: agent_,
78614
+ isOngoingChat,
78615
+ handleOk,
78616
+ popupVisible,
78617
+ handleCancel,
78618
+ setPopupVisible
78619
+ }), /* @__PURE__ */ jsx(ChatInput, {
78620
+ dataRef,
78621
+ popupVisible,
78622
+ handleCancel,
78623
+ handleOk,
78624
+ setPopupVisible,
78625
+ company
78626
+ })]
78618
78627
  });
78619
78628
  });
78620
78629
  const OngoingChat = ({