mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
<img width="1240" alt="Screenshot 2025-06-05 at 12 39 04 AM" src="https://github.com/user-attachments/assets/0071cd23-38c3-4638-946e-f1fbd11ec845" /> ## Changes Give the admins an option to delete conversation via the context menu - enable conversation deletion in routes and controller - expose delete API on conversations - add delete option in conversation context menu and integrate with card and list - implement store action and mutation for delete - update i18n with new strings fixes: https://github.com/chatwoot/chatwoot/issues/947 --------- Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Pranav <pranavrajs@gmail.com>
147 lines
3.4 KiB
JavaScript
147 lines
3.4 KiB
JavaScript
/* global axios */
|
|
import ApiClient from '../ApiClient';
|
|
|
|
class ConversationApi extends ApiClient {
|
|
constructor() {
|
|
super('conversations', { accountScoped: true });
|
|
}
|
|
|
|
get({
|
|
inboxId,
|
|
status,
|
|
assigneeType,
|
|
page,
|
|
labels,
|
|
teamId,
|
|
conversationType,
|
|
sortBy,
|
|
updatedWithin,
|
|
}) {
|
|
return axios.get(this.url, {
|
|
params: {
|
|
inbox_id: inboxId,
|
|
team_id: teamId,
|
|
status,
|
|
assignee_type: assigneeType,
|
|
page,
|
|
labels,
|
|
conversation_type: conversationType,
|
|
sort_by: sortBy,
|
|
updated_within: updatedWithin,
|
|
},
|
|
});
|
|
}
|
|
|
|
filter(payload) {
|
|
return axios.post(`${this.url}/filter`, payload.queryData, {
|
|
params: {
|
|
page: payload.page,
|
|
},
|
|
});
|
|
}
|
|
|
|
search({ q }) {
|
|
return axios.get(`${this.url}/search`, {
|
|
params: {
|
|
q,
|
|
page: 1,
|
|
},
|
|
});
|
|
}
|
|
|
|
toggleStatus({ conversationId, status, snoozedUntil = null }) {
|
|
return axios.post(`${this.url}/${conversationId}/toggle_status`, {
|
|
status,
|
|
snoozed_until: snoozedUntil,
|
|
});
|
|
}
|
|
|
|
togglePriority({ conversationId, priority }) {
|
|
return axios.post(`${this.url}/${conversationId}/toggle_priority`, {
|
|
priority,
|
|
});
|
|
}
|
|
|
|
assignAgent({ conversationId, agentId }) {
|
|
return axios.post(
|
|
`${this.url}/${conversationId}/assignments?assignee_id=${agentId}`,
|
|
{}
|
|
);
|
|
}
|
|
|
|
assignTeam({ conversationId, teamId }) {
|
|
const params = { team_id: teamId };
|
|
return axios.post(`${this.url}/${conversationId}/assignments`, params);
|
|
}
|
|
|
|
markMessageRead({ id }) {
|
|
return axios.post(`${this.url}/${id}/update_last_seen`);
|
|
}
|
|
|
|
markMessagesUnread({ id }) {
|
|
return axios.post(`${this.url}/${id}/unread`);
|
|
}
|
|
|
|
toggleTyping({ conversationId, status, isPrivate }) {
|
|
return axios.post(`${this.url}/${conversationId}/toggle_typing_status`, {
|
|
typing_status: status,
|
|
is_private: isPrivate,
|
|
});
|
|
}
|
|
|
|
mute(conversationId) {
|
|
return axios.post(`${this.url}/${conversationId}/mute`);
|
|
}
|
|
|
|
unmute(conversationId) {
|
|
return axios.post(`${this.url}/${conversationId}/unmute`);
|
|
}
|
|
|
|
meta({ inboxId, status, assigneeType, labels, teamId, conversationType }) {
|
|
return axios.get(`${this.url}/meta`, {
|
|
params: {
|
|
inbox_id: inboxId,
|
|
status,
|
|
assignee_type: assigneeType,
|
|
labels,
|
|
team_id: teamId,
|
|
conversation_type: conversationType,
|
|
},
|
|
});
|
|
}
|
|
|
|
sendEmailTranscript({ conversationId, email }) {
|
|
return axios.post(`${this.url}/${conversationId}/transcript`, { email });
|
|
}
|
|
|
|
updateCustomAttributes({ conversationId, customAttributes }) {
|
|
return axios.post(`${this.url}/${conversationId}/custom_attributes`, {
|
|
custom_attributes: customAttributes,
|
|
});
|
|
}
|
|
|
|
fetchParticipants(conversationId) {
|
|
return axios.get(`${this.url}/${conversationId}/participants`);
|
|
}
|
|
|
|
updateParticipants({ conversationId, userIds }) {
|
|
return axios.patch(`${this.url}/${conversationId}/participants`, {
|
|
user_ids: userIds,
|
|
});
|
|
}
|
|
|
|
getAllAttachments(conversationId) {
|
|
return axios.get(`${this.url}/${conversationId}/attachments`);
|
|
}
|
|
|
|
getInboxAssistant(conversationId) {
|
|
return axios.get(`${this.url}/${conversationId}/inbox_assistant`);
|
|
}
|
|
|
|
delete(conversationId) {
|
|
return axios.delete(`${this.url}/${conversationId}`);
|
|
}
|
|
}
|
|
|
|
export default new ConversationApi();
|