* feat(zapi): connect flow and UI updates * fix(zapi): re-add manage connection section * feat(zapi): reply * feat: send message * fix: qrcode job logic * test: qr code job specs * chore: concurrent index * chore: whatsapp model minor * test: message window service specs * chore: service refactor * test: zapi service * chore: zapi beta * chore: minor fixes * test: incoming message specs * chore: minor fixes * feat: handle status transitions * test: refactor spec * test: refactor spec * chore(z-api): use feature flag * chore: fix migration name
75 lines
1.8 KiB
Vue
75 lines
1.8 KiB
Vue
<script setup>
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useStoreGetters } from 'dashboard/composables/store';
|
|
import { computed } from 'vue';
|
|
|
|
const props = defineProps({
|
|
channelType: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
medium: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
provider: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
});
|
|
const getters = useStoreGetters();
|
|
const { t } = useI18n();
|
|
const globalConfig = computed(() => getters['globalConfig/get'].value);
|
|
|
|
const i18nMap = {
|
|
'Channel::FacebookPage': 'MESSENGER',
|
|
'Channel::WebWidget': 'WEB_WIDGET',
|
|
'Channel::TwitterProfile': 'TWITTER_PROFILE',
|
|
'Channel::TwilioSms': 'TWILIO_SMS',
|
|
'Channel::Whatsapp': 'WHATSAPP',
|
|
'Channel::Sms': 'SMS',
|
|
'Channel::Email': 'EMAIL',
|
|
'Channel::Telegram': 'TELEGRAM',
|
|
'Channel::Line': 'LINE',
|
|
'Channel::Api': 'API',
|
|
'Channel::Instagram': 'INSTAGRAM',
|
|
'Channel::Voice': 'VOICE',
|
|
};
|
|
|
|
const twilioChannelName = () => {
|
|
if (props.medium === 'whatsapp') {
|
|
return t(`INBOX_MGMT.CHANNELS.WHATSAPP`);
|
|
}
|
|
return t(`INBOX_MGMT.CHANNELS.TWILIO_SMS`);
|
|
};
|
|
|
|
const whatsappChannelName = () => {
|
|
if (props.provider === 'baileys') {
|
|
return t(`INBOX_MGMT.CHANNELS.WHATSAPP_BAILEYS`);
|
|
}
|
|
if (props.provider === 'zapi') {
|
|
return t(`INBOX_MGMT.CHANNELS.WHATSAPP_ZAPI`);
|
|
}
|
|
return t(`INBOX_MGMT.CHANNELS.WHATSAPP`);
|
|
};
|
|
|
|
const readableChannelName = computed(() => {
|
|
if (props.channelType === 'Channel::Api') {
|
|
return globalConfig.value.apiChannelName || t('INBOX_MGMT.CHANNELS.API');
|
|
}
|
|
if (props.channelType === 'Channel::TwilioSms') {
|
|
return twilioChannelName();
|
|
}
|
|
if (props.channelType === 'Channel::Whatsapp') {
|
|
return whatsappChannelName();
|
|
}
|
|
return t(`INBOX_MGMT.CHANNELS.${i18nMap[props.channelType]}`);
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<span>
|
|
{{ readableChannelName }}
|
|
</span>
|
|
</template>
|