@@ -52,6 +55,7 @@ import ChatForm from 'shared/components/ChatForm';
import ChatOptions from 'shared/components/ChatOptions';
import ChatArticle from './template/Article';
import EmailInput from './template/EmailInput';
+import CustomerSatisfaction from 'shared/components/CustomerSatisfaction';
export default {
name: 'AgentMessageBubble',
@@ -61,13 +65,14 @@ export default {
ChatForm,
ChatOptions,
EmailInput,
+ CustomerSatisfaction,
},
mixins: [messageFormatterMixin],
props: {
- message: String,
- contentType: String,
- messageType: Number,
- messageId: Number,
+ message: { type: String, default: null },
+ contentType: { type: String, default: null },
+ messageType: { type: Number, default: null },
+ messageId: { type: Number, default: null },
messageContentAttributes: {
type: Object,
default: () => {},
@@ -92,6 +97,9 @@ export default {
isArticle() {
return this.contentType === 'article';
},
+ isCSAT() {
+ return this.contentType === 'input_csat';
+ },
},
methods: {
onResponse(messageResponse) {
diff --git a/app/javascript/widget/i18n/locale/en.json b/app/javascript/widget/i18n/locale/en.json
index 44a2b5dcf..3cbcd6020 100644
--- a/app/javascript/widget/i18n/locale/en.json
+++ b/app/javascript/widget/i18n/locale/en.json
@@ -56,5 +56,9 @@
"INVALID": {
"FIELD": "Invalid field"
}
+ },
+ "CSAT": {
+ "TITLE": "Rate your conversation",
+ "PLACEHOLDER": "Tell us more..."
}
}
diff --git a/app/models/message.rb b/app/models/message.rb
index aaaa34db5..35c175aa2 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -49,7 +49,8 @@ class Message < ApplicationRecord
cards: 5,
form: 6,
article: 7,
- incoming_email: 8
+ incoming_email: 8,
+ input_csat: 9
}
enum status: { sent: 0, delivered: 1, read: 2, failed: 3 }
# [:submitted_email, :items, :submitted_values] : Used for bot message types
diff --git a/db/seeds.rb b/db/seeds.rb
index 6fb8b7970..2cce3e7cf 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -72,6 +72,8 @@ unless Rails.env.production?
WootMessageSeeder.create_sample_form_message conversation
# articles
WootMessageSeeder.create_sample_articles_message conversation
+ # csat
+ WootMessageSeeder.create_sample_csat_collect_message conversation
CannedResponse.create!(account: account, short_code: 'start', content: 'Hello welcome to chatwoot.')
end
diff --git a/lib/woot_message_seeder.rb b/lib/woot_message_seeder.rb
index 7e9aaebe1..5dc3aee48 100644
--- a/lib/woot_message_seeder.rb
+++ b/lib/woot_message_seeder.rb
@@ -10,6 +10,17 @@ module WootMessageSeeder
)
end
+ def self.create_sample_csat_collect_message(conversation)
+ Message.create!(
+ account: conversation.account,
+ inbox: conversation.inbox,
+ conversation: conversation,
+ message_type: :template,
+ content_type: :input_csat,
+ content: 'Please rate the support'
+ )
+ end
+
def self.create_sample_cards_message(conversation)
Message.create!(
account: conversation.account,