feat(widget): Add captain handoff request
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
toggleTyping,
|
||||
setUserLastSeenAt,
|
||||
toggleStatus,
|
||||
requestHandoff,
|
||||
setCustomAttributes,
|
||||
deleteCustomAttribute,
|
||||
} from 'widget/api/conversation';
|
||||
@@ -212,6 +213,11 @@ export const actions = {
|
||||
await toggleStatus();
|
||||
},
|
||||
|
||||
requestHandoff: async ({ dispatch }) => {
|
||||
await requestHandoff();
|
||||
dispatch('conversationAttributes/getAttributes', {}, { root: true });
|
||||
},
|
||||
|
||||
setCustomAttributes: async (
|
||||
{ commit, rootGetters },
|
||||
customAttributes = {}
|
||||
|
||||
@@ -39,6 +39,15 @@ export const getters = {
|
||||
getMessageCount: _state => {
|
||||
return Object.values(_state.conversations).length;
|
||||
},
|
||||
getCaptainReplyCount: _state => {
|
||||
return Object.values(_state.conversations).filter(message => {
|
||||
const { message_type: messageType, sender = {} } = message;
|
||||
return (
|
||||
messageType === MESSAGE_TYPE.OUTGOING &&
|
||||
sender.type === 'captain_assistant'
|
||||
);
|
||||
}).length;
|
||||
},
|
||||
getUnreadMessageCount: _state => {
|
||||
const { userLastSeenAt } = _state.meta;
|
||||
return Object.values(_state.conversations).filter(chat => {
|
||||
|
||||
Reference in New Issue
Block a user