feat: show ReplyTo in widget UI (#8094)

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Shivam Mishra
2023-10-27 13:35:02 +05:30
committed by GitHub
parent ab872beb1d
commit d94108bf3f
22 changed files with 426 additions and 82 deletions

View File

@@ -22,7 +22,7 @@ const createConversation = params => {
};
};
const sendMessage = content => {
const sendMessage = (content, replyTo) => {
const referrerURL = window.referrerURL || '';
const search = buildSearchParamsWithLocale(window.location.search);
return {
@@ -30,6 +30,7 @@ const sendMessage = content => {
params: {
message: {
content,
reply_to: replyTo,
timestamp: new Date().toString(),
referer_url: referrerURL,
},
@@ -37,7 +38,7 @@ const sendMessage = content => {
};
};
const sendAttachment = ({ attachment }) => {
const sendAttachment = ({ attachment, replyTo = null }) => {
const { referrerURL = '' } = window;
const timestamp = new Date().toString();
const { file } = attachment;
@@ -51,6 +52,7 @@ const sendAttachment = ({ attachment }) => {
formData.append('message[referer_url]', referrerURL);
formData.append('message[timestamp]', timestamp);
formData.append('message[reply_to]', replyTo);
return {
url: `/api/v1/widget/messages${window.location.search}`,
params: formData,