fix: Disable name in pre-chat form if the name is already provided in setUser
(#5466)
This commit is contained in:
parent
252eda14c6
commit
706ab872f3
2 changed files with 17 additions and 4 deletions
|
@ -117,11 +117,23 @@ export default {
|
||||||
filteredPreChatFields() {
|
filteredPreChatFields() {
|
||||||
const isUserEmailAvailable = !!this.currentUser.email;
|
const isUserEmailAvailable = !!this.currentUser.email;
|
||||||
const isUserPhoneNumberAvailable = !!this.currentUser.phone_number;
|
const isUserPhoneNumberAvailable = !!this.currentUser.phone_number;
|
||||||
|
const isUserIdentifierAvailable = !!this.currentUser.identifier;
|
||||||
|
const isUserNameAvailable = !!(
|
||||||
|
isUserIdentifierAvailable ||
|
||||||
|
isUserEmailAvailable ||
|
||||||
|
isUserPhoneNumberAvailable
|
||||||
|
);
|
||||||
return this.preChatFields.filter(field => {
|
return this.preChatFields.filter(field => {
|
||||||
return !(
|
if (isUserEmailAvailable && field.name === 'emailAddress') {
|
||||||
(isUserEmailAvailable && field.name === 'emailAddress') ||
|
return false;
|
||||||
(isUserPhoneNumberAvailable && field.name === 'phoneNumber')
|
}
|
||||||
);
|
if (isUserPhoneNumberAvailable && field.name === 'phoneNumber') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isUserNameAvailable && field.name === 'fullName') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
enabledPreChatFields() {
|
enabledPreChatFields() {
|
||||||
|
|
|
@ -2,3 +2,4 @@ json.id @contact.id
|
||||||
json.name @contact.name
|
json.name @contact.name
|
||||||
json.email @contact.email
|
json.email @contact.email
|
||||||
json.phone_number @contact.phone_number
|
json.phone_number @contact.phone_number
|
||||||
|
json.identifier @contact.identifier
|
||||||
|
|
Loading…
Reference in a new issue