mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
export default {
 | 
						|
  computed: {
 | 
						|
    useInboxAvatarForBot() {
 | 
						|
      return window.chatwootWidgetDefaults.useInboxAvatarForBot;
 | 
						|
    },
 | 
						|
    hasAConnectedAgentBot() {
 | 
						|
      return !!window.chatwootWebChannel.hasAConnectedAgentBot;
 | 
						|
    },
 | 
						|
    inboxAvatarUrl() {
 | 
						|
      return window.chatwootWebChannel.avatarUrl;
 | 
						|
    },
 | 
						|
    channelConfig() {
 | 
						|
      return window.chatwootWebChannel;
 | 
						|
    },
 | 
						|
    hasEmojiPickerEnabled() {
 | 
						|
      return this.channelConfig.enabledFeatures.includes('emoji_picker');
 | 
						|
    },
 | 
						|
    hasAttachmentsEnabled() {
 | 
						|
      return this.channelConfig.enabledFeatures.includes('attachments');
 | 
						|
    },
 | 
						|
    hasEndConversationEnabled() {
 | 
						|
      return this.channelConfig.enabledFeatures.includes('end_conversation');
 | 
						|
    },
 | 
						|
    preChatFormEnabled() {
 | 
						|
      return window.chatwootWebChannel.preChatFormEnabled;
 | 
						|
    },
 | 
						|
    preChatFormOptions() {
 | 
						|
      let preChatMessage = '';
 | 
						|
      const options = window.chatwootWebChannel.preChatFormOptions || {};
 | 
						|
      preChatMessage = options.pre_chat_message;
 | 
						|
      const { pre_chat_fields: preChatFields = [] } = options;
 | 
						|
      return {
 | 
						|
        preChatMessage,
 | 
						|
        preChatFields,
 | 
						|
      };
 | 
						|
    },
 | 
						|
    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;
 | 
						|
    },
 | 
						|
  },
 | 
						|
};
 |