feat: Use inbox image as avatar for the bot (#6859)

This commit is contained in:
Pranav Raj S
2023-04-07 13:25:18 -07:00
committed by GitHub
parent 463c09184c
commit 91dc7733b0
12 changed files with 53 additions and 20 deletions

View File

@@ -1,7 +1,9 @@
export default {
computed: {
useInboxAvatarForBot() {
return window.chatwootWidgetDefaults.useInboxAvatarForBot;
return this.channelConfig.enabledFeatures.includes(
'use_inbox_avatar_for_bot'
);
},
hasAConnectedAgentBot() {
return !!window.chatwootWebChannel.hasAConnectedAgentBot;

View File

@@ -22,15 +22,16 @@ const preChatFields = [
global.chatwootWebChannel = {
avatarUrl: 'https://test.url',
hasAConnectedAgentBot: 'AgentBot',
enabledFeatures: ['emoji_picker', 'attachments', 'end_conversation'],
enabledFeatures: [
'emoji_picker',
'attachments',
'end_conversation',
'use_inbox_avatar_for_bot',
],
preChatFormOptions: { pre_chat_fields: preChatFields, pre_chat_message: '' },
preChatFormEnabled: true,
};
global.chatwootWidgetDefaults = {
useInboxAvatarForBot: true,
};
describe('configMixin', () => {
test('returns config', () => {
const Component = {
@@ -51,7 +52,12 @@ describe('configMixin', () => {
expect(wrapper.vm.channelConfig).toEqual({
avatarUrl: 'https://test.url',
hasAConnectedAgentBot: 'AgentBot',
enabledFeatures: ['emoji_picker', 'attachments', 'end_conversation'],
enabledFeatures: [
'emoji_picker',
'attachments',
'end_conversation',
'use_inbox_avatar_for_bot',
],
preChatFormOptions: {
pre_chat_message: '',
pre_chat_fields: preChatFields,