feat: add feature flag map for inbox specific features

This commit is contained in:
Shivam Mishra
2023-10-04 12:12:15 +05:30
parent b3141de50b
commit 0af9e974bd
3 changed files with 33 additions and 1 deletions
@@ -124,6 +124,7 @@
:message="data"
@open="openContextMenu"
@close="closeContextMenu"
@reply-to="handleReplyTo"
/>
</div>
</li>
@@ -188,6 +189,10 @@ export default {
type: Boolean,
default: false,
},
inboxSupportsReply: {
type: Boolean,
default: false,
},
},
data() {
return {
@@ -269,6 +274,8 @@ export default {
copy: this.hasText,
delete: this.hasText || this.hasAttachments,
cannedResponse: this.isOutgoing && this.hasText,
replyTo:
this.isIncoming && !this.data.private && this.inboxSupportsReply,
};
},
contentAttributes() {
@@ -42,6 +42,7 @@
:is-a-whatsapp-channel="isAWhatsAppChannel"
:has-instagram-story="hasInstagramStory"
:is-web-widget-inbox="isAWebWidgetInbox"
:inbox-supports-reply="inboxSupportsReply"
/>
<li v-show="unreadMessageCount != 0" class="unread--toast">
<span>
@@ -110,7 +111,7 @@ import { mapGetters } from 'vuex';
import conversationMixin, {
filterDuplicateSourceMessages,
} from '../../../mixins/conversations';
import inboxMixin from 'shared/mixins/inboxMixin';
import inboxMixin, { INBOX_FEATURES } from 'shared/mixins/inboxMixin';
import configMixin from 'shared/mixins/configMixin';
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
import aiMixin from 'dashboard/mixins/aiMixin';
@@ -316,6 +317,9 @@ export default {
unreadMessageCount() {
return this.currentChat.unread_count || 0;
},
inboxSupportsReply() {
return this.inboxHasFeature(INBOX_FEATURES.REPLY_TO);
},
},
watch: {
@@ -11,6 +11,22 @@ export const INBOX_TYPES = {
SMS: 'Channel::Sms',
};
export const INBOX_FEATURES = {
REPLY_TO: 'replyTo',
};
export const INBOX_FEATURE_MAP = {
[INBOX_FEATURES.REPLY_TO]: [
INBOX_TYPES.WEB,
INBOX_TYPES.FB,
INBOX_TYPES.TWITTER,
INBOX_TYPES.WHATSAPP,
INBOX_TYPES.LINE,
INBOX_TYPES.TELEGRAM,
INBOX_TYPES.API,
],
};
export default {
computed: {
channelType() {
@@ -102,4 +118,9 @@ export default {
);
},
},
methods: {
inboxHasFeature(feature) {
return INBOX_FEATURE_MAP[feature]?.includes(this.channelType);
},
},
};