feat: do not send contact details to the widget (#9223)

* refactor: use has_email instead of email

* feat: remove usage of details directly in forms

* test: update payload

* test: fix transcript test

* refactor: use computed hasEmail

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Shivam Mishra
2024-04-12 15:30:07 +05:30
committed by GitHub
parent dc757598f1
commit bce2a07d03
11 changed files with 70 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
<template>
<FormulateForm
v-model="formValues"
class="flex flex-1 flex-col p-6 overflow-y-auto"
class="flex flex-col flex-1 p-6 overflow-y-auto"
@submit="onSubmit"
>
<div
@@ -49,7 +49,7 @@
/>
<custom-button
class="font-medium mt-2 mb-5"
class="mt-2 mb-5 font-medium"
block
:bg-color="widgetColor"
:text-color="textColor"
@@ -133,9 +133,10 @@ export default {
return this.preChatFormEnabled ? this.options.preChatFields : [];
},
filteredPreChatFields() {
const isUserEmailAvailable = !!this.currentUser.email;
const isUserPhoneNumberAvailable = !!this.currentUser.phone_number;
const isUserEmailAvailable = this.currentUser.has_email;
const isUserPhoneNumberAvailable = this.currentUser.has_phone_number;
const isUserIdentifierAvailable = !!this.currentUser.identifier;
const isUserNameAvailable = !!(
isUserIdentifierAvailable ||
isUserEmailAvailable ||
@@ -302,11 +303,10 @@ export default {
},
onSubmit() {
const { emailAddress, fullName, phoneNumber, message } = this.formValues;
const { email } = this.currentUser;
this.$emit('submit', {
fullName,
phoneNumber,
emailAddress: emailAddress || email,
emailAddress,
message,
activeCampaignId: this.activeCampaign.id,
conversationCustomAttributes: this.conversationCustomAttributes,