feat: Adds number validation for WhatsApp inbox at the creation step (#6043)

Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
Sivin Varghese
2022-12-13 09:22:37 +05:30
committed by GitHub
parent 86958278cd
commit 9d78f0d6c6
6 changed files with 25 additions and 13 deletions

View File

@@ -134,7 +134,7 @@
"PHONE_NUMBER": {
"LABEL": "Phone number",
"PLACEHOLDER": "Please enter the phone number from which message will be sent.",
"ERROR": "Please enter a valid value. Phone number should start with `+` sign."
"ERROR": "Please provide a valid phone number that starts with a `+` sign and does not contain any spaces."
},
"API_CALLBACK": {
"TITLE": "Callback URL",
@@ -185,7 +185,7 @@
"PHONE_NUMBER": {
"LABEL": "Phone number",
"PLACEHOLDER": "Please enter the phone number from which message will be sent.",
"ERROR": "Please enter a valid value. Phone number should start with `+` sign."
"ERROR": "Please provide a valid phone number that starts with a `+` sign and does not contain any spaces."
},
"SUBMIT_BUTTON": "Create Bandwidth Channel",
"API": {
@@ -214,7 +214,7 @@
"PHONE_NUMBER": {
"LABEL": "Phone number",
"PLACEHOLDER": "Please enter the phone number from which message will be sent.",
"ERROR": "Please enter a valid value. Phone number should start with `+` sign."
"ERROR": "Please provide a valid phone number that starts with a `+` sign and does not contain any spaces."
},
"PHONE_NUMBER_ID": {
"LABEL": "Phone number ID",

View File

@@ -62,7 +62,7 @@ import alertMixin from 'shared/mixins/alertMixin';
import { required } from 'vuelidate/lib/validators';
import router from '../../../../index';
const shouldStartWithPlusSign = (value = '') => value.startsWith('+');
import { isPhoneE164OrEmpty } from 'shared/helpers/Validators';
export default {
mixins: [alertMixin],
@@ -78,7 +78,7 @@ export default {
},
validations: {
inboxName: { required },
phoneNumber: { required, shouldStartWithPlusSign },
phoneNumber: { required, isPhoneE164OrEmpty },
apiKey: { required },
},
methods: {

View File

@@ -99,8 +99,7 @@ import { mapGetters } from 'vuex';
import alertMixin from 'shared/mixins/alertMixin';
import { required } from 'vuelidate/lib/validators';
import router from '../../../../index';
const shouldStartWithPlusSign = (value = '') => value.startsWith('+');
import { isPhoneE164OrEmpty, isNumber } from 'shared/helpers/Validators';
export default {
mixins: [alertMixin],
@@ -118,10 +117,10 @@ export default {
},
validations: {
inboxName: { required },
phoneNumber: { required, shouldStartWithPlusSign },
phoneNumber: { required, isPhoneE164OrEmpty },
apiKey: { required },
phoneNumberId: { required },
businessAccountId: { required },
phoneNumberId: { required, isNumber },
businessAccountId: { required, isNumber },
},
methods: {
async createChannel() {

View File

@@ -110,8 +110,7 @@ import { mapGetters } from 'vuex';
import alertMixin from 'shared/mixins/alertMixin';
import { required } from 'vuelidate/lib/validators';
import router from '../../../../index';
const shouldStartWithPlusSign = (value = '') => value.startsWith('+');
import { isPhoneE164OrEmpty } from 'shared/helpers/Validators';
export default {
mixins: [alertMixin],
@@ -142,7 +141,7 @@ export default {
return {
channelName: { required },
messagingServiceSID: {},
phoneNumber: { shouldStartWithPlusSign },
phoneNumber: { required, isPhoneE164OrEmpty },
authToken: { required },
accountSID: { required },
medium: { required },