Skip to content

Commit 1eb849b

Browse files
committed
v12.7.0
1 parent 0685cfe commit 1eb849b

File tree

9 files changed

+72
-38
lines changed

9 files changed

+72
-38
lines changed

build/index.js

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

demo/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ <h2 class="sub-headline">
224224
ctx.stroke();
225225
</script>
226226
<div class="content" id="haha">
227+
<a href="https://www.google.com">asdf asfasdfasfdasdf</a>
227228
<div class="skeleton-text"></div>
228229
<div class="skeleton-text"></div>
229230
<div class="skeleton-text"></div>

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": "12.6.0",
3+
"version": "12.7.0",
44
"main": "build/index.js",
55
"scripts": {
66
"start": "webpack serve",

published/12.7.0/index.js

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/latest/index.js

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

src/Gleap.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,14 @@ class Gleap {
217217
}
218218
const tourId = urlParams.get('gleap_tour');
219219
if (tourId && tourId.length > 0) {
220-
Gleap.startProductTour(tourId);
220+
var tourDelay = parseInt(urlParams.get('gleap_tour_delay'));
221+
if (isNaN(tourDelay)) {
222+
tourDelay = 4;
223+
}
224+
225+
setTimeout(() => {
226+
Gleap.startProductTour(tourId);
227+
}, tourDelay * 1000);
221228
}
222229
} catch (exp) { }
223230
}
@@ -1058,9 +1065,7 @@ class Gleap {
10581065
static showBanner(data) {
10591066
try {
10601067
GleapBannerManager.getInstance().showBanner(data);
1061-
} catch (e) {
1062-
console.log(e);
1063-
}
1068+
} catch (e) { }
10641069
}
10651070

10661071
static showNotification(data) {

src/GleapProductTours.js

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default class GleapProductTours {
55
productTourData = undefined;
66
productTourId = undefined;
77
onCompletion = undefined;
8+
unmuted = false;
89

910
// GleapReplayRecorder singleton
1011
static instance;
@@ -33,6 +34,7 @@ export default class GleapProductTours {
3334
return;
3435
}
3536

37+
this.unmuted = false;
3638
const steps = config.steps;
3739
const self = this;
3840

@@ -45,10 +47,10 @@ export default class GleapProductTours {
4547

4648
if (step.type === "video-pointer") {
4749
message = `<div class="gleap-tour-video">
48-
<video class="gleap-tour-video-obj">
50+
<video class="gleap-tour-video-obj" muted autoplay>
4951
<source src="${step.videoUrl}" type="video/mp4">
5052
</video>
51-
<div class="gleap-tour-video-playpause">${loadIcon("play")}</div>
53+
<div class="gleap-tour-video-playpause">${loadIcon("unmute")}</div>
5254
</div>`;
5355
} else {
5456
var senderHTML = ``;
@@ -63,6 +65,7 @@ export default class GleapProductTours {
6365
}
6466

6567
var driverStep = {
68+
disableActiveInteraction: !(step.allowClick ?? true),
6669
popover: {
6770
description: message,
6871
popoverClass: `gleap-tour-popover-${step.type} ${config.allowClose && 'gleap-tour-popover-can-close'}`,
@@ -129,35 +132,53 @@ export default class GleapProductTours {
129132
}
130133
}
131134

132-
// Video player controller.
133-
const playButtonElem = document.querySelector('.gleap-tour-video-playpause');
134-
if (playButtonElem) {
135-
playButtonElem.addEventListener('click', () => {
136-
const playingClass = 'gleap-tour-video--playing';
137-
const videoElement = playButtonElem.previousElementSibling;
138-
const videoContainer = playButtonElem.closest('.gleap-tour-video');
135+
const playingClass = 'gleap-tour-video--playing';
139136

140-
const onVideoEnded = () => {
141-
videoElem.innerHTML = loadIcon("play");
142-
videoContainer.classList.remove(playingClass);
143-
};
137+
const videoElement = document.querySelector('.gleap-tour-video-obj');
138+
if (videoElement) {
139+
const videoContainer = videoElement.closest('.gleap-tour-video');
144140

145-
if (videoElement.paused) {
141+
if (self.unmuted) {
142+
if (videoElement) {
143+
videoElement.pause();
144+
videoElement.muted = false;
146145
videoElement.play();
147-
playButtonElem.innerHTML = loadIcon("pause");
148146
videoContainer.classList.add(playingClass);
149-
150-
// Add event listener for video ended
151-
videoElement.addEventListener('ended', onVideoEnded);
152-
} else {
153-
videoElement.pause();
154-
playButtonElem.innerHTML = loadIcon("play");
155-
videoContainer.classList.remove(playingClass);
156-
157-
// Remove event listener for video ended
158-
videoElement.removeEventListener('ended', onVideoEnded);
159147
}
148+
}
149+
150+
videoElement.addEventListener('ended', function () {
151+
playButtonElem.innerHTML = loadIcon("replay");
152+
videoContainer.classList.remove(playingClass);
160153
});
154+
155+
// Video player controller.
156+
const playButtonElem = document.querySelector('.gleap-tour-video-playpause');
157+
if (playButtonElem) {
158+
playButtonElem.addEventListener('click', () => {
159+
if (videoElement.muted) {
160+
self.unmuted = true;
161+
162+
videoElement.pause();
163+
videoElement.currentTime = 0;
164+
videoElement.muted = false;
165+
videoElement.play();
166+
167+
playButtonElem.innerHTML = loadIcon("mute");
168+
videoContainer.classList.add(playingClass);
169+
} else if (videoElement.paused) {
170+
videoElement.muted = false;
171+
videoElement.play();
172+
173+
playButtonElem.innerHTML = loadIcon("mute");
174+
videoContainer.classList.add(playingClass);
175+
} else {
176+
videoElement.pause();
177+
playButtonElem.innerHTML = loadIcon("unmute");
178+
videoContainer.classList.remove(playingClass);
179+
}
180+
});
181+
}
161182
}
162183
}
163184
});

src/GleapTours.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const GleapTours = function () {
313313
fromElement.removeAttribute("aria-haspopup");
314314
fromElement.removeAttribute("aria-expanded");
315315
fromElement.removeAttribute("aria-controls");
316-
const disableActiveInteraction = getConfig("disableActiveInteraction");
316+
const disableActiveInteraction = toStep.disableActiveInteraction ?? getConfig("disableActiveInteraction") ?? false;
317317
if (disableActiveInteraction) {
318318
toElement.classList.add("gleap-tour-no-interaction");
319319
}

src/UI.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ export const injectStyledCSS = (
17581758
}
17591759
17601760
.gleap-tour-video-playpause svg {
1761-
width: 24px;
1761+
width: 34px;
17621762
height: auto;
17631763
fill: #fff;
17641764
}
@@ -1998,12 +1998,18 @@ export const loadIcon = function (name, color) {
19981998
</svg>`;
19991999
}
20002000

2001-
if (name === "play") {
2002-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg>`;
2001+
if (name === "unmute") {
2002+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.1 386.2C556.7 352 576 306.3 576 256c0-60.1-27.7-113.8-70.9-149c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C507.3 170.7 528 210.9 528 256c0 39.1-15.6 74.5-40.9 100.5L449 326.6c19-17.5 31-42.7 31-70.6c0-30.1-13.9-56.9-35.4-74.5c-10.3-8.4-25.4-6.8-33.8 3.5s-6.8 25.4 3.5 33.8C425.1 227.6 432 241 432 256s-6.9 28.4-17.7 37.3c-1.3 1-2.4 2.2-3.4 3.4L352 250.6V64c0-12.6-7.4-24-18.9-29.2s-25-3.1-34.4 5.3L197.8 129.8 38.8 5.1zM352 373.3L82.9 161.3C53.8 167.4 32 193.1 32 224v64c0 35.3 28.7 64 64 64h67.8L298.7 471.9c9.4 8.4 22.9 10.4 34.4 5.3S352 460.6 352 448V373.3z"/></svg>`;
2003+
}
2004+
2005+
if (name === "mute") {
2006+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M533.6 32.5C598.5 85.3 640 165.8 640 256s-41.5 170.8-106.4 223.5c-10.3 8.4-25.4 6.8-33.8-3.5s-6.8-25.4 3.5-33.8C557.5 398.2 592 331.2 592 256s-34.5-142.2-88.7-186.3c-10.3-8.4-11.8-23.5-3.5-33.8s23.5-11.8 33.8-3.5zM473.1 107c43.2 35.2 70.9 88.9 70.9 149s-27.7 113.8-70.9 149c-10.3 8.4-25.4 6.8-33.8-3.5s-6.8-25.4 3.5-33.8C475.3 341.3 496 301.1 496 256s-20.7-85.3-53.2-111.8c-10.3-8.4-11.8-23.5-3.5-33.8s23.5-11.8 33.8-3.5zm-60.5 74.5C434.1 199.1 448 225.9 448 256s-13.9 56.9-35.4 74.5c-10.3 8.4-25.4 6.8-33.8-3.5s-6.8-25.4 3.5-33.8C393.1 284.4 400 271 400 256s-6.9-28.4-17.7-37.3c-10.3-8.4-11.8-23.5-3.5-33.8s23.5-11.8 33.8-3.5zM301.1 34.8C312.6 40 320 51.4 320 64V448c0 12.6-7.4 24-18.9 29.2s-25 3.1-34.4-5.3L131.8 352H64c-35.3 0-64-28.7-64-64V224c0-35.3 28.7-64 64-64h67.8L266.7 40.1c9.4-8.4 22.9-10.4 34.4-5.3z"/></svg>`;
20032007
}
20042008

2005-
if (name === "pause") {
2006-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M48 64C21.5 64 0 85.5 0 112V400c0 26.5 21.5 48 48 48H80c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H48zm192 0c-26.5 0-48 21.5-48 48V400c0 26.5 21.5 48 48 48h32c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H240z"/></svg>`;
2009+
if (name === "replay") {
2010+
return `<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2011+
<path d="M48.5 224H40C26.7 224 16 213.3 16 200V72C16 62.3 21.8 53.5 30.8 49.8C39.8 46.1 50.1 48.1 57 55L98.6 96.6C186.2 10.1 327.3 10.4 414.4 97.6C501.9 185.1 501.9 326.9 414.4 414.4C326.9 501.9 185.1 501.9 97.6 414.4C85.1 401.9 85.1 381.6 97.6 369.1C110.1 356.6 130.4 356.6 142.9 369.1C205.4 431.6 306.7 431.6 369.2 369.1C431.7 306.6 431.7 205.3 369.2 142.8C307 80.6 206.5 80.3 143.9 141.8L185 183C191.9 189.9 193.9 200.2 190.2 209.2C186.5 218.2 177.7 224 168 224H48.5Z" />
2012+
</svg>`;
20072013
}
20082014

20092015
if (name === "dismiss") {

0 commit comments

Comments
 (0)