2020-05-09 16:32:43 +00:00
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
useInboxAvatarForBot() {
|
|
|
|
return window.chatwootWidgetDefaults.useInboxAvatarForBot;
|
|
|
|
},
|
|
|
|
hasAConnectedAgentBot() {
|
|
|
|
return !!window.chatwootWebChannel.hasAConnectedAgentBot;
|
|
|
|
},
|
|
|
|
inboxAvatarUrl() {
|
|
|
|
return window.chatwootWebChannel.avatarUrl;
|
|
|
|
},
|
|
|
|
channelConfig() {
|
|
|
|
return window.chatwootWebChannel;
|
|
|
|
},
|
2020-08-05 12:16:17 +00:00
|
|
|
hasEmojiPickerEnabled() {
|
|
|
|
return this.channelConfig.enabledFeatures.includes('emoji_picker');
|
|
|
|
},
|
|
|
|
hasAttachmentsEnabled() {
|
|
|
|
return this.channelConfig.enabledFeatures.includes('attachments');
|
|
|
|
},
|
2022-04-06 08:24:55 +00:00
|
|
|
hasEndConversationEnabled() {
|
|
|
|
return this.channelConfig.enabledFeatures.includes('end_conversation');
|
|
|
|
},
|
2021-02-15 18:44:13 +00:00
|
|
|
preChatFormEnabled() {
|
|
|
|
return window.chatwootWebChannel.preChatFormEnabled;
|
|
|
|
},
|
|
|
|
preChatFormOptions() {
|
2021-06-30 15:39:44 +00:00
|
|
|
let preChatMessage = '';
|
2021-02-15 18:44:13 +00:00
|
|
|
const options = window.chatwootWebChannel.preChatFormOptions || {};
|
2022-01-12 10:55:27 +00:00
|
|
|
preChatMessage = options.pre_chat_message;
|
2022-04-19 07:17:29 +00:00
|
|
|
const { pre_chat_fields: preChatFields = [] } = options;
|
2021-02-15 18:44:13 +00:00
|
|
|
return {
|
2021-06-30 15:39:44 +00:00
|
|
|
preChatMessage,
|
2022-04-19 07:17:29 +00:00
|
|
|
preChatFields,
|
2021-02-15 18:44:13 +00:00
|
|
|
};
|
|
|
|
},
|
2022-04-19 07:17:29 +00:00
|
|
|
shouldShowPreChatForm() {
|
|
|
|
const { preChatFields } = this.preChatFormOptions;
|
|
|
|
// Check if at least one enabled field in pre-chat fields
|
|
|
|
const hasEnabledFields =
|
|
|
|
preChatFields.filter(field => field.enabled).length > 0;
|
|
|
|
return this.preChatFormEnabled && hasEnabledFields;
|
|
|
|
},
|
2020-05-09 16:32:43 +00:00
|
|
|
},
|
|
|
|
};
|