2019-10-29 07:20:54 +00:00
|
|
|
<template>
|
|
|
|
<div class="home">
|
|
|
|
<div class="header-wrap">
|
2020-04-19 18:10:28 +00:00
|
|
|
<ChatHeaderExpanded
|
2020-05-09 16:32:43 +00:00
|
|
|
v-if="isHeaderExpanded && !hideWelcomeHeader"
|
2020-04-20 06:25:06 +00:00
|
|
|
:intro-heading="introHeading"
|
|
|
|
:intro-body="introBody"
|
|
|
|
:avatar-url="channelConfig.avatarUrl"
|
|
|
|
/>
|
|
|
|
<ChatHeader
|
|
|
|
v-else
|
|
|
|
:title="channelConfig.websiteName"
|
|
|
|
:avatar-url="channelConfig.avatarUrl"
|
2020-04-19 18:10:28 +00:00
|
|
|
/>
|
2019-10-29 07:20:54 +00:00
|
|
|
</div>
|
2020-02-05 05:57:22 +00:00
|
|
|
<AvailableAgents v-if="showAvailableAgents" :agents="availableAgents" />
|
2019-12-14 18:36:01 +00:00
|
|
|
<ConversationWrap :grouped-messages="groupedMessages" />
|
2019-10-29 07:20:54 +00:00
|
|
|
<div class="footer-wrap">
|
2020-05-09 16:32:43 +00:00
|
|
|
<div v-if="showInputTextArea" class="input-wrap">
|
2020-03-30 06:45:06 +00:00
|
|
|
<ChatFooter />
|
2020-01-13 06:40:40 +00:00
|
|
|
</div>
|
|
|
|
<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-02-05 05:57:22 +00:00
|
|
|
import AvailableAgents from 'widget/components/AvailableAgents.vue';
|
2020-05-09 16:32:43 +00:00
|
|
|
import configMixin from '../mixins/configMixin';
|
2019-10-29 07:20:54 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Home',
|
|
|
|
components: {
|
|
|
|
ChatFooter,
|
|
|
|
ChatHeaderExpanded,
|
|
|
|
ConversationWrap,
|
2019-11-26 17:05:26 +00:00
|
|
|
ChatHeader,
|
2020-01-13 06:40:40 +00:00
|
|
|
Branding,
|
2020-02-05 05:57:22 +00:00
|
|
|
AvailableAgents,
|
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: () => {},
|
|
|
|
},
|
|
|
|
unreadMessageCount: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
},
|
2019-10-29 07:20:54 +00:00
|
|
|
computed: {
|
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;
|
|
|
|
},
|
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-02-05 05:57:22 +00:00
|
|
|
showAvailableAgents() {
|
2020-02-23 09:46:09 +00:00
|
|
|
return this.availableAgents.length > 0 && this.conversationSize < 1;
|
2020-02-05 05:57:22 +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
|
|
|
},
|
2019-10-29 07:20:54 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
@import '~widget/assets/scss/woot.scss';
|
|
|
|
|
|
|
|
.home {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
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-02-05 05:57:22 +00:00
|
|
|
background: white;
|
2020-03-07 18:09:41 +00:00
|
|
|
z-index: 99;
|
2020-02-05 05:57:22 +00:00
|
|
|
@include shadow-large;
|
|
|
|
|
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>
|