Files
chatwoot/app/javascript/dashboard/components/widgets/ChannelItem.vue
Sojan Jose bf4a596726 Merge develop into feat/voice-channel
- Resolved merge conflicts in Vue components
- Updated color scheme to use new n-slate tokens
- Preserved voice channel functionality including isPrivateNoteOnly
- Removed files that were deleted in develop
- Fixed ESLint errors in App.vue
- Fixed SCSS imports in CollaboratorsPage.vue
- Fixed duplicate voice channel entries in ChannelList and ChannelItem
- Moved voice channel to end of channel list
- Integrated with new component structure
2025-07-09 02:42:18 -07:00

92 lines
2.2 KiB
Vue

<script>
import ChannelSelector from '../ChannelSelector.vue';
export default {
components: { ChannelSelector },
props: {
channel: {
type: Object,
required: true,
},
enabledFeatures: {
type: Object,
required: true,
},
},
emits: ['channelItemClick'],
computed: {
hasFbConfigured() {
return window.chatwootConfig?.fbAppId;
},
hasInstagramConfigured() {
return window.chatwootConfig?.instagramAppId;
},
isActive() {
const { key } = this.channel;
if (Object.keys(this.enabledFeatures).length === 0) {
return false;
}
if (key === 'website') {
return this.enabledFeatures.channel_website;
}
if (key === 'facebook') {
return this.enabledFeatures.channel_facebook && this.hasFbConfigured;
}
if (key === 'email') {
return this.enabledFeatures.channel_email;
}
if (key === 'instagram') {
return (
this.enabledFeatures.channel_instagram && this.hasInstagramConfigured
);
}
if (key === 'voice') {
return this.enabledFeatures.channel_voice;
}
return [
'website',
'twilio',
'voice',
'api',
'whatsapp',
'sms',
'telegram',
'line',
'instagram',
].includes(key);
},
isComingSoon() {
const { key } = this.channel;
// Show "Coming Soon" only if the channel is marked as coming soon
// and the corresponding feature flag is not enabled yet.
return ['voice'].includes(key) && !this.isActive;
},
},
methods: {
getChannelThumbnail() {
if (this.channel.key === 'api' && this.channel.thumbnail) {
return this.channel.thumbnail;
}
return `/assets/images/dashboard/channels/${this.channel.key}.png`;
},
onItemClick() {
if (this.isActive) {
this.$emit('channelItemClick', this.channel.key);
}
},
},
};
</script>
<template>
<ChannelSelector
:class="{ inactive: !isActive }"
:title="channel.name"
:src="getChannelThumbnail()"
:is-coming-soon="isComingSoon"
@click="onItemClick"
/>
</template>