chore: Displayed WhatsApp API provider name in inbox settings (#5346)

This commit is contained in:
Sivin Varghese 2022-08-29 12:40:15 +05:30 committed by GitHub
parent 9ddf4c205c
commit a9d687565e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 31 deletions

View file

@ -16,6 +16,9 @@ export default {
channelType() {
return this.inbox.channel_type;
},
whatsAppAPIProvider() {
return this.inbox.provider || '';
},
isAPIInbox() {
return this.channelType === INBOX_TYPES.API;
},
@ -47,10 +50,22 @@ export default {
isASmsInbox() {
return this.channelType === INBOX_TYPES.SMS || this.isATwilioSMSChannel;
},
isATwilioWhatsappChannel() {
isATwilioWhatsAppChannel() {
const { medium: medium = '' } = this.inbox;
return this.isATwilioChannel && medium === 'whatsapp';
},
isAWhatsAppCloudChannel() {
return (
this.channelType === INBOX_TYPES.WHATSAPP &&
this.whatsAppAPIProvider === 'whatsapp_cloud'
);
},
is360DialogWhatsAppChannel() {
return (
this.channelType === INBOX_TYPES.WHATSAPP &&
this.whatsAppAPIProvider === 'default'
);
},
chatAdditionalAttributes() {
const { additional_attributes: additionalAttributes } = this.chat || {};
return additionalAttributes || {};
@ -75,15 +90,15 @@ export default {
badgeKey = this.facebookBadge;
} else if (this.isATwilioChannel) {
badgeKey = this.twilioBadge;
} else if (this.isAWhatsappChannel) {
} else if (this.isAWhatsAppChannel) {
badgeKey = 'whatsapp';
}
return badgeKey || this.channelType;
},
isAWhatsappChannel() {
isAWhatsAppChannel() {
return (
this.channelType === INBOX_TYPES.WHATSAPP ||
this.isATwilioWhatsappChannel
this.isATwilioWhatsAppChannel
);
},
},

View file

@ -109,7 +109,7 @@ describe('inboxMixin', () => {
expect(wrapper.vm.isASmsInbox).toBe(true);
});
it('isATwilioWhatsappChannel returns true if channel type is Twilio and medium is whatsapp', () => {
it('isATwilioWhatsAppChannel returns true if channel type is Twilio and medium is WhatsApp', () => {
const Component = {
render() {},
mixins: [inboxMixin],
@ -124,7 +124,7 @@ describe('inboxMixin', () => {
};
const wrapper = shallowMount(Component);
expect(wrapper.vm.isATwilioChannel).toBe(true);
expect(wrapper.vm.isATwilioWhatsappChannel).toBe(true);
expect(wrapper.vm.isATwilioWhatsAppChannel).toBe(true);
});
it('isAnEmailChannel returns true if channel type is email', () => {