refactor: component rendering in parent

This commit is contained in:
Shivam Mishra
2023-07-10 15:04:28 +05:30
parent edf7642740
commit 8c02669000
2 changed files with 16 additions and 13 deletions
@@ -65,7 +65,7 @@
:is-web-widget-inbox="isAWebWidgetInbox"
/>
<conversation-label-suggestion
v-if="isEnterprise"
v-if="isEnterprise && isAIIntegrationEnabled"
:chat-labels="currentChat.labels"
:conversation-id="currentChat.id"
/>
@@ -112,6 +112,7 @@ import conversationMixin, {
import inboxMixin from 'shared/mixins/inboxMixin';
import configMixin from 'shared/mixins/configMixin';
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
import aiMixin from 'dashboard/mixins/aiMixin';
// utils
import { getTypingUsersText } from '../../../helper/commons';
@@ -129,7 +130,13 @@ export default {
Banner,
ConversationLabelSuggestion,
},
mixins: [conversationMixin, inboxMixin, eventListenerMixins, configMixin],
mixins: [
conversationMixin,
inboxMixin,
eventListenerMixins,
configMixin,
aiMixin,
],
props: {
isContactPanelOpen: {
type: Boolean,
@@ -309,7 +316,7 @@ export default {
mounted() {
this.addScrollListener();
this.fetchAllAttachmentsFromCurrentChat();
this.fetchIntegrations();
this.fetchIntegrationsIfRequired();
},
beforeDestroy() {
@@ -321,11 +328,6 @@ export default {
fetchAllAttachmentsFromCurrentChat() {
this.$store.dispatch('fetchAllAttachments', this.currentChat.id);
},
fetchIntegrations() {
if (!this.appIntegrations.length) {
this.$store.dispatch('integrations/get');
}
},
removeBusListeners() {
bus.$off(BUS_EVENTS.SCROLL_TO_MESSAGE, this.onScrollToMessage);
bus.$off(BUS_EVENTS.SET_TWEET_REPLY, this.setSelectedTweet);
@@ -141,6 +141,7 @@ export default {
},
shouldShowSuggestions() {
if (this.isDismissed) return false;
if (!this.isAIIntegrationEnabled) return false;
return (
!this.fetchingSuggestions &&
@@ -167,11 +168,11 @@ export default {
}
this.fetchIntegrationsIfRequired().then(() => {
if (this.isAIIntegrationEnabled) {
this.fetchLabelSuggestion().then(labels => {
this.suggestedLabels = labels;
});
}
if (!this.isAIIntegrationEnabled) return;
this.fetchLabelSuggestion().then(labels => {
this.suggestedLabels = labels;
});
});
},
async fetchLabelSuggestion() {