diff --git a/app/javascript/widget/components/PreChat/Form.vue b/app/javascript/widget/components/PreChat/Form.vue index 69e543b21..1649068c6 100644 --- a/app/javascript/widget/components/PreChat/Form.vue +++ b/app/javascript/widget/components/PreChat/Form.vue @@ -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() { diff --git a/app/views/api/v1/widget/contacts/show.json.jbuilder b/app/views/api/v1/widget/contacts/show.json.jbuilder index d6228cbfe..2e7a38277 100644 --- a/app/views/api/v1/widget/contacts/show.json.jbuilder +++ b/app/views/api/v1/widget/contacts/show.json.jbuilder @@ -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