diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index 33946f4b..43279ddc 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -68,9 +68,9 @@ const Sidebar = ({ const handleClick = () => { setIsOpen(false); - // check to see if hotjar is available, then trigger hotjar event + // check to see if hotjar is available, then trigger hotjar event if user has sent and received a message const hasWindow = typeof window !== 'undefined'; - if (hasWindow && window.hj) { + if (hasWindow && window.hj && messageList.length >= 2) { window.hj('event', 'ocm_learning_assistant_chat_closed'); } }; diff --git a/src/components/ToggleXpertButton/index.jsx b/src/components/ToggleXpertButton/index.jsx index ba3cd51f..cd81958f 100644 --- a/src/components/ToggleXpertButton/index.jsx +++ b/src/components/ToggleXpertButton/index.jsx @@ -51,6 +51,7 @@ const ToggleXpert = ({ event.preventDefault(); event.stopPropagation(); setHasDismissed(true); + localStorage.setItem('dismissedLearningAssistantCallToAction', 'true'); sendTrackEvent('edx.ui.lms.learning_assistant.dismiss_action_message', { course_id: courseId, }); @@ -94,7 +95,7 @@ const ToggleXpert = ({ ${contentToolsEnabled ? 'chat-content-tools-margin' : ''}` } > - {!hasDismissed && ( + {(!localStorage.getItem('dismissedLearningAssistantCallToAction') && !hasDismissed) && (