@sawport/react-sdk 0.1.0-alpha.82 → 0.1.0-alpha.82.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.js +140 -136
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -75464,7 +75464,7 @@ const ChatMessage = reactExports.memo(function({
|
|
|
75464
75464
|
ext: attachment == null ? void 0 : attachment.split(".").pop()
|
|
75465
75465
|
}, [attachment]);
|
|
75466
75466
|
return msg.isSender ? /* @__PURE__ */ jsx("div", {
|
|
75467
|
-
className: "chat-send-container mb-
|
|
75467
|
+
className: "chat-send-container mb-2",
|
|
75468
75468
|
children: ((_a = msg.message) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxs(Fragment, {
|
|
75469
75469
|
children: [/* @__PURE__ */ jsx("p", {
|
|
75470
75470
|
className: "widget-chat-send",
|
|
@@ -75556,7 +75556,7 @@ const ChatMessage = reactExports.memo(function({
|
|
|
75556
75556
|
})]
|
|
75557
75557
|
}) : null
|
|
75558
75558
|
}, msg.id) : /* @__PURE__ */ jsxs("div", {
|
|
75559
|
-
className: "chat-receive-container mb-
|
|
75559
|
+
className: "chat-receive-container mb-2 d-flex align-items-center",
|
|
75560
75560
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
75561
75561
|
className: "pt-3 mr-1",
|
|
75562
75562
|
children: [/* @__PURE__ */ jsx(Avatar, {
|
|
@@ -75738,31 +75738,13 @@ function ChatWidgetScreen({
|
|
|
75738
75738
|
setChatClose,
|
|
75739
75739
|
videoRef,
|
|
75740
75740
|
company,
|
|
75741
|
-
isOngoingChat
|
|
75742
|
-
handleOk,
|
|
75743
|
-
popupVisible,
|
|
75744
|
-
handleCancel,
|
|
75745
|
-
setPopupVisible
|
|
75741
|
+
isOngoingChat
|
|
75746
75742
|
}) {
|
|
75747
75743
|
var _a, _b, _c, _d, _e, _f;
|
|
75748
75744
|
const {
|
|
75749
75745
|
socket: socket2
|
|
75750
75746
|
} = useSocket();
|
|
75751
|
-
const bottomRef = reactExports.useRef();
|
|
75752
75747
|
const timeoutRef = reactExports.useRef();
|
|
75753
|
-
const [{
|
|
75754
|
-
typingEvent,
|
|
75755
|
-
agentDetails,
|
|
75756
|
-
waitlistTransferredStatus,
|
|
75757
|
-
transferredAgent,
|
|
75758
|
-
agentConnected
|
|
75759
|
-
}, setEvent] = useState({
|
|
75760
|
-
typingEvent: false,
|
|
75761
|
-
agentDetails: void 0,
|
|
75762
|
-
waitlistTransferredStatus: null,
|
|
75763
|
-
transferredAgent: null,
|
|
75764
|
-
agentConnected: false
|
|
75765
|
-
});
|
|
75766
75748
|
const [{
|
|
75767
75749
|
pdfModal,
|
|
75768
75750
|
selectedPdfURL
|
|
@@ -75793,21 +75775,19 @@ function ChatWidgetScreen({
|
|
|
75793
75775
|
}]
|
|
75794
75776
|
});
|
|
75795
75777
|
reactExports.useEffect(() => {
|
|
75796
|
-
|
|
75797
|
-
(_a2 = bottomRef.current) == null ? void 0 : _a2.scrollIntoView();
|
|
75778
|
+
scrollToBottom();
|
|
75798
75779
|
}, [messages2]);
|
|
75799
|
-
|
|
75800
|
-
|
|
75801
|
-
|
|
75802
|
-
|
|
75803
|
-
});
|
|
75780
|
+
const scrollToBottom = reactExports.useCallback(() => {
|
|
75781
|
+
const el2 = document.getElementById("widget-chat-send");
|
|
75782
|
+
el2.scrollTop = el2.scrollHeight;
|
|
75783
|
+
}, []);
|
|
75804
75784
|
const listeners2 = reactExports.useMemo(() => {
|
|
75805
|
-
var _a2, _b2, _c2, _d2, _e2
|
|
75785
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
75806
75786
|
return {
|
|
75807
75787
|
[`message.new.${((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation)}`]: async ({
|
|
75808
75788
|
message
|
|
75809
75789
|
}) => {
|
|
75810
|
-
var _a3, _b3, _c3, _d3, _e3,
|
|
75790
|
+
var _a3, _b3, _c3, _d3, _e3, _f2, _g;
|
|
75811
75791
|
const sender = ((_a3 = message.user) == null ? void 0 : _a3.id) || message.user;
|
|
75812
75792
|
const customer = (_b3 = dataRef.current) == null ? void 0 : _b3.customer;
|
|
75813
75793
|
const isSender = ((_c3 = customer == null ? void 0 : customer.user) == null ? void 0 : _c3.id) === (((_d3 = message.user) == null ? void 0 : _d3.id) || message.user);
|
|
@@ -75820,8 +75800,8 @@ function ChatWidgetScreen({
|
|
|
75820
75800
|
if (sender !== ((_e3 = customer == null ? void 0 : customer.user) == null ? void 0 : _e3.id)) {
|
|
75821
75801
|
t$5.emit("agent-joined", message.user);
|
|
75822
75802
|
}
|
|
75823
|
-
if (
|
|
75824
|
-
|
|
75803
|
+
if (!isSender) {
|
|
75804
|
+
readConversation((_f2 = dataRef.current) == null ? void 0 : _f2.wait.conversation.id, (_g = message.user) == null ? void 0 : _g.id);
|
|
75825
75805
|
}
|
|
75826
75806
|
},
|
|
75827
75807
|
[`Conversation.read.${((_c2 = dataRef.current) == null ? void 0 : _c2.wait.conversation.id) || ((_d2 = dataRef.current) == null ? void 0 : _d2.wait.conversation)}`]: async ({
|
|
@@ -75842,47 +75822,6 @@ function ChatWidgetScreen({
|
|
|
75842
75822
|
},
|
|
75843
75823
|
[`WaitList.closed.${(_e2 = dataRef.current) == null ? void 0 : _e2.wait.id}`]: () => {
|
|
75844
75824
|
setChatClose(false, false);
|
|
75845
|
-
},
|
|
75846
|
-
[`agent.connected.${(_f2 = dataRef.current) == null ? void 0 : _f2.wait.id}`]: ({
|
|
75847
|
-
agent
|
|
75848
|
-
}) => {
|
|
75849
|
-
const audio = new Audio(connectedSound);
|
|
75850
|
-
audio.play();
|
|
75851
|
-
setEvent((state) => {
|
|
75852
|
-
state.agentConnected = true;
|
|
75853
|
-
state.transferredAgent = agent;
|
|
75854
|
-
});
|
|
75855
|
-
},
|
|
75856
|
-
[`WaitList.transferred.${((_g = dataRef.current) == null ? void 0 : _g.wait.conversation.id) || ((_h = dataRef.current) == null ? void 0 : _h.wait.conversation)}`]: ({
|
|
75857
|
-
agent
|
|
75858
|
-
}) => {
|
|
75859
|
-
setEvent((state) => {
|
|
75860
|
-
state.waitlistTransferredStatus = true;
|
|
75861
|
-
state.transferredAgent = agent;
|
|
75862
|
-
});
|
|
75863
|
-
t$5.emit("agent-joined", {
|
|
75864
|
-
...agent.user,
|
|
75865
|
-
agent
|
|
75866
|
-
});
|
|
75867
|
-
},
|
|
75868
|
-
[`typing.${((_i = dataRef.current) == null ? void 0 : _i.wait.conversation.id) || ((_j = dataRef.current) == null ? void 0 : _j.wait.conversation)}`]: ({
|
|
75869
|
-
data: data2
|
|
75870
|
-
}) => {
|
|
75871
|
-
setEvent((state) => {
|
|
75872
|
-
state.typingEvent = true;
|
|
75873
|
-
state.agentDetails = data2 == null ? void 0 : data2.agentDetails;
|
|
75874
|
-
state.agentConnected = false;
|
|
75875
|
-
if (state.timeOut) {
|
|
75876
|
-
clearTimeout(state.timeOut);
|
|
75877
|
-
}
|
|
75878
|
-
state.timeOut = setTimeout(() => {
|
|
75879
|
-
setEvent({
|
|
75880
|
-
timeOut: true,
|
|
75881
|
-
typingEvent: false
|
|
75882
|
-
});
|
|
75883
|
-
}, 2e3);
|
|
75884
|
-
return state;
|
|
75885
|
-
});
|
|
75886
75825
|
}
|
|
75887
75826
|
};
|
|
75888
75827
|
}, [(_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]);
|
|
@@ -75892,17 +75831,6 @@ function ChatWidgetScreen({
|
|
|
75892
75831
|
reactExports.useEffect(() => {
|
|
75893
75832
|
isOngoingChat && clearInterval(timeoutRef.current);
|
|
75894
75833
|
}, [timeoutRef, isOngoingChat]);
|
|
75895
|
-
reactExports.useEffect(() => {
|
|
75896
|
-
var _a2;
|
|
75897
|
-
if (!agentConnected && !agentDetails) {
|
|
75898
|
-
const intervalId = setInterval(() => {
|
|
75899
|
-
setPopupVisible(true);
|
|
75900
|
-
}, (_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime);
|
|
75901
|
-
return () => clearInterval(intervalId);
|
|
75902
|
-
} else {
|
|
75903
|
-
setPopupVisible(false);
|
|
75904
|
-
}
|
|
75905
|
-
}, [agentConnected, agentDetails]);
|
|
75906
75834
|
reactExports.useEffect(() => {
|
|
75907
75835
|
var _a2, _b2, _c2;
|
|
75908
75836
|
socket2.connected && socket2.emit("customer-joined-conversation", {
|
|
@@ -75920,7 +75848,7 @@ function ChatWidgetScreen({
|
|
|
75920
75848
|
id: "widget-chat-send",
|
|
75921
75849
|
className: "widget-chat-display-container",
|
|
75922
75850
|
children: [/* @__PURE__ */ jsx("div", {
|
|
75923
|
-
className: "chat-receive-container mb-
|
|
75851
|
+
className: "chat-receive-container mb-2 d-flex align-items-center",
|
|
75924
75852
|
children: /* @__PURE__ */ jsx("p", {
|
|
75925
75853
|
className: `widget-chat-receive mb-0`,
|
|
75926
75854
|
children: welcome_message
|
|
@@ -75931,19 +75859,7 @@ function ChatWidgetScreen({
|
|
|
75931
75859
|
companyColor: company == null ? void 0 : company.hex_code,
|
|
75932
75860
|
setPDFstate,
|
|
75933
75861
|
setViewstate
|
|
75934
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
75935
|
-
ref: bottomRef,
|
|
75936
|
-
className: "chat-bottom"
|
|
75937
75862
|
})]
|
|
75938
|
-
}), /* @__PURE__ */ jsx(ChatInput, {
|
|
75939
|
-
dataRef,
|
|
75940
|
-
agentDetails,
|
|
75941
|
-
transferredAgent,
|
|
75942
|
-
waitlistTransferredStatus,
|
|
75943
|
-
agentConnected,
|
|
75944
|
-
popupVisible,
|
|
75945
|
-
handleCancel,
|
|
75946
|
-
handleOk
|
|
75947
75863
|
}), /* @__PURE__ */ jsx(ViewDocument$1, {
|
|
75948
75864
|
open: pdfModal,
|
|
75949
75865
|
fileURL: selectedPdfURL,
|
|
@@ -75952,26 +75868,47 @@ function ChatWidgetScreen({
|
|
|
75952
75868
|
open: videoModal,
|
|
75953
75869
|
fileURL: selectedVideoFileURL,
|
|
75954
75870
|
setVideoState: setViewstate
|
|
75955
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
75956
|
-
style: {
|
|
75957
|
-
fontStyle: "italic",
|
|
75958
|
-
fontSize: "10px"
|
|
75959
|
-
},
|
|
75960
|
-
children: agentDetails && typingEvent ? `${agentDetails == null ? void 0 : agentDetails.firstName} is typing...` : ""
|
|
75961
75871
|
})]
|
|
75962
75872
|
});
|
|
75963
75873
|
}
|
|
75964
75874
|
const ChatInput = reactExports.memo(function({
|
|
75965
75875
|
dataRef,
|
|
75966
|
-
agentDetails,
|
|
75967
|
-
transferredAgent,
|
|
75968
|
-
waitlistTransferredStatus,
|
|
75969
|
-
agentConnected,
|
|
75970
75876
|
popupVisible,
|
|
75971
75877
|
handleCancel,
|
|
75972
|
-
handleOk
|
|
75878
|
+
handleOk,
|
|
75879
|
+
setPopupVisible,
|
|
75880
|
+
company
|
|
75973
75881
|
}) {
|
|
75974
|
-
var _a;
|
|
75882
|
+
var _a, _b, _c, _d;
|
|
75883
|
+
const [{
|
|
75884
|
+
typingEvent,
|
|
75885
|
+
agentDetails,
|
|
75886
|
+
waitlistTransferredStatus,
|
|
75887
|
+
transferredAgent,
|
|
75888
|
+
agentConnected
|
|
75889
|
+
}, setEvent] = useState({
|
|
75890
|
+
typingEvent: false,
|
|
75891
|
+
agentDetails: void 0,
|
|
75892
|
+
waitlistTransferredStatus: null,
|
|
75893
|
+
transferredAgent: null,
|
|
75894
|
+
agentConnected: false
|
|
75895
|
+
});
|
|
75896
|
+
if (typingEvent && waitlistTransferredStatus)
|
|
75897
|
+
setEvent((state) => {
|
|
75898
|
+
state.waitlistTransferredStatus = false;
|
|
75899
|
+
state.transferredAgent = null;
|
|
75900
|
+
});
|
|
75901
|
+
reactExports.useEffect(() => {
|
|
75902
|
+
var _a2;
|
|
75903
|
+
if (!agentConnected && !agentDetails) {
|
|
75904
|
+
const intervalId = setInterval(() => {
|
|
75905
|
+
setPopupVisible(true);
|
|
75906
|
+
}, (_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime);
|
|
75907
|
+
return () => clearInterval(intervalId);
|
|
75908
|
+
} else {
|
|
75909
|
+
setPopupVisible(false);
|
|
75910
|
+
}
|
|
75911
|
+
}, [agentConnected, agentDetails, company]);
|
|
75975
75912
|
const [{
|
|
75976
75913
|
chatFiles
|
|
75977
75914
|
}, setState, stateRef] = useState({
|
|
@@ -75982,12 +75919,12 @@ const ChatInput = reactExports.memo(function({
|
|
|
75982
75919
|
socket: socket2
|
|
75983
75920
|
} = useSocket();
|
|
75984
75921
|
const sendMessage = async () => {
|
|
75985
|
-
var _a2,
|
|
75922
|
+
var _a2, _b2, _c2, _d2;
|
|
75986
75923
|
if (((_a2 = stateRef.current.messageText) == null ? void 0 : _a2.length) || stateRef.current.chatFiles) {
|
|
75987
75924
|
socket2.emit("messageFromClient", {
|
|
75988
75925
|
message: stateRef.current.messageText,
|
|
75989
|
-
conversation: (
|
|
75990
|
-
customer: ((
|
|
75926
|
+
conversation: (_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation.id,
|
|
75927
|
+
customer: ((_c2 = dataRef.current) == null ? void 0 : _c2.customer.id) || ((_d2 = dataRef.current) == null ? void 0 : _d2.customer)
|
|
75991
75928
|
});
|
|
75992
75929
|
}
|
|
75993
75930
|
document.getElementById("widget-chat-input-field").value = "";
|
|
@@ -75998,11 +75935,11 @@ const ChatInput = reactExports.memo(function({
|
|
|
75998
75935
|
});
|
|
75999
75936
|
};
|
|
76000
75937
|
const sendFile = reactExports.useCallback(async () => {
|
|
76001
|
-
var _a2,
|
|
75938
|
+
var _a2, _b2, _c2;
|
|
76002
75939
|
try {
|
|
76003
75940
|
const data2 = new FormData();
|
|
76004
75941
|
data2.append("customer", (_a2 = dataRef.current) == null ? void 0 : _a2.customer.id);
|
|
76005
|
-
data2.append("conversation", (
|
|
75942
|
+
data2.append("conversation", (_c2 = (_b2 = dataRef.current) == null ? void 0 : _b2.wait) == null ? void 0 : _c2.conversation.id);
|
|
76006
75943
|
data2.append("message", stateRef == null ? void 0 : stateRef.current.messageText);
|
|
76007
75944
|
data2.append("attachment", stateRef == null ? void 0 : stateRef.current.chatFiles);
|
|
76008
75945
|
await createMessage(data2, {
|
|
@@ -76021,9 +75958,9 @@ const ChatInput = reactExports.memo(function({
|
|
|
76021
75958
|
}
|
|
76022
75959
|
}, [stateRef, dataRef, socket2.connected, stateRef]);
|
|
76023
75960
|
const handleFileUpload = (event) => {
|
|
76024
|
-
var _a2,
|
|
75961
|
+
var _a2, _b2, _c2;
|
|
76025
75962
|
if ((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.files[0]) {
|
|
76026
|
-
const fileExtension = (
|
|
75963
|
+
const fileExtension = (_c2 = (_b2 = event == null ? void 0 : event.target) == null ? void 0 : _b2.files[0]) == null ? void 0 : _c2.type.split("/").pop();
|
|
76027
75964
|
if (["image", "video", "document"].includes(isFileType(fileExtension))) {
|
|
76028
75965
|
const file = event.target.files[0];
|
|
76029
75966
|
const fileSizeLimit = 4 * 1024 * 1024;
|
|
@@ -76046,20 +75983,69 @@ const ChatInput = reactExports.memo(function({
|
|
|
76046
75983
|
}
|
|
76047
75984
|
};
|
|
76048
75985
|
const onChange = (e2) => {
|
|
76049
|
-
var _a2,
|
|
75986
|
+
var _a2, _b2;
|
|
76050
75987
|
setState({
|
|
76051
75988
|
messageText: e2.target.value
|
|
76052
75989
|
});
|
|
76053
75990
|
(agentDetails == null ? void 0 : agentDetails.userId) && socket2.emit("typing", {
|
|
76054
75991
|
to: agentDetails == null ? void 0 : agentDetails.userId,
|
|
76055
|
-
conversation: ((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((
|
|
75992
|
+
conversation: ((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation),
|
|
76056
75993
|
message: e2.target.value
|
|
76057
75994
|
});
|
|
76058
75995
|
};
|
|
76059
|
-
|
|
76060
|
-
|
|
75996
|
+
const listeners2 = reactExports.useMemo(() => {
|
|
75997
|
+
var _a2, _b2, _c2, _d2, _e;
|
|
75998
|
+
return {
|
|
75999
|
+
[`agent.connected.${(_a2 = dataRef.current) == null ? void 0 : _a2.wait.id}`]: ({
|
|
76000
|
+
agent
|
|
76001
|
+
}) => {
|
|
76002
|
+
const audio = new Audio(connectedSound);
|
|
76003
|
+
audio.play();
|
|
76004
|
+
setEvent((state) => {
|
|
76005
|
+
state.agentConnected = true;
|
|
76006
|
+
state.transferredAgent = agent;
|
|
76007
|
+
});
|
|
76008
|
+
},
|
|
76009
|
+
[`WaitList.transferred.${((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation.id) || ((_c2 = dataRef.current) == null ? void 0 : _c2.wait.conversation)}`]: ({
|
|
76010
|
+
agent
|
|
76011
|
+
}) => {
|
|
76012
|
+
setEvent((state) => {
|
|
76013
|
+
state.waitlistTransferredStatus = true;
|
|
76014
|
+
state.transferredAgent = agent;
|
|
76015
|
+
});
|
|
76016
|
+
t$5.emit("agent-joined", {
|
|
76017
|
+
...agent.user,
|
|
76018
|
+
agent
|
|
76019
|
+
});
|
|
76020
|
+
},
|
|
76021
|
+
[`typing.${((_d2 = dataRef.current) == null ? void 0 : _d2.wait.conversation.id) || ((_e = dataRef.current) == null ? void 0 : _e.wait.conversation)}`]: ({
|
|
76022
|
+
data: data2
|
|
76023
|
+
}) => {
|
|
76024
|
+
setEvent((state) => {
|
|
76025
|
+
state.typingEvent = true;
|
|
76026
|
+
state.agentDetails = data2 == null ? void 0 : data2.agentDetails;
|
|
76027
|
+
state.agentConnected = false;
|
|
76028
|
+
if (state.timeOut) {
|
|
76029
|
+
clearTimeout(state.timeOut);
|
|
76030
|
+
}
|
|
76031
|
+
state.timeOut = setTimeout(() => {
|
|
76032
|
+
setEvent({
|
|
76033
|
+
timeOut: true,
|
|
76034
|
+
typingEvent: false
|
|
76035
|
+
});
|
|
76036
|
+
}, 2e3);
|
|
76037
|
+
return state;
|
|
76038
|
+
});
|
|
76039
|
+
}
|
|
76040
|
+
};
|
|
76041
|
+
}, [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]);
|
|
76042
|
+
useSocketListeners({
|
|
76043
|
+
listeners: listeners2
|
|
76044
|
+
});
|
|
76045
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
76046
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
76061
76047
|
className: "widget-chat-form-container w-100 justify-content-between align-items-center",
|
|
76062
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
76048
|
+
children: [(waitlistTransferredStatus || agentConnected) && /* @__PURE__ */ jsx("p", {
|
|
76063
76049
|
className: "transfer-notification",
|
|
76064
76050
|
children: waitlistTransferredStatus ? `You have been transferred to ${transferredAgent == null ? void 0 : transferredAgent.first_name} from ${transferredAgent == null ? void 0 : transferredAgent.team}
|
|
76065
76051
|
Team` : agentConnected ? `You are now connected to ${transferredAgent == null ? void 0 : transferredAgent.first_name} ${transferredAgent == null ? void 0 : transferredAgent.last_name}` : ""
|
|
@@ -76094,7 +76080,7 @@ const ChatInput = reactExports.memo(function({
|
|
|
76094
76080
|
id: "widget-chat-input-field",
|
|
76095
76081
|
autoComplete: "off",
|
|
76096
76082
|
autoFocus: true,
|
|
76097
|
-
disabled: ((
|
|
76083
|
+
disabled: ((_d = document.getElementById("widget-file-upload-input")) == null ? void 0 : _d.value) !== ""
|
|
76098
76084
|
}), /* @__PURE__ */ jsx("img", {
|
|
76099
76085
|
onClick: chatFiles ? sendFile : sendMessage,
|
|
76100
76086
|
className: "widget-send-img",
|
|
@@ -76112,7 +76098,13 @@ const ChatInput = reactExports.memo(function({
|
|
|
76112
76098
|
onCancel: handleCancel
|
|
76113
76099
|
})]
|
|
76114
76100
|
})]
|
|
76115
|
-
})
|
|
76101
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
76102
|
+
style: {
|
|
76103
|
+
fontStyle: "italic",
|
|
76104
|
+
fontSize: "10px"
|
|
76105
|
+
},
|
|
76106
|
+
children: agentDetails && typingEvent ? `${agentDetails == null ? void 0 : agentDetails.firstName} is typing...` : ""
|
|
76107
|
+
})]
|
|
76116
76108
|
});
|
|
76117
76109
|
});
|
|
76118
76110
|
const Messages = reactExports.memo(function({
|
|
@@ -77078,6 +77070,7 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
77078
77070
|
otherUserScreenShared: false,
|
|
77079
77071
|
...append2
|
|
77080
77072
|
});
|
|
77073
|
+
t$5.emit("video-state", false);
|
|
77081
77074
|
stopSound();
|
|
77082
77075
|
};
|
|
77083
77076
|
const initPeer = reactExports.useCallback(
|
|
@@ -77202,6 +77195,7 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
77202
77195
|
if (userId) {
|
|
77203
77196
|
const incoming = async (data2) => {
|
|
77204
77197
|
ref.current.data = data2;
|
|
77198
|
+
t$5.emit("video-state", true);
|
|
77205
77199
|
if (!stateRef.current.getCalled) {
|
|
77206
77200
|
playSound(callignSound, (sound2) => sound2.loop = true);
|
|
77207
77201
|
setState({ isIncoming: true });
|
|
@@ -77271,7 +77265,8 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
77271
77265
|
ref,
|
|
77272
77266
|
initPeer,
|
|
77273
77267
|
sendOffer,
|
|
77274
|
-
playSound
|
|
77268
|
+
playSound,
|
|
77269
|
+
t$5
|
|
77275
77270
|
]);
|
|
77276
77271
|
useSocketListeners({ listeners: listeners2 });
|
|
77277
77272
|
reactExports.useEffect(() => {
|
|
@@ -78604,18 +78599,27 @@ const ChatMode = reactExports.memo(({
|
|
|
78604
78599
|
fields: company == null ? void 0 : company.fields,
|
|
78605
78600
|
widgetColor: company == null ? void 0 : company.hex_code,
|
|
78606
78601
|
customer
|
|
78607
|
-
}) : /* @__PURE__ */
|
|
78608
|
-
|
|
78609
|
-
|
|
78610
|
-
|
|
78611
|
-
|
|
78612
|
-
|
|
78613
|
-
|
|
78614
|
-
|
|
78615
|
-
|
|
78616
|
-
|
|
78617
|
-
|
|
78618
|
-
|
|
78602
|
+
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
78603
|
+
children: [/* @__PURE__ */ jsx(ChatWidgetScreen$1, {
|
|
78604
|
+
welcome_message: company == null ? void 0 : company.welcome_message,
|
|
78605
|
+
dataRef,
|
|
78606
|
+
setChatClose,
|
|
78607
|
+
videoRef,
|
|
78608
|
+
company,
|
|
78609
|
+
agent: agent_,
|
|
78610
|
+
isOngoingChat,
|
|
78611
|
+
handleOk,
|
|
78612
|
+
popupVisible,
|
|
78613
|
+
handleCancel,
|
|
78614
|
+
setPopupVisible
|
|
78615
|
+
}), /* @__PURE__ */ jsx(ChatInput, {
|
|
78616
|
+
dataRef,
|
|
78617
|
+
popupVisible,
|
|
78618
|
+
handleCancel,
|
|
78619
|
+
handleOk,
|
|
78620
|
+
setPopupVisible,
|
|
78621
|
+
company
|
|
78622
|
+
})]
|
|
78619
78623
|
});
|
|
78620
78624
|
});
|
|
78621
78625
|
const OngoingChat = ({
|