2020-08-01 15:26:47 +00:00
|
|
|
<template>
|
|
|
|
<div class="message-text--metadata">
|
2022-04-27 02:42:30 +00:00
|
|
|
<span class="time" :class="{ delivered: messageRead }">{{
|
|
|
|
readableTime
|
|
|
|
}}</span>
|
2022-11-29 12:51:37 +00:00
|
|
|
<span v-if="showReadIndicator" class="read-indicator-wrap">
|
|
|
|
<fluent-icon
|
|
|
|
v-tooltip.top-start="$t('CHAT_LIST.MESSAGE_READ')"
|
|
|
|
icon="checkmark-double"
|
|
|
|
class="action--icon read-tick read-indicator"
|
|
|
|
size="14"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<span v-if="showDeliveredIndicator" class="read-indicator-wrap">
|
|
|
|
<fluent-icon
|
|
|
|
v-tooltip.top-start="$t('CHAT_LIST.DELIVERED')"
|
|
|
|
icon="checkmark-double"
|
|
|
|
class="action--icon read-tick"
|
|
|
|
size="14"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<span v-if="showSentIndicator" class="read-indicator-wrap">
|
2021-12-01 05:03:18 +00:00
|
|
|
<fluent-icon
|
2021-10-14 07:25:46 +00:00
|
|
|
v-tooltip.top-start="$t('CHAT_LIST.SENT')"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="checkmark"
|
2022-11-29 12:51:37 +00:00
|
|
|
class="action--icon read-tick"
|
2022-06-07 12:03:33 +00:00
|
|
|
size="14"
|
2021-10-14 07:25:46 +00:00
|
|
|
/>
|
|
|
|
</span>
|
2021-12-01 05:03:18 +00:00
|
|
|
<fluent-icon
|
2020-08-01 15:26:47 +00:00
|
|
|
v-if="isEmail"
|
|
|
|
v-tooltip.top-start="$t('CHAT_LIST.RECEIVED_VIA_EMAIL')"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="mail"
|
|
|
|
class="action--icon"
|
|
|
|
size="16"
|
2020-08-01 15:26:47 +00:00
|
|
|
/>
|
2021-12-01 05:03:18 +00:00
|
|
|
<fluent-icon
|
2020-08-01 15:26:47 +00:00
|
|
|
v-if="isPrivate"
|
|
|
|
v-tooltip.top-start="$t('CONVERSATION.VISIBLE_TO_AGENTS')"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="lock-closed"
|
2022-02-17 13:28:53 +00:00
|
|
|
class="action--icon lock--icon--private"
|
2021-12-01 05:03:18 +00:00
|
|
|
size="16"
|
2020-08-01 15:26:47 +00:00
|
|
|
@mouseenter="isHovered = true"
|
|
|
|
@mouseleave="isHovered = false"
|
|
|
|
/>
|
2022-02-17 13:28:53 +00:00
|
|
|
<button
|
|
|
|
v-if="isATweet && (isIncoming || isOutgoing) && sourceId"
|
|
|
|
@click="onTweetReply"
|
|
|
|
>
|
2021-12-01 05:03:18 +00:00
|
|
|
<fluent-icon
|
|
|
|
v-tooltip.top-start="$t('CHAT_LIST.REPLY_TO_TWEET')"
|
|
|
|
icon="arrow-reply"
|
|
|
|
class="action--icon cursor-pointer"
|
|
|
|
size="16"
|
|
|
|
/>
|
|
|
|
</button>
|
2020-12-31 13:47:00 +00:00
|
|
|
<a
|
2021-08-02 10:37:30 +00:00
|
|
|
v-if="isATweet && (isOutgoing || isIncoming) && linkToTweet"
|
2020-12-31 13:47:00 +00:00
|
|
|
:href="linkToTweet"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer nofollow"
|
|
|
|
>
|
2021-12-01 05:03:18 +00:00
|
|
|
<fluent-icon
|
2020-08-11 04:27:42 +00:00
|
|
|
v-tooltip.top-start="$t('CHAT_LIST.VIEW_TWEET_IN_TWITTER')"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="open"
|
|
|
|
class="action--icon cursor-pointer"
|
|
|
|
size="16"
|
2020-08-11 04:27:42 +00:00
|
|
|
/>
|
|
|
|
</a>
|
2020-08-01 15:26:47 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-11-29 12:51:37 +00:00
|
|
|
import { MESSAGE_TYPE, MESSAGE_STATUS } from 'shared/constants/messages';
|
2020-08-11 04:27:42 +00:00
|
|
|
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
2021-10-14 07:25:46 +00:00
|
|
|
import inboxMixin from 'shared/mixins/inboxMixin';
|
2020-08-11 04:27:42 +00:00
|
|
|
|
2020-08-01 15:26:47 +00:00
|
|
|
export default {
|
2021-10-14 07:25:46 +00:00
|
|
|
mixins: [inboxMixin],
|
2020-08-01 15:26:47 +00:00
|
|
|
props: {
|
2020-08-11 04:27:42 +00:00
|
|
|
sender: {
|
|
|
|
type: Object,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
2020-08-01 15:26:47 +00:00
|
|
|
readableTime: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2022-03-10 14:57:30 +00:00
|
|
|
storySender: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
storyId: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-08-01 15:26:47 +00:00
|
|
|
isEmail: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
isPrivate: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
isATweet: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2022-03-10 14:57:30 +00:00
|
|
|
hasInstagramStory: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
messageType: {
|
|
|
|
type: Number,
|
|
|
|
default: 1,
|
|
|
|
},
|
2022-11-29 12:51:37 +00:00
|
|
|
messageStatus: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
sourceId: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
id: {
|
|
|
|
type: [String, Number],
|
|
|
|
default: '',
|
|
|
|
},
|
2021-08-02 10:37:30 +00:00
|
|
|
inboxId: {
|
|
|
|
type: [String, Number],
|
|
|
|
default: 0,
|
|
|
|
},
|
2022-04-20 10:33:12 +00:00
|
|
|
messageRead: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
},
|
|
|
|
computed: {
|
2021-08-02 10:37:30 +00:00
|
|
|
inbox() {
|
|
|
|
return this.$store.getters['inboxes/getInbox'](this.inboxId);
|
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
isIncoming() {
|
|
|
|
return MESSAGE_TYPE.INCOMING === this.messageType;
|
|
|
|
},
|
2021-08-02 10:37:30 +00:00
|
|
|
isOutgoing() {
|
|
|
|
return MESSAGE_TYPE.OUTGOING === this.messageType;
|
|
|
|
},
|
2022-11-29 12:51:37 +00:00
|
|
|
isDelivered() {
|
|
|
|
return MESSAGE_STATUS.DELIVERED === this.messageStatus;
|
|
|
|
},
|
|
|
|
isRead() {
|
|
|
|
return MESSAGE_STATUS.READ === this.messageStatus;
|
|
|
|
},
|
|
|
|
isSent() {
|
|
|
|
return MESSAGE_STATUS.SENT === this.messageStatus;
|
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
screenName() {
|
|
|
|
const { additional_attributes: additionalAttributes = {} } =
|
|
|
|
this.sender || {};
|
|
|
|
return additionalAttributes?.screen_name || '';
|
|
|
|
},
|
|
|
|
linkToTweet() {
|
2021-08-02 10:37:30 +00:00
|
|
|
if (!this.sourceId || !this.inbox.name) {
|
|
|
|
return '';
|
|
|
|
}
|
2020-08-11 04:27:42 +00:00
|
|
|
const { screenName, sourceId } = this;
|
2021-08-02 10:37:30 +00:00
|
|
|
return `https://twitter.com/${screenName ||
|
|
|
|
this.inbox.name}/status/${sourceId}`;
|
2020-08-11 04:27:42 +00:00
|
|
|
},
|
2022-03-10 14:57:30 +00:00
|
|
|
linkToStory() {
|
|
|
|
if (!this.storyId || !this.storySender) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
const { storySender, storyId } = this;
|
|
|
|
return `https://www.instagram.com/stories/${storySender}/${storyId}`;
|
|
|
|
},
|
2021-10-14 07:25:46 +00:00
|
|
|
showSentIndicator() {
|
2022-06-07 12:03:33 +00:00
|
|
|
return (
|
|
|
|
this.isOutgoing &&
|
|
|
|
this.sourceId &&
|
2022-11-29 12:51:37 +00:00
|
|
|
(this.isAnEmailChannel || (this.isAWhatsAppChannel && this.isSent))
|
|
|
|
);
|
|
|
|
},
|
|
|
|
showDeliveredIndicator() {
|
|
|
|
return (
|
|
|
|
this.isOutgoing &&
|
|
|
|
this.sourceId &&
|
|
|
|
this.isAWhatsAppChannel &&
|
|
|
|
this.isDelivered
|
|
|
|
);
|
|
|
|
},
|
|
|
|
showReadIndicator() {
|
|
|
|
return (
|
|
|
|
this.isOutgoing &&
|
|
|
|
this.sourceId &&
|
|
|
|
this.isAWhatsAppChannel &&
|
|
|
|
this.isRead
|
2022-06-07 12:03:33 +00:00
|
|
|
);
|
2021-10-14 07:25:46 +00:00
|
|
|
},
|
2020-08-11 04:27:42 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onTweetReply() {
|
|
|
|
bus.$emit(BUS_EVENTS.SET_TWEET_REPLY, this.id);
|
|
|
|
},
|
2020-08-01 15:26:47 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-05-20 08:21:46 +00:00
|
|
|
@import '~dashboard/assets/scss/woot';
|
2021-04-08 14:12:03 +00:00
|
|
|
|
2020-08-01 15:26:47 +00:00
|
|
|
.right {
|
|
|
|
.message-text--metadata {
|
2022-11-29 12:51:37 +00:00
|
|
|
align-items: center;
|
2020-08-01 15:26:47 +00:00
|
|
|
.time {
|
|
|
|
color: var(--w-100);
|
|
|
|
}
|
2021-10-14 14:48:43 +00:00
|
|
|
|
2022-02-11 01:45:07 +00:00
|
|
|
.action--icon {
|
2022-11-29 12:51:37 +00:00
|
|
|
color: var(--white);
|
2022-04-20 10:33:12 +00:00
|
|
|
&.read-tick {
|
|
|
|
color: var(--v-100);
|
|
|
|
}
|
2022-11-29 12:51:37 +00:00
|
|
|
|
|
|
|
&.read-indicator {
|
|
|
|
color: var(--g-300);
|
|
|
|
}
|
2022-02-11 01:45:07 +00:00
|
|
|
}
|
2022-02-17 13:28:53 +00:00
|
|
|
|
|
|
|
.lock--icon--private {
|
|
|
|
color: var(--s-400);
|
|
|
|
}
|
2021-10-14 14:48:43 +00:00
|
|
|
}
|
2020-08-01 15:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.left {
|
|
|
|
.message-text--metadata {
|
|
|
|
.time {
|
|
|
|
color: var(--s-400);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.message-text--metadata {
|
2021-12-01 05:03:18 +00:00
|
|
|
align-items: flex-start;
|
2020-08-01 15:26:47 +00:00
|
|
|
display: flex;
|
|
|
|
|
|
|
|
.time {
|
|
|
|
margin-right: var(--space-small);
|
|
|
|
display: block;
|
|
|
|
font-size: var(--font-size-micro);
|
|
|
|
line-height: 1.8;
|
|
|
|
}
|
|
|
|
|
2021-12-01 05:03:18 +00:00
|
|
|
.action--icon {
|
|
|
|
margin-right: var(--space-small);
|
|
|
|
margin-left: var(--space-small);
|
2020-08-11 04:27:42 +00:00
|
|
|
color: var(--s-900);
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
color: var(--s-900);
|
2020-08-01 15:26:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.activity-wrap {
|
|
|
|
.message-text--metadata {
|
|
|
|
.time {
|
|
|
|
color: var(--s-300);
|
2021-04-08 14:12:03 +00:00
|
|
|
display: flex;
|
|
|
|
text-align: center;
|
2020-08-01 15:26:47 +00:00
|
|
|
font-size: var(--font-size-micro);
|
2021-04-08 14:12:03 +00:00
|
|
|
margin-left: 0;
|
|
|
|
|
|
|
|
@include breakpoint(xlarge up) {
|
|
|
|
margin-left: var(--space-small);
|
|
|
|
}
|
2020-08-01 15:26:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-25 14:16:37 +00:00
|
|
|
.is-image,
|
|
|
|
.is-video {
|
2020-08-01 15:26:47 +00:00
|
|
|
.message-text--metadata {
|
|
|
|
.time {
|
|
|
|
bottom: var(--space-smaller);
|
|
|
|
color: var(--white);
|
|
|
|
position: absolute;
|
|
|
|
right: var(--space-small);
|
|
|
|
white-space: nowrap;
|
2022-04-27 02:42:30 +00:00
|
|
|
&.delivered {
|
|
|
|
right: var(--space-medium);
|
|
|
|
line-height: 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.read-tick {
|
|
|
|
position: absolute;
|
|
|
|
bottom: var(--space-small);
|
|
|
|
right: var(--space-small);
|
2020-08-01 15:26:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.is-private {
|
|
|
|
.message-text--metadata {
|
2022-02-17 13:28:53 +00:00
|
|
|
align-items: center;
|
2020-08-01 15:26:47 +00:00
|
|
|
|
|
|
|
.time {
|
|
|
|
color: var(--s-400);
|
|
|
|
}
|
2021-10-14 14:48:43 +00:00
|
|
|
|
|
|
|
.icon {
|
|
|
|
color: var(--s-400);
|
|
|
|
}
|
2020-08-01 15:26:47 +00:00
|
|
|
}
|
|
|
|
|
2021-10-25 14:16:37 +00:00
|
|
|
&.is-image,
|
|
|
|
&.is-video {
|
2020-08-01 15:26:47 +00:00
|
|
|
.time {
|
|
|
|
position: inherit;
|
|
|
|
padding-left: var(--space-one);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-14 07:25:46 +00:00
|
|
|
|
|
|
|
.delivered-icon {
|
|
|
|
margin-left: -var(--space-normal);
|
|
|
|
}
|
2022-11-29 12:51:37 +00:00
|
|
|
|
|
|
|
.read-indicator-wrap {
|
|
|
|
line-height: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2020-08-01 15:26:47 +00:00
|
|
|
</style>
|