diff --git a/assets/js/src/intro.jsx b/assets/js/src/intro.jsx
index 73a620a02b..551b9f9a13 100644
--- a/assets/js/src/intro.jsx
+++ b/assets/js/src/intro.jsx
@@ -11,7 +11,7 @@ const introSteps = [
intro: MailPoet.I18n.t('introForms'),
},
{
- element: '.mailpoet-chat',
+ element: '#hs-beacon:not(.hs-beacon-hidden) iframe, .olark-launch-button',
intro: MailPoet.I18n.t('introChat'),
},
{
@@ -20,7 +20,13 @@ const introSteps = [
},
];
+let introActive = false;
+
function Intro() {
+ if (introActive) {
+ return;
+ }
+
// don't show on small screens
if (innerWidth <= 960) {
return;
@@ -43,9 +49,14 @@ function Intro() {
tooltipPosition: 'auto',
});
- intro.onafterchange((targetElement) => {
- document.body.classList.add('mailpoet-intro-active');
+ intro.onbeforechange(() => {
+ // evaluate step selector again since DOM might have changed (HelpScout -> Olark)
+ const step = intro._currentStep; // eslint-disable-line no-underscore-dangle
+ const element = introSteps[step].element;
+ intro._introItems[step].element = typeof element === 'string' ? document.querySelector(element) : element; // eslint-disable-line no-underscore-dangle
+ });
+ intro.onafterchange((targetElement) => {
// fix for intro.js positioning bug on 'position: fixed' elements
if (getComputedStyle(targetElement).getPropertyValue('position') === 'fixed') {
const helperLayer = document.querySelector('.introjs-helperLayer');
@@ -56,6 +67,7 @@ function Intro() {
});
intro.onexit(() => {
+ introActive = false;
document.body.classList.remove('mailpoet-intro-active');
});
@@ -72,6 +84,8 @@ function Intro() {
});
intro.start();
+ introActive = true;
+ document.body.classList.add('mailpoet-intro-active');
}
MailPoet.showIntro = Intro;
diff --git a/views/layout.html b/views/layout.html
index 654115f1bf..3d9cc10e9e 100644
--- a/views/layout.html
+++ b/views/layout.html
@@ -113,7 +113,9 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
<% endif %>
diff --git a/views/newsletters.html b/views/newsletters.html
index fc419c5598..e4e75a8608 100644
--- a/views/newsletters.html
+++ b/views/newsletters.html
@@ -307,17 +307,9 @@
<% block after_javascript %>
<% if settings.show_intro %>
<% endif %>
<% endblock %>