2020-08-05 12:16:17 +00:00
|
|
|
export const INBOX_TYPES = {
|
|
|
|
WEB: 'Channel::WebWidget',
|
|
|
|
FB: 'Channel::FacebookPage',
|
|
|
|
TWITTER: 'Channel::TwitterProfile',
|
|
|
|
TWILIO: 'Channel::TwilioSms',
|
|
|
|
API: 'Channel::Api',
|
|
|
|
EMAIL: 'Channel::Email',
|
2021-09-15 12:42:56 +00:00
|
|
|
TELEGRAM: 'Channel::Telegram',
|
2021-09-14 17:14:53 +00:00
|
|
|
LINE: 'Channel::Line',
|
2020-08-05 12:16:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
channelType() {
|
|
|
|
return this.inbox.channel_type;
|
|
|
|
},
|
|
|
|
isAPIInbox() {
|
|
|
|
return this.channelType === INBOX_TYPES.API;
|
|
|
|
},
|
|
|
|
isATwitterInbox() {
|
|
|
|
return this.channelType === INBOX_TYPES.TWITTER;
|
|
|
|
},
|
|
|
|
isAFacebookInbox() {
|
|
|
|
return this.channelType === INBOX_TYPES.FB;
|
|
|
|
},
|
|
|
|
isAWebWidgetInbox() {
|
|
|
|
return this.channelType === INBOX_TYPES.WEB;
|
|
|
|
},
|
|
|
|
isATwilioChannel() {
|
|
|
|
return this.channelType === INBOX_TYPES.TWILIO;
|
|
|
|
},
|
2021-09-14 17:14:53 +00:00
|
|
|
isALineChannel() {
|
|
|
|
return this.channelType === INBOX_TYPES.LINE;
|
|
|
|
},
|
2020-08-05 12:16:17 +00:00
|
|
|
isAnEmailChannel() {
|
|
|
|
return this.channelType === INBOX_TYPES.EMAIL;
|
|
|
|
},
|
|
|
|
isATwilioSMSChannel() {
|
2021-09-29 07:26:45 +00:00
|
|
|
const { medium: medium = '' } = this.inbox;
|
|
|
|
return this.isATwilioChannel && medium === 'sms';
|
2020-08-05 12:16:17 +00:00
|
|
|
},
|
|
|
|
isATwilioWhatsappChannel() {
|
2021-09-29 07:26:45 +00:00
|
|
|
const { medium: medium = '' } = this.inbox;
|
|
|
|
return this.isATwilioChannel && medium === 'whatsapp';
|
|
|
|
},
|
|
|
|
isTwitterInboxTweet() {
|
|
|
|
return (
|
|
|
|
this.chat &&
|
|
|
|
this.chat.additional_attributes &&
|
|
|
|
this.chat.additional_attributes.type === 'tweet'
|
|
|
|
);
|
|
|
|
},
|
|
|
|
twilioBadge() {
|
|
|
|
return `${this.isATwilioSMSChannel ? 'sms' : 'whatsapp'}`;
|
|
|
|
},
|
|
|
|
twitterBadge() {
|
|
|
|
return `${this.isTwitterInboxTweet ? 'twitter-tweet' : 'twitter-chat'}`;
|
|
|
|
},
|
|
|
|
inboxBadge() {
|
|
|
|
if (this.isATwitterInbox) {
|
|
|
|
return this.twitterBadge;
|
|
|
|
}
|
|
|
|
if (this.isATwilioChannel) {
|
|
|
|
return this.twilioBadge;
|
|
|
|
}
|
|
|
|
return this.channelType;
|
2020-08-05 12:16:17 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|