feat: Insert captain response to reply editor (#10581)

This commit is contained in:
Sivin Varghese
2024-12-13 15:13:16 +05:30
committed by GitHub
parent 19ff5bdd5e
commit 9220afce6e
7 changed files with 57 additions and 7 deletions

View File

@@ -8,6 +8,10 @@ const props = defineProps({
type: [Number, String],
required: true,
},
conversationInboxType: {
type: String,
required: true,
},
});
const currentUser = useMapGetter('getCurrentUser');
const messages = ref([]);
@@ -53,6 +57,7 @@ const sendMessage = async message => {
:messages="messages"
:support-agent="currentUser"
:is-captain-typing="isCaptainTyping"
:conversation-inbox-type="conversationInboxType"
@send-message="sendMessage"
/>
</template>

View File

@@ -6,7 +6,7 @@ import ContactPanel from 'dashboard/routes/dashboard/conversation/ContactPanel.v
import TabBar from 'dashboard/components-next/tabbar/TabBar.vue';
import { useI18n } from 'vue-i18n';
defineProps({
const props = defineProps({
currentChat: {
required: true,
type: Object,
@@ -16,11 +16,13 @@ defineProps({
const emit = defineEmits(['toggleContactPanel']);
const getters = useStoreGetters();
const { t } = useI18n();
const captainIntegration = computed(() =>
getters['integrations/getIntegration'].value('captain', null)
);
const { t } = useI18n();
const channelType = computed(() => props.currentChat?.meta?.channel || '');
const CONTACT_TABS_OPTIONS = [
{ key: 'CONTACT', value: 'contact' },
@@ -61,7 +63,7 @@ const showCopilotTab = computed(() => {
@tab-changed="handleTabChange"
/>
</div>
<div class="overflow-auto flex flex-1">
<div class="flex flex-1 overflow-auto">
<ContactPanel
v-if="!activeTab"
:conversation-id="currentChat.id"
@@ -71,6 +73,7 @@ const showCopilotTab = computed(() => {
<CopilotContainer
v-else-if="activeTab === 1 && showCopilotTab"
:key="currentChat.id"
:conversation-inbox-type="channelType"
:conversation-id="currentChat.id"
class="flex-1"
/>

View File

@@ -459,11 +459,13 @@ export default {
BUS_EVENTS.NEW_CONVERSATION_MODAL,
this.onNewConversationModalActive
);
emitter.on(BUS_EVENTS.INSERT_INTO_NORMAL_EDITOR, this.addIntoEditor);
},
unmounted() {
document.removeEventListener('paste', this.onPaste);
document.removeEventListener('keydown', this.handleKeyEvents);
emitter.off(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE, this.fetchAndSetReplyTo);
emitter.off(BUS_EVENTS.INSERT_INTO_NORMAL_EDITOR, this.addIntoEditor);
emitter.off(
BUS_EVENTS.NEW_CONVERSATION_MODAL,
this.onNewConversationModalActive