feat: Update label suggestion visibility (#7525)
This commit is contained in:
@@ -65,7 +65,7 @@
|
|||||||
:is-web-widget-inbox="isAWebWidgetInbox"
|
:is-web-widget-inbox="isAWebWidgetInbox"
|
||||||
/>
|
/>
|
||||||
<conversation-label-suggestion
|
<conversation-label-suggestion
|
||||||
v-if="isEnterprise && isAIIntegrationEnabled"
|
v-if="shouldShowLabelSuggestions"
|
||||||
:suggested-labels="labelSuggestions"
|
:suggested-labels="labelSuggestions"
|
||||||
:chat-labels="currentChat.labels"
|
:chat-labels="currentChat.labels"
|
||||||
:conversation-id="currentChat.id"
|
:conversation-id="currentChat.id"
|
||||||
@@ -123,6 +123,7 @@ import { isEscape } from 'shared/helpers/KeyboardHelpers';
|
|||||||
// constants
|
// constants
|
||||||
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
||||||
import { REPLY_POLICY } from 'shared/constants/links';
|
import { REPLY_POLICY } from 'shared/constants/links';
|
||||||
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -154,6 +155,7 @@ export default {
|
|||||||
hasUserScrolled: false,
|
hasUserScrolled: false,
|
||||||
isProgrammaticScroll: false,
|
isProgrammaticScroll: false,
|
||||||
isPopoutReplyBox: false,
|
isPopoutReplyBox: false,
|
||||||
|
messageSentSinceOpened: false,
|
||||||
labelSuggestions: [],
|
labelSuggestions: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -168,6 +170,17 @@ export default {
|
|||||||
appIntegrations: 'integrations/getAppIntegrations',
|
appIntegrations: 'integrations/getAppIntegrations',
|
||||||
currentAccountId: 'getCurrentAccountId',
|
currentAccountId: 'getCurrentAccountId',
|
||||||
}),
|
}),
|
||||||
|
isOpen() {
|
||||||
|
return this.currentChat?.status === wootConstants.STATUS_TYPE.OPEN;
|
||||||
|
},
|
||||||
|
shouldShowLabelSuggestions() {
|
||||||
|
return (
|
||||||
|
this.isOpen &&
|
||||||
|
this.isEnterprise &&
|
||||||
|
this.isAIIntegrationEnabled &&
|
||||||
|
!this.messageSentSinceOpened
|
||||||
|
);
|
||||||
|
},
|
||||||
inboxId() {
|
inboxId() {
|
||||||
return this.currentChat.inbox_id;
|
return this.currentChat.inbox_id;
|
||||||
},
|
},
|
||||||
@@ -310,6 +323,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.fetchAllAttachmentsFromCurrentChat();
|
this.fetchAllAttachmentsFromCurrentChat();
|
||||||
this.fetchSuggestions();
|
this.fetchSuggestions();
|
||||||
|
this.messageSentSinceOpened = false;
|
||||||
this.selectedTweetId = null;
|
this.selectedTweetId = null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -319,6 +333,11 @@ export default {
|
|||||||
// when a new message comes in, we refetch the label suggestions
|
// when a new message comes in, we refetch the label suggestions
|
||||||
bus.$on(BUS_EVENTS.FETCH_LABEL_SUGGESTIONS, this.fetchSuggestions);
|
bus.$on(BUS_EVENTS.FETCH_LABEL_SUGGESTIONS, this.fetchSuggestions);
|
||||||
bus.$on(BUS_EVENTS.SET_TWEET_REPLY, this.setSelectedTweet);
|
bus.$on(BUS_EVENTS.SET_TWEET_REPLY, this.setSelectedTweet);
|
||||||
|
// when a message is sent we set the flag to true this hides the label suggestions,
|
||||||
|
// until the chat is changed and the flag is reset in the watch for currentChat
|
||||||
|
bus.$on(BUS_EVENTS.MESSAGE_SENT, () => {
|
||||||
|
this.messageSentSinceOpened = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -755,6 +755,7 @@ export default {
|
|||||||
messagePayload
|
messagePayload
|
||||||
);
|
);
|
||||||
bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
|
bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
|
||||||
|
bus.$emit(BUS_EVENTS.MESSAGE_SENT);
|
||||||
this.removeFromDraft();
|
this.removeFromDraft();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export const BUS_EVENTS = {
|
|||||||
START_NEW_CONVERSATION: 'START_NEW_CONVERSATION',
|
START_NEW_CONVERSATION: 'START_NEW_CONVERSATION',
|
||||||
FOCUS_CUSTOM_ATTRIBUTE: 'FOCUS_CUSTOM_ATTRIBUTE',
|
FOCUS_CUSTOM_ATTRIBUTE: 'FOCUS_CUSTOM_ATTRIBUTE',
|
||||||
SCROLL_TO_MESSAGE: 'SCROLL_TO_MESSAGE',
|
SCROLL_TO_MESSAGE: 'SCROLL_TO_MESSAGE',
|
||||||
|
MESSAGE_SENT: 'MESSAGE_SENT',
|
||||||
FETCH_LABEL_SUGGESTIONS: 'FETCH_LABEL_SUGGESTIONS',
|
FETCH_LABEL_SUGGESTIONS: 'FETCH_LABEL_SUGGESTIONS',
|
||||||
TOGGLE_SIDEMENU: 'TOGGLE_SIDEMENU',
|
TOGGLE_SIDEMENU: 'TOGGLE_SIDEMENU',
|
||||||
ON_MESSAGE_LIST_SCROLL: 'ON_MESSAGE_LIST_SCROLL',
|
ON_MESSAGE_LIST_SCROLL: 'ON_MESSAGE_LIST_SCROLL',
|
||||||
|
|||||||
Reference in New Issue
Block a user