Files
chatwoot/app/javascript/shared/mixins/inboxMixin.js
Sojan Jose 2396b59f11 chore: API fixes (#3014)
- Minor API fixes
- Configuration screen for LINE inbox
2021-09-14 22:44:53 +05:30

47 lines
1.2 KiB
JavaScript

export const INBOX_TYPES = {
WEB: 'Channel::WebWidget',
FB: 'Channel::FacebookPage',
TWITTER: 'Channel::TwitterProfile',
TWILIO: 'Channel::TwilioSms',
API: 'Channel::Api',
EMAIL: 'Channel::Email',
LINE: 'Channel::Line',
};
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;
},
isALineChannel() {
return this.channelType === INBOX_TYPES.LINE;
},
isAnEmailChannel() {
return this.channelType === INBOX_TYPES.EMAIL;
},
isATwilioSMSChannel() {
const { phone_number: phoneNumber = '' } = this.inbox;
return this.isATwilioChannel && !phoneNumber.startsWith('whatsapp');
},
isATwilioWhatsappChannel() {
const { phone_number: phoneNumber = '' } = this.inbox;
return this.isATwilioChannel && phoneNumber.startsWith('whatsapp');
},
},
};