Feature: Typing Indicator on widget and dashboard (#811)
* Adds typing indicator for widget * typing indicator for agents in dashboard Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
committed by
GitHub
parent
fabc3170b7
commit
5bc8219db5
@@ -160,10 +160,10 @@ const actions = {
|
||||
commit(types.default.UPDATE_CONVERSATION, conversation);
|
||||
},
|
||||
|
||||
toggleTyping: async ({ commit }, { status, inboxId, contactId }) => {
|
||||
toggleTyping: async ({ commit }, { status, conversationId }) => {
|
||||
try {
|
||||
await FBChannel.toggleTyping({ status, inboxId, contactId });
|
||||
commit(types.default.FB_TYPING, { status });
|
||||
commit(types.default.SET_AGENT_TYPING, { status });
|
||||
await ConversationApi.toggleTyping({ status, conversationId });
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
@@ -6,6 +6,14 @@ import getters, { getSelectedChatConversation } from './getters';
|
||||
import actions from './actions';
|
||||
import wootConstants from '../../../constants';
|
||||
|
||||
const initialSelectedChat = {
|
||||
id: null,
|
||||
meta: {},
|
||||
status: null,
|
||||
seen: false,
|
||||
agentTyping: 'off',
|
||||
dataFetched: false,
|
||||
};
|
||||
const state = {
|
||||
allConversations: [],
|
||||
convTabStats: {
|
||||
@@ -13,14 +21,7 @@ const state = {
|
||||
unAssignedCount: 0,
|
||||
allCount: 0,
|
||||
},
|
||||
selectedChat: {
|
||||
id: null,
|
||||
meta: {},
|
||||
status: null,
|
||||
seen: false,
|
||||
agentTyping: 'off',
|
||||
dataFetched: false,
|
||||
},
|
||||
selectedChat: { ...initialSelectedChat },
|
||||
listLoadingStatus: true,
|
||||
chatStatusFilter: wootConstants.STATUS_TYPE.OPEN,
|
||||
currentInbox: null,
|
||||
@@ -42,14 +43,7 @@ const mutations = {
|
||||
},
|
||||
[types.default.EMPTY_ALL_CONVERSATION](_state) {
|
||||
_state.allConversations = [];
|
||||
_state.selectedChat = {
|
||||
id: null,
|
||||
meta: {},
|
||||
status: null,
|
||||
seen: false,
|
||||
agentTyping: 'off',
|
||||
dataFetched: false,
|
||||
};
|
||||
_state.selectedChat = { ...initialSelectedChat };
|
||||
},
|
||||
[types.default.SET_ALL_MESSAGES_LOADED](_state) {
|
||||
const [chat] = getSelectedChatConversation(_state);
|
||||
@@ -175,7 +169,7 @@ const mutations = {
|
||||
_state.selectedChat.seen = true;
|
||||
},
|
||||
|
||||
[types.default.FB_TYPING](_state, { status }) {
|
||||
[types.default.SET_AGENT_TYPING](_state, { status }) {
|
||||
_state.selectedChat.agentTyping = status;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user