diff --git a/src/components/ChatBot/chatbot.jsx b/src/components/ChatBot/chatbot.jsx index f24fe08..d784013 100644 --- a/src/components/ChatBot/chatbot.jsx +++ b/src/components/ChatBot/chatbot.jsx @@ -31,8 +31,6 @@ class MyChatbot extends Component { })); }; - - render() { const steps = [ { @@ -110,7 +108,7 @@ class MyChatbot extends Component { id: 'endOptions', options: [ { value: 'restart', label: 'Restart Chat', trigger: 'restart' }, - { value: 'end', label: 'End Chat', trigger: 'end' }, + { value: 'end', label: 'End Chat', trigger: 'feedback' }, // Trigger feedback before ending ], hideInput: true, }, @@ -119,11 +117,37 @@ class MyChatbot extends Component { message: 'Let’s start over!', trigger: '1', }, + { + id: 'feedback', + message: 'Please rate your experience with this chat (1-5)', + trigger: 'rating', + }, + { + id: 'rating', + user: true, + validator: (value) => { + if (isNaN(value) || value < 1 || value > 5) { + return 'Please enter a number between 1 and 5'; + } + return true; + }, + trigger: 'comments', + }, + { + id: 'comments', + message: 'Any comments or suggestions?', + trigger: 'feedbackComment', + }, + { + id: 'feedbackComment', + user: true, + trigger: 'end', + }, { id: 'end', component: (