Skip to content

Commit 0f69d6f

Browse files
committed
v12.5.0
1 parent 8e9218b commit 0f69d6f

File tree

9 files changed

+71
-11
lines changed

9 files changed

+71
-11
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/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Gleap.setWSApiUrl("ws://0.0.0.0:8080");
66

77
// Gleap.setLanguage("en");
88

9-
Gleap.initialize("81IAthSlhI4XfQTtedQ0d3OXt5WYynOX");
9+
Gleap.initialize("kqHBGdyxG0qq6gcfHDqgNkxg5r0Ut0Le");
1010

1111
/*Gleap.setUrlHandler((url, newTab) => {
1212
alert("URL: " + url + " newTab: " + newTab);

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

published/12.5.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: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,11 @@ class Gleap {
215215
if (surveyFlow && surveyFlow.length > 0) {
216216
Gleap.showSurvey(surveyFlow, surveyFlowFormat === "survey_full" ? "survey_full" : "survey");
217217
}
218-
} catch (exp) {
219-
console.log(exp);
220-
}
218+
const tourId = urlParams.get('gleap_tour');
219+
if (tourId && tourId.length > 0) {
220+
Gleap.startProductTour(tourId);
221+
}
222+
} catch (exp) { }
221223
}
222224

223225
/**
@@ -1029,14 +1031,21 @@ class Gleap {
10291031
} else if (action.actionType === "banner") {
10301032
Gleap.showBanner(action);
10311033
} else if (action.actionType === "tour") {
1032-
Gleap.startProductTourWithConfig(action.id, action.data);
1034+
Gleap.startProductTourWithConfig(action.outbound, action.data);
10331035
} else {
10341036
Gleap.showSurvey(action.actionType, action.format);
10351037
}
10361038
}
10371039
}
10381040
}
10391041

1042+
static startProductTour(tourId) {
1043+
const self = this;
1044+
GleapSession.getInstance().startProductTourConfig(tourId).then((config) => {
1045+
self.startProductTourWithConfig(tourId, config);
1046+
}).catch((error) => { });
1047+
}
1048+
10401049
static startProductTourWithConfig(tourId, config) {
10411050
GleapProductTours.getInstance().startWithConfig(tourId, config, (data) => {
10421051
const comData = {

src/GleapProductTours.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default class GleapProductTours {
6565
var driverStep = {
6666
popover: {
6767
description: message,
68-
popoverClass: `gleap-tour-popover-${step.type}`,
68+
popoverClass: `gleap-tour-popover-${step.type} ${config.allowClose && 'gleap-tour-popover-can-close'}`,
6969
},
7070
}
7171
if (step.selector && step.selector.length > 0) {
@@ -101,6 +101,9 @@ export default class GleapProductTours {
101101
const mediaElements = document.querySelectorAll('.gleap-tour-popover-description img, .gleap-tour-popover-description video');
102102

103103
const performRequentialRefresh = () => {
104+
setTimeout(() => {
105+
gleapTourObj.refresh();
106+
}, 500);
104107
setTimeout(() => {
105108
gleapTourObj.refresh();
106109
}, 750);

src/GleapSession.js

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export default class GleapSession {
160160

161161
this.notifySessionReady();
162162
};
163-
163+
164164
startSession = (attemp = 0) => {
165165
// Check if we already have a session cookie.
166166
try {
@@ -285,7 +285,7 @@ export default class GleapSession {
285285
try {
286286
const sessionData = JSON.parse(http.responseText);
287287
self.validateSession(sessionData);
288-
288+
289289
// Initially track.
290290
GleapStreamedEvent.getInstance().restart();
291291

@@ -322,4 +322,47 @@ export default class GleapSession {
322322
});
323323
});
324324
};
325+
326+
startProductTourConfig = (tourId) => {
327+
const self = this;
328+
return new Promise((resolve, reject) => {
329+
this.setOnSessionReady(function () {
330+
if (!self.session.gleapId || !self.session.gleapHash) {
331+
return reject("Session not ready yet.");
332+
}
333+
334+
const http = new XMLHttpRequest();
335+
http.open("POST", self.apiUrl + "/outbound/producttours");
336+
http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
337+
http.setRequestHeader("Api-Token", self.sdkKey);
338+
try {
339+
http.setRequestHeader("Gleap-Id", self.session.gleapId);
340+
http.setRequestHeader("Gleap-Hash", self.session.gleapHash);
341+
} catch (exp) { }
342+
343+
http.onerror = () => {
344+
reject();
345+
};
346+
http.onreadystatechange = function (e) {
347+
if (http.readyState === 4) {
348+
if (http.status === 200 || http.status === 201) {
349+
try {
350+
const tourData = JSON.parse(http.responseText);
351+
if (tourData && tourData.config) {
352+
resolve(tourData.config);
353+
}
354+
} catch (exp) {
355+
reject(exp);
356+
}
357+
} else {
358+
reject();
359+
}
360+
}
361+
};
362+
http.send(JSON.stringify({
363+
outboundId: tourId
364+
}));
365+
});
366+
});
367+
};
325368
}

src/UI.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,10 @@ export const injectStyledCSS = (
16611661
padding: 5px 12px;
16621662
}
16631663
1664+
.gleap-tour-popover-video-pointer.gleap-tour-popover-can-close .gleap-tour-popover-footer {
1665+
right: 40px !important;
1666+
}
1667+
16641668
.gleap-tour-popover-video-pointer:hover .gleap-tour-popover-footer {
16651669
opacity: 1;
16661670
}

0 commit comments

Comments
 (0)