Skip to content

Commit 1118fbd

Browse files
committed
Merge remote-tracking branch 'origin/master' into imp/default-font
# Conflicts: # build/browser/index.js # build/browser/index.js.map # build/cjs/index.js # build/cjs/index.js.map # build/esm/index.mjs # build/esm/index.mjs.map # published/latest/index.js # published/latest/index.js.map
2 parents e84e307 + e135e92 commit 1118fbd

File tree

11 files changed

+82
-8
lines changed

11 files changed

+82
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![Gleap JavaScript SDK Intro](https://github.com/GleapSDK/JavaScript-SDK/blob/master/resources/banner.png?raw=true)
44

5-
Welcome to the Gleap JavaScript SDK. Enhance your platform with features like Kai, our advanced GPT-4 AI chatbot, intuitive outbound messaging tools, and a comprehensive Help Center. Explore our toolkit designed for efficient and engaging customer interactions. Join us in setting new standards for user experience in the digital age. Let's code, innovate, and grow together!
5+
Welcome to the Gleap JavaScript SDK. Integrate AI-native customer support and feedback into your app in minutes. Leverage Kai, our autonomous AI agent, to resolve customer inquiries, automate complex workflows, and assist your support team with copilot-powered answers. Combine that with a built-in Help Center, outbound messaging, product roadmaps, bug tracking, and a unified multichannel inbox — everything your team needs to build better software, faster. Let's code, innovate, and grow together!
66

77
## 📖 Docs & Examples
88

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "15.2.1",
3+
"version": "15.2.4",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/15.2.2/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/15.2.2/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/15.2.3/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/15.2.3/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/15.2.4/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/15.2.4/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapSession.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class GleapSession {
2323
wsApiUrl = 'wss://ws.gleap.io';
2424
sdkKey = null;
2525
updatingSession = false;
26-
useCookies = false;
26+
useCookies = true;
2727
session = {
2828
gleapId: null,
2929
gleapHash: null,

src/GleapTours.js

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,30 @@ const GleapTours = (function () {
266266
transferHighlight(elemObj, step);
267267
}
268268
function refreshActiveHighlight() {
269-
const activeHighlight = getState('__activeElement');
269+
var activeHighlight = getState('__activeElement');
270270
const activeStep = getState('__activeStep');
271-
if (!activeHighlight) {
271+
if (!activeHighlight || !activeStep) {
272272
return;
273273
}
274+
275+
// Re-query the element if the cached reference is no longer in the DOM.
276+
if (!document.body.contains(activeHighlight) && activeStep.element && typeof activeStep.element === 'string') {
277+
try {
278+
var freshEl = document.querySelector(activeStep.element);
279+
if (!freshEl) {
280+
var escaped = activeStep.element.replace(/(#[^#\s]+)/g, function (match) {
281+
return match.replace(/:/g, '\\:');
282+
});
283+
freshEl = document.querySelector(escaped);
284+
}
285+
if (freshEl) {
286+
activeHighlight = freshEl;
287+
setState('__activeElement', freshEl);
288+
freshEl.classList.add('gleap-tour-active-element');
289+
}
290+
} catch (e) {}
291+
}
292+
274293
trackActiveElement(activeHighlight);
275294
refreshOverlay();
276295
repositionPopover(activeHighlight, activeStep);
@@ -446,11 +465,30 @@ const GleapTours = (function () {
446465
window.addEventListener('keydown', trapFocus, false);
447466
window.addEventListener('resize', requireRefresh);
448467
window.addEventListener('scroll', requireRefresh);
468+
469+
const observer = new MutationObserver(function (mutations) {
470+
const isTourMutation = mutations.every(function (m) {
471+
return (
472+
m.target.closest &&
473+
(m.target.closest('.gleap-tour-popover') ||
474+
m.target.closest('.gleap-tour-overlay') ||
475+
m.target.closest('#gleap-tour-dummy-element'))
476+
);
477+
});
478+
if (!isTourMutation) {
479+
requireRefresh();
480+
}
481+
});
482+
observer.observe(document.body, { childList: true, subtree: true, attributes: true });
483+
setState('__mutationObserver', observer);
449484
}
450485
function destroyEvents() {
451486
window.removeEventListener('keyup', onKeyup);
452487
window.removeEventListener('resize', requireRefresh);
453488
window.removeEventListener('scroll', requireRefresh);
489+
490+
const observer = getState('__mutationObserver');
491+
if (observer) observer.disconnect();
454492
}
455493
function hidePopover() {
456494
const popover = getState('popover');

0 commit comments

Comments
 (0)