2020-08-05 12:16:17 +00:00
|
|
|
export const INBOX_TYPES = {
|
|
|
|
WEB: 'Channel::WebWidget',
|
|
|
|
FB: 'Channel::FacebookPage',
|
|
|
|
TWITTER: 'Channel::TwitterProfile',
|
|
|
|
TWILIO: 'Channel::TwilioSms',
|
2021-10-05 18:05:06 +00:00
|
|
|
WHATSAPP: 'Channel::Whatsapp',
|
2020-08-05 12:16:17 +00:00
|
|
|
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;
|
|
|
|
},
|
2021-09-30 20:15:29 +00:00
|
|
|
isATelegramChannel() {
|
|
|
|
return this.channelType === INBOX_TYPES.TELEGRAM;
|
|
|
|
},
|
2020-08-05 12:16:17 +00:00
|
|
|
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
|
|
|
},
|
2021-10-05 18:05:06 +00:00
|
|
|
isAWhatsappChannel() {
|
|
|
|
return (
|
|
|
|
this.channelType === INBOX_TYPES.WHATSAPP ||
|
|
|
|
this.isATwilioWhatsappChannel
|
|
|
|
);
|
|
|
|
},
|
2020-08-05 12:16:17 +00:00
|
|
|
},
|
|
|
|
};
|