2019-10-29 07:20:54 +00:00
|
|
|
<template>
|
2020-10-18 18:02:22 +00:00
|
|
|
<div
|
|
|
|
v-if="!conversationSize && isFetchingList"
|
|
|
|
class="flex flex-1 items-center h-full bg-black-25 justify-center"
|
|
|
|
>
|
|
|
|
<spinner size=""></spinner>
|
|
|
|
</div>
|
|
|
|
<div v-else class="home">
|
2019-10-29 07:20:54 +00:00
|
|
|
<div class="header-wrap">
|
2020-10-18 18:02:22 +00:00
|
|
|
<transition
|
|
|
|
enter-active-class="transition-all delay-200 duration-300 ease"
|
|
|
|
leave-active-class="transition-all duration-200 ease-in"
|
|
|
|
enter-class="opacity-0 transform -translate-y-32"
|
|
|
|
enter-to-class="opacity-100 transform translate-y-0"
|
|
|
|
leave-class="opacity-100 transform translate-y-0"
|
|
|
|
leave-to-class="opacity-0 transform -translate-y-32"
|
|
|
|
>
|
|
|
|
<chat-header-expanded
|
|
|
|
v-if="!isOnMessageView"
|
|
|
|
:intro-heading="introHeading"
|
|
|
|
:intro-body="introBody"
|
|
|
|
:avatar-url="channelConfig.avatarUrl"
|
|
|
|
:show-popout-button="showPopoutButton"
|
|
|
|
/>
|
|
|
|
<chat-header
|
|
|
|
v-if="isOnMessageView"
|
|
|
|
:title="channelConfig.websiteName"
|
|
|
|
:avatar-url="channelConfig.avatarUrl"
|
|
|
|
:show-popout-button="showPopoutButton"
|
|
|
|
:available-agents="availableAgents"
|
|
|
|
/>
|
|
|
|
</transition>
|
2019-10-29 07:20:54 +00:00
|
|
|
</div>
|
2020-10-18 18:02:22 +00:00
|
|
|
<conversation-wrap :grouped-messages="groupedMessages" />
|
2019-10-29 07:20:54 +00:00
|
|
|
<div class="footer-wrap">
|
2020-10-18 18:02:22 +00:00
|
|
|
<transition
|
|
|
|
enter-active-class="transition-all delay-300 duration-300 ease"
|
|
|
|
leave-active-class="transition-all duration-200 ease-in"
|
|
|
|
enter-class="opacity-0 transform translate-y-32"
|
|
|
|
enter-to-class="opacity-100 transform translate-y-0"
|
|
|
|
leave-class="opacity-100 transform translate-y-0"
|
|
|
|
leave-to-class="opacity-0 transform translate-y-32 "
|
|
|
|
>
|
|
|
|
<div v-if="showInputTextArea && isOnMessageView" class="input-wrap">
|
|
|
|
<chat-footer />
|
|
|
|
</div>
|
|
|
|
<team-availability
|
|
|
|
v-if="!isOnMessageView"
|
|
|
|
:available-agents="availableAgents"
|
|
|
|
@start-conversation="startConversation"
|
|
|
|
/>
|
|
|
|
</transition>
|
2020-01-13 06:40:40 +00:00
|
|
|
<branding></branding>
|
2019-10-29 07:20:54 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-01-13 06:40:40 +00:00
|
|
|
import Branding from 'widget/components/Branding.vue';
|
2019-10-29 07:20:54 +00:00
|
|
|
import ChatFooter from 'widget/components/ChatFooter.vue';
|
|
|
|
import ChatHeaderExpanded from 'widget/components/ChatHeaderExpanded.vue';
|
2019-11-26 17:05:26 +00:00
|
|
|
import ChatHeader from 'widget/components/ChatHeader.vue';
|
2019-10-29 07:20:54 +00:00
|
|
|
import ConversationWrap from 'widget/components/ConversationWrap.vue';
|
2020-05-09 16:32:43 +00:00
|
|
|
import configMixin from '../mixins/configMixin';
|
2020-10-18 18:02:22 +00:00
|
|
|
import TeamAvailability from 'widget/components/TeamAvailability';
|
|
|
|
import Spinner from 'shared/components/Spinner.vue';
|
|
|
|
import { mapGetters } from 'vuex';
|
2019-10-29 07:20:54 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Home',
|
|
|
|
components: {
|
2020-10-18 18:02:22 +00:00
|
|
|
Branding,
|
2019-10-29 07:20:54 +00:00
|
|
|
ChatFooter,
|
2020-10-18 18:02:22 +00:00
|
|
|
ChatHeader,
|
2019-10-29 07:20:54 +00:00
|
|
|
ChatHeaderExpanded,
|
|
|
|
ConversationWrap,
|
2020-10-18 18:02:22 +00:00
|
|
|
Spinner,
|
|
|
|
TeamAvailability,
|
2019-10-29 07:20:54 +00:00
|
|
|
},
|
2020-05-09 16:32:43 +00:00
|
|
|
mixins: [configMixin],
|
2020-07-07 18:34:44 +00:00
|
|
|
props: {
|
|
|
|
groupedMessages: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
conversationSize: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
availableAgents: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
hasFetched: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
conversationAttributes: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
2020-08-28 12:09:46 +00:00
|
|
|
showPopoutButton: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-07-07 18:34:44 +00:00
|
|
|
},
|
2020-10-18 18:02:22 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showMessageView: false,
|
|
|
|
};
|
|
|
|
},
|
2019-10-29 07:20:54 +00:00
|
|
|
computed: {
|
2020-10-18 18:02:22 +00:00
|
|
|
...mapGetters({
|
|
|
|
isFetchingList: 'conversation/getIsFetchingList',
|
|
|
|
}),
|
2020-05-09 16:32:43 +00:00
|
|
|
isOpen() {
|
|
|
|
return this.conversationAttributes.status === 'open';
|
|
|
|
},
|
|
|
|
showInputTextArea() {
|
|
|
|
if (this.hideInputForBotConversations) {
|
|
|
|
if (this.isOpen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
2020-10-18 18:02:22 +00:00
|
|
|
isOnMessageView() {
|
|
|
|
if (this.hideWelcomeHeader) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (this.conversationSize === 0) {
|
|
|
|
return this.showMessageView;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
2019-11-26 17:05:26 +00:00
|
|
|
isHeaderExpanded() {
|
2019-12-14 18:36:01 +00:00
|
|
|
return this.conversationSize === 0;
|
2019-11-26 17:05:26 +00:00
|
|
|
},
|
2020-04-20 06:25:06 +00:00
|
|
|
introHeading() {
|
2020-05-09 16:32:43 +00:00
|
|
|
return this.channelConfig.welcomeTitle;
|
2020-04-20 06:25:06 +00:00
|
|
|
},
|
|
|
|
introBody() {
|
2020-05-09 16:32:43 +00:00
|
|
|
return this.channelConfig.welcomeTagline;
|
|
|
|
},
|
|
|
|
hideWelcomeHeader() {
|
|
|
|
return !(this.introHeading || this.introBody);
|
2020-04-20 06:25:06 +00:00
|
|
|
},
|
2020-02-05 05:57:22 +00:00
|
|
|
},
|
2020-10-18 18:02:22 +00:00
|
|
|
methods: {
|
|
|
|
startConversation() {
|
|
|
|
this.showMessageView = !this.showMessageView;
|
|
|
|
},
|
|
|
|
},
|
2019-10-29 07:20:54 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2020-10-18 18:02:22 +00:00
|
|
|
@import '~widget/assets/scss/variables';
|
2019-10-29 07:20:54 +00:00
|
|
|
|
|
|
|
.home {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-wrap: nowrap;
|
2020-10-18 18:02:22 +00:00
|
|
|
overflow: hidden;
|
2019-10-29 07:20:54 +00:00
|
|
|
background: $color-background;
|
|
|
|
|
|
|
|
.header-wrap {
|
|
|
|
flex-shrink: 0;
|
2020-05-02 04:17:36 +00:00
|
|
|
border-radius: $space-normal $space-normal $space-small $space-small;
|
2020-03-07 18:09:41 +00:00
|
|
|
z-index: 99;
|
2020-02-05 05:57:22 +00:00
|
|
|
|
2020-03-07 18:09:41 +00:00
|
|
|
@media only screen and (min-device-width: 320px) and (max-device-width: 667px) {
|
2020-02-05 05:57:22 +00:00
|
|
|
border-radius: 0;
|
|
|
|
}
|
2019-10-29 07:20:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.footer-wrap {
|
|
|
|
flex-shrink: 0;
|
2020-01-13 06:40:40 +00:00
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2020-01-17 08:06:05 +00:00
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
top: -$space-normal;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: $space-normal;
|
2020-01-19 08:47:15 +00:00
|
|
|
opacity: 0.1;
|
2020-01-17 08:06:05 +00:00
|
|
|
background: linear-gradient(
|
|
|
|
to top,
|
|
|
|
$color-background,
|
|
|
|
rgba($color-background, 0)
|
|
|
|
);
|
|
|
|
}
|
2020-01-13 06:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input-wrap {
|
2020-02-05 05:57:22 +00:00
|
|
|
padding: 0 $space-normal;
|
2019-10-29 07:20:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|