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() {
|
||||
const isUserEmailAvailable = !!this.currentUser.email;
|
||||
const isUserPhoneNumberAvailable = !!this.currentUser.phone_number;
|
||||
const isUserIdentifierAvailable = !!this.currentUser.identifier;
|
||||
const isUserNameAvailable = !!(
|
||||
isUserIdentifierAvailable ||
|
||||
isUserEmailAvailable ||
|
||||
isUserPhoneNumberAvailable
|
||||
);
|
||||
return this.preChatFields.filter(field => {
|
||||
return !(
|
||||
(isUserEmailAvailable && field.name === 'emailAddress') ||
|
||||
(isUserPhoneNumberAvailable && field.name === 'phoneNumber')
|
||||
);
|
||||
if (isUserEmailAvailable && field.name === 'emailAddress') {
|
||||
return false;
|
||||
}
|
||||
if (isUserPhoneNumberAvailable && field.name === 'phoneNumber') {
|
||||
return false;
|
||||
}
|
||||
if (isUserNameAvailable && field.name === 'fullName') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
enabledPreChatFields() {
|
||||
|
|
|
@ -2,3 +2,4 @@ json.id @contact.id
|
|||
json.name @contact.name
|
||||
json.email @contact.email
|
||||
json.phone_number @contact.phone_number
|
||||
json.identifier @contact.identifier
|
||||
|
|
Loading…
Reference in a new issue