chore: Twilio to individual(SMS/Whatsapp) channels (#2566)

This commit is contained in:
Siddharth Ramesh
2021-07-12 22:33:39 +05:30
committed by GitHub
parent ba547b3f60
commit fc4ef1595b
8 changed files with 138 additions and 96 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -37,8 +37,12 @@
src="~dashboard/assets/images/channels/website.png" src="~dashboard/assets/images/channels/website.png"
/> />
<img <img
v-if="channel.key === 'twilio'" v-if="channel.key === 'sms'"
src="~dashboard/assets/images/channels/twilio.png" src="~dashboard/assets/images/channels/sms.png"
/>
<img
v-if="channel.key === 'whatsapp'"
src="~dashboard/assets/images/channels/whatsapp.png"
/> />
<h3 class="channel__title"> <h3 class="channel__title">
{{ channel.name }} {{ channel.name }}
@@ -72,7 +76,7 @@ export default {
if (key === 'email') { if (key === 'email') {
return this.enabledFeatures.channel_email; return this.enabledFeatures.channel_email;
} }
return ['website', 'twilio', 'api'].includes(key); return ['website', 'twilio', 'api', 'whatsapp', 'sms'].includes(key);
}, },
}, },
methods: { methods: {

View File

@@ -126,6 +126,14 @@
"API": { "API": {
"ERROR_MESSAGE": "We were not able to authenticate Twilio credentials, please try again" "ERROR_MESSAGE": "We were not able to authenticate Twilio credentials, please try again"
} }
},
"SMS": {
"TITLE": "SMS Channel via Twilio",
"DESC": "Start supporting your customers via SMS with Twilio integration."
},
"WHATSAPP": {
"TITLE": "Whatsapp Channel via Twilio",
"DESC": "Start supporting your customers via Whatsapp with Twilio integration."
}, },
"API_CHANNEL": { "API_CHANNEL": {
"TITLE": "API Channel", "TITLE": "API Channel",

View File

@@ -42,7 +42,8 @@ export default {
{ key: 'website', name: 'Website' }, { key: 'website', name: 'Website' },
{ key: 'facebook', name: 'Facebook' }, { key: 'facebook', name: 'Facebook' },
{ key: 'twitter', name: 'Twitter' }, { key: 'twitter', name: 'Twitter' },
{ key: 'twilio', name: 'Twilio' }, { key: 'whatsapp', name: 'WhatsApp via Twilio' },
{ key: 'sms', name: 'SMS via Twilio' },
{ key: 'email', name: 'Email' }, { key: 'email', name: 'Email' },
{ {
key: 'api', key: 'api',

View File

@@ -1,17 +1,19 @@
import Facebook from './channels/Facebook'; import Facebook from './channels/Facebook';
import Website from './channels/Website'; import Website from './channels/Website';
import Twitter from './channels/Twitter'; import Twitter from './channels/Twitter';
import Twilio from './channels/Twilio';
import Api from './channels/Api'; import Api from './channels/Api';
import Email from './channels/Email'; import Email from './channels/Email';
import Sms from './channels/Sms';
import Whatsapp from './channels/Whatsapp';
const channelViewList = { const channelViewList = {
facebook: Facebook, facebook: Facebook,
website: Website, website: Website,
twitter: Twitter, twitter: Twitter,
twilio: Twilio,
api: Api, api: Api,
email: Email, email: Email,
sms: Sms,
whatsapp: Whatsapp,
}; };
export default { export default {

View File

@@ -0,0 +1,21 @@
<template>
<div class="wizard-body small-9 columns">
<page-header
:header-title="$t('INBOX_MGMT.ADD.SMS.TITLE')"
:header-content="$t('INBOX_MGMT.ADD.SMS.DESC')"
/>
<twilio type="sms"></twilio>
</div>
</template>
<script>
import PageHeader from '../../SettingsSubPageHeader';
import Twilio from './Twilio';
export default {
components: {
PageHeader,
Twilio,
},
};
</script>

View File

@@ -1,9 +1,5 @@
<!-- Deprecated in favour of separate files for SMS and Whatsapp and also to implement new providers for each platform in the future-->
<template> <template>
<div class="wizard-body small-9 columns">
<page-header
:header-title="$t('INBOX_MGMT.ADD.TWILIO.TITLE')"
:header-content="$t('INBOX_MGMT.ADD.TWILIO.DESC')"
/>
<form class="row" @submit.prevent="createChannel()"> <form class="row" @submit.prevent="createChannel()">
<div class="medium-8 columns"> <div class="medium-8 columns">
<label :class="{ error: $v.channelName.$error }"> <label :class="{ error: $v.channelName.$error }">
@@ -20,19 +16,6 @@
</label> </label>
</div> </div>
<div class="medium-8 columns">
<label :class="{ error: $v.medium.$error }">
{{ $t('INBOX_MGMT.ADD.TWILIO.CHANNEL_TYPE.LABEL') }}
<select v-model="medium">
<option value="sms">SMS</option>
<option value="whatsapp">Whatsapp</option>
</select>
<span v-if="$v.medium.$error" class="message">{{
$t('INBOX_MGMT.ADD.TWILIO.CHANNEL_TYPE.ERROR')
}}</span>
</label>
</div>
<div class="medium-8 columns"> <div class="medium-8 columns">
<label :class="{ error: $v.phoneNumber.$error }"> <label :class="{ error: $v.phoneNumber.$error }">
{{ $t('INBOX_MGMT.ADD.TWILIO.PHONE_NUMBER.LABEL') }} {{ $t('INBOX_MGMT.ADD.TWILIO.PHONE_NUMBER.LABEL') }}
@@ -84,7 +67,6 @@
/> />
</div> </div>
</form> </form>
</div>
</template> </template>
<script> <script>
@@ -92,20 +74,22 @@ import { mapGetters } from 'vuex';
import alertMixin from 'shared/mixins/alertMixin'; import alertMixin from 'shared/mixins/alertMixin';
import { required } from 'vuelidate/lib/validators'; import { required } from 'vuelidate/lib/validators';
import router from '../../../../index'; import router from '../../../../index';
import PageHeader from '../../SettingsSubPageHeader';
const shouldStartWithPlusSign = (value = '') => value.startsWith('+'); const shouldStartWithPlusSign = (value = '') => value.startsWith('+');
export default { export default {
components: {
PageHeader,
},
mixins: [alertMixin], mixins: [alertMixin],
props: {
type: {
type: String,
required: true,
},
},
data() { data() {
return { return {
accountSID: '', accountSID: '',
authToken: '', authToken: '',
medium: '', medium: this.type,
channelName: '', channelName: '',
phoneNumber: '', phoneNumber: '',
}; };

View File

@@ -0,0 +1,22 @@
<template>
<div class="wizard-body small-9 columns">
<page-header
:header-title="$t('INBOX_MGMT.ADD.WHATSAPP.TITLE')"
:header-content="$t('INBOX_MGMT.ADD.WHATSAPP.DESC')"
/>
<twilio type="whatsapp"></twilio>
</div>
</template>
<script>
import PageHeader from '../../SettingsSubPageHeader';
import Twilio from './Twilio';
export default {
components: {
PageHeader,
Twilio,
},
};
</script>