feat: Show custom attributes in pre-chat form on new conversation (#6735)
This commit is contained in:
@@ -95,12 +95,7 @@ export default {
|
|||||||
startNewConversation() {
|
startNewConversation() {
|
||||||
this.clearConversations();
|
this.clearConversations();
|
||||||
this.clearConversationAttributes();
|
this.clearConversationAttributes();
|
||||||
|
this.replaceRoute('prechat-form');
|
||||||
// To create a new conversation, we are redirecting
|
|
||||||
// the user to pre-chat with contact fields disabled
|
|
||||||
// Pass disableContactFields params to the route
|
|
||||||
// This would disable the contact fields in the pre-chat form
|
|
||||||
this.replaceRoute('prechat-form', { disableContactFields: true });
|
|
||||||
},
|
},
|
||||||
async sendTranscript() {
|
async sendTranscript() {
|
||||||
const { email } = this.currentUser;
|
const { email } = this.currentUser;
|
||||||
|
|||||||
@@ -74,10 +74,6 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
disableContactFields: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -114,7 +110,7 @@ export default {
|
|||||||
return this.options.preChatMessage;
|
return this.options.preChatMessage;
|
||||||
},
|
},
|
||||||
preChatFields() {
|
preChatFields() {
|
||||||
return this.disableContactFields ? [] : this.options.preChatFields;
|
return this.options?.preChatFields || [];
|
||||||
},
|
},
|
||||||
filteredPreChatFields() {
|
filteredPreChatFields() {
|
||||||
const isUserEmailAvailable = !!this.currentUser.email;
|
const isUserEmailAvailable = !!this.currentUser.email;
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-1 overflow-auto">
|
<div class="flex flex-1 overflow-auto">
|
||||||
<pre-chat-form
|
<pre-chat-form :options="preChatFormOptions" @submit="onSubmit" />
|
||||||
:options="preChatFormOptions"
|
|
||||||
:disable-contact-fields="disableContactFields"
|
|
||||||
@submit="onSubmit"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -23,10 +19,6 @@ export default {
|
|||||||
...mapGetters({
|
...mapGetters({
|
||||||
conversationSize: 'conversation/getConversationSize',
|
conversationSize: 'conversation/getConversationSize',
|
||||||
}),
|
}),
|
||||||
disableContactFields() {
|
|
||||||
const { disableContactFields = false } = this.$route.params || {};
|
|
||||||
return disableContactFields;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
conversationSize(newSize, oldSize) {
|
conversationSize(newSize, oldSize) {
|
||||||
|
|||||||
Reference in New Issue
Block a user