Merge branch 'develop' into live-agent-reports-controller

This commit is contained in:
Pranav
2025-03-10 21:14:55 -07:00
committed by GitHub
327 changed files with 7069 additions and 2155 deletions
@@ -489,6 +489,15 @@ const actions = {
commit(types.SET_CONTEXT_MENU_CHAT_ID, chatId);
},
getInboxCaptainAssistantById: async ({ commit }, conversationId) => {
try {
const response = await ConversationApi.getInboxAssistant(conversationId);
commit(types.SET_INBOX_CAPTAIN_ASSISTANT, response.data);
} catch (error) {
// Handle error
}
},
...messageReadActions,
...messageTranslateActions,
};
@@ -108,6 +108,10 @@ const getters = {
getContextMenuChatId: _state => {
return _state.contextMenuChatId;
},
getCopilotAssistant: _state => {
return _state.copilotAssistant;
},
};
export default getters;
@@ -21,6 +21,7 @@ const state = {
conversationLastSeen: null,
syncConversationsMessages: {},
conversationFilters: {},
copilotAssistant: {},
};
// mutations
@@ -309,6 +310,9 @@ export const mutations = {
[types.UPDATE_CHAT_LIST_FILTERS](_state, data) {
_state.conversationFilters = { ..._state.conversationFilters, ...data };
},
[types.SET_INBOX_CAPTAIN_ASSISTANT](_state, data) {
_state.copilotAssistant = data.assistant;
},
};
export default {
@@ -687,4 +687,23 @@ describe('#addMentions', () => {
]);
});
});
describe('#getInboxCaptainAssistantById', () => {
it('fetches inbox assistant by id', async () => {
axios.get.mockResolvedValue({
data: {
id: 1,
name: 'Assistant',
description: 'Assistant description',
},
});
await actions.getInboxCaptainAssistantById({ commit }, 1);
expect(commit.mock.calls).toEqual([
[
types.SET_INBOX_CAPTAIN_ASSISTANT,
{ id: 1, name: 'Assistant', description: 'Assistant description' },
],
]);
});
});
});
@@ -308,4 +308,21 @@ describe('#getters', () => {
});
});
});
describe('#getCopilotAssistant', () => {
it('get copilot assistant', () => {
const state = {
copilotAssistant: {
id: 1,
name: 'Assistant',
description: 'Assistant description',
},
};
expect(getters.getCopilotAssistant(state)).toEqual({
id: 1,
name: 'Assistant',
description: 'Assistant description',
});
});
});
});
@@ -1,3 +1,4 @@
import { describe } from 'vitest';
import types from '../../../mutation-types';
import { mutations } from '../../conversations';
@@ -553,4 +554,19 @@ describe('#mutations', () => {
});
});
});
describe('#SET_INBOX_CAPTAIN_ASSISTANT', () => {
it('set inbox captain assistant', () => {
const state = { copilotAssistant: {} };
const data = {
assistant: {
id: 1,
name: 'Assistant',
description: 'Assistant description',
},
};
mutations[types.SET_INBOX_CAPTAIN_ASSISTANT](state, data);
expect(state.copilotAssistant).toEqual(data.assistant);
});
});
});