Revert "feat: Show popular articles on widget home" (#7706)

This commit is contained in:
Pranav Raj S
2023-08-10 22:27:51 -07:00
committed by GitHub
parent 1a06bfd69c
commit 961d810645
22 changed files with 64 additions and 299 deletions

View File

@@ -1,34 +0,0 @@
<template>
<div class="bg-white h-full">
<iframe-loader :url="link" />
</div>
</template>
<script>
import { IFrameHelper } from 'widget/helpers/utils';
import IframeLoader from 'shared/components/IframeLoader';
export default {
name: 'Campaigns',
components: {
IframeLoader,
},
props: {
link: {
type: String,
default: '',
},
},
methods: {
closeFullView() {
if (IFrameHelper.isIFrame()) {
IFrameHelper.sendMessage({
event: 'setCampaignReadOn',
});
IFrameHelper.sendMessage({ event: 'toggleBubble' });
bus.$emit('snooze-campaigns');
}
},
},
};
</script>

View File

@@ -1,54 +1,24 @@
<template>
<div
class="z-50 rounded-md border-t border-slate-50 w-full flex flex-1 flex-col justify-end"
:class="{ 'pb-2': showArticles }"
>
<div v-if="false" class="px-4 py-2 w-full">
<div class="p-4 rounded-md bg-white dark:bg-slate-700 shadow w-full">
<article-hero
v-if="
!articleUiFlags.isFetching &&
!articleUiFlags.isError &&
popularArticles.length
"
:articles="popularArticles"
@view="openArticleInArticleViewer"
@view-all="viewAllArticles"
/>
<div
v-if="articleUiFlags.isFetching"
class="flex flex-col items-center justify-center py-8"
>
<div class="inline-block p-4 rounded-lg bg-slate-200">
<spinner size="small" />
</div>
</div>
</div>
</div>
<div class="px-4 pt-2 w-full sticky bottom-4">
<team-availability
:available-agents="availableAgents"
:has-conversation="!!conversationSize"
@start-conversation="startConversation"
/>
<div class="flex flex-1 flex-col justify-end">
<div class="flex flex-1 overflow-auto">
<!-- Load Conversation List Components Here -->
</div>
<team-availability
:available-agents="availableAgents"
:has-conversation="!!conversationSize"
@start-conversation="startConversation"
/>
</div>
</template>
<script>
import configMixin from '../mixins/configMixin';
import TeamAvailability from 'widget/components/TeamAvailability';
import ArticleHero from 'widget/components/ArticleHero';
import Spinner from 'shared/components/Spinner.vue';
import { mapGetters } from 'vuex';
import routerMixin from 'widget/mixins/routerMixin';
import configMixin from 'widget/mixins/configMixin';
export default {
name: 'Home',
components: {
Spinner,
ArticleHero,
TeamAvailability,
},
mixins: [configMixin, routerMixin],
@@ -62,31 +32,15 @@ export default {
default: false,
},
},
data() {
return {};
},
computed: {
...mapGetters({
availableAgents: 'agent/availableAgents',
activeCampaign: 'campaign/getActiveCampaign',
conversationSize: 'conversation/getConversationSize',
popularArticles: 'article/popularArticles',
articleUiFlags: 'article/uiFlags',
}),
portal() {
return window.chatwootWebChannel.portal;
},
showArticles() {
return (
this.portal &&
(this.articleUiFlags.isFetching || this.popularArticles.length)
);
},
},
mounted() {
if (this.portal && this.popularArticles.length === 0) {
this.$store.dispatch('article/fetch', {
slug: this.portal.slug,
locale: 'en',
});
}
},
methods: {
startConversation() {
@@ -95,19 +49,6 @@ export default {
}
return this.replaceRoute('messages');
},
openArticleInArticleViewer(link) {
this.$router.push({
name: 'article-viewer',
params: { link: `${link}?show_plain_layout=true` },
});
},
viewAllArticles() {
const {
portal: { slug },
locale = 'en',
} = window.chatwootWebChannel;
this.openArticleInArticleViewer(`/hc/${slug}/${locale}`);
},
},
};
</script>