Skip to content

Commit 5c692a2

Browse files
committed
v13.8.1
1 parent 4bd7007 commit 5c692a2

File tree

8 files changed

+83
-57
lines changed

8 files changed

+83
-57
lines changed

.DS_Store

0 Bytes
Binary file not shown.

build/cjs/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.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

demo/main.js

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,40 @@ Gleap.setFrameUrl("http://0.0.0.0:3001");
55
Gleap.setApiUrl("http://0.0.0.0:9000");
66
Gleap.setWSApiUrl("ws://0.0.0.0:9000");
77

8-
Gleap.setAiTools([{
9-
name: 'send-money',
10-
description: 'Send money to a given contact.',
11-
executionType: 'button',
12-
parameters: [{
13-
name: 'amount',
14-
description: 'The amount of money to send. Must be positive and provided by the user.',
15-
type: 'number',
16-
required: true
17-
}, {
18-
name: 'contact',
19-
description: 'The contact to send money to.',
20-
type: 'string',
8+
Gleap.setAiTools([
9+
{
10+
name: "send-money",
11+
description: "Send money to a given contact.",
12+
executionType: "button",
13+
parameters: [
14+
{
15+
name: "amount",
16+
description:
17+
"The amount of money to send. Must be positive and provided by the user.",
18+
type: "number",
19+
required: true,
20+
},
21+
{
22+
name: "contact",
23+
description: "The contact to send money to.",
24+
type: "string",
2125
enum: ["Alice", "Bob"],
22-
required: true
23-
}]
24-
}]);
26+
required: true,
27+
},
28+
],
29+
},
30+
]);
2531

2632
Gleap.on("tool-execution", (tool) => {
27-
console.log("Tool execution", JSON.stringify(tool, null, 2));
33+
console.log("Tool execution", JSON.stringify(tool, null, 2));
2834
});
2935

3036
Gleap.setTicketAttribute("notes", "This is a test value.");
3137

32-
Gleap.initialize("itSm7G1k4MMOfIgZuCfOaJGQ08C5U6fK");
38+
Gleap.identify("user1234", {
39+
email: "lukas@test.com",
40+
name: "Lukas",
41+
sla: 30,
42+
});
43+
44+
Gleap.initialize("xwjGqF5QHMTuQauPoZyMzarGqg7WyTvN");

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": "13.8.0",
3+
"version": "13.8.1",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/13.8.1/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: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ import GleapTagManager from "./GleapTagManager";
2525
import GleapAdminManager from "./GleapAdminManager";
2626
import GleapProductTours from "./GleapProductTours";
2727

28-
if (typeof HTMLCanvasElement !== "undefined" && HTMLCanvasElement.prototype && HTMLCanvasElement.prototype.__originalGetContext === undefined) {
28+
if (
29+
typeof HTMLCanvasElement !== "undefined" &&
30+
HTMLCanvasElement.prototype &&
31+
HTMLCanvasElement.prototype.__originalGetContext === undefined
32+
) {
2933
HTMLCanvasElement.prototype.__originalGetContext =
3034
HTMLCanvasElement.prototype.getContext;
3135
HTMLCanvasElement.prototype.getContext = function (type, options) {
@@ -88,15 +92,15 @@ class Gleap {
8892

8993
/**
9094
* Set tags to be submitted with each ticket.
91-
* @param {*} tags
95+
* @param {*} tags
9296
*/
9397
static setTags(tags) {
9498
GleapTagManager.getInstance().setTags(tags);
9599
}
96100

97101
/**
98102
* Sets a custom URL handler.
99-
* @param {*} urlHandler
103+
* @param {*} urlHandler
100104
*/
101105
static setUrlHandler(urlHandler) {
102106
GleapFrameManager.getInstance().setUrlHandler(urlHandler);
@@ -113,7 +117,7 @@ class Gleap {
113117

114118
/**
115119
* Disable the in-app notifications.
116-
* @param {*} disableInAppNotifications
120+
* @param {*} disableInAppNotifications
117121
*/
118122
static setDisableInAppNotifications(disableInAppNotifications) {
119123
const instance = this.getInstance();
@@ -122,7 +126,7 @@ class Gleap {
122126

123127
/**
124128
* Disable the default page tracking.
125-
* @param {*} disablePageTracking
129+
* @param {*} disablePageTracking
126130
*/
127131
static setDisablePageTracking(disablePageTracking) {
128132
const instance = this.getInstance();
@@ -214,18 +218,27 @@ class Gleap {
214218

215219
try {
216220
const urlParams = new URLSearchParams(window.location.search);
217-
const feedbackFlow = urlParams.get('gleap_feedback');
221+
222+
const widget = urlParams.get("gleap_widget");
223+
if (widget && widget.length > 0) {
224+
Gleap.open();
225+
}
226+
227+
const feedbackFlow = urlParams.get("gleap_feedback");
218228
if (feedbackFlow && feedbackFlow.length > 0) {
219229
Gleap.startFeedbackFlow(feedbackFlow);
220230
}
221-
const surveyFlow = urlParams.get('gleap_survey');
222-
const surveyFlowFormat = urlParams.get('gleap_survey_format');
231+
const surveyFlow = urlParams.get("gleap_survey");
232+
const surveyFlowFormat = urlParams.get("gleap_survey_format");
223233
if (surveyFlow && surveyFlow.length > 0) {
224-
Gleap.showSurvey(surveyFlow, surveyFlowFormat === "survey_full" ? "survey_full" : "survey");
234+
Gleap.showSurvey(
235+
surveyFlow,
236+
surveyFlowFormat === "survey_full" ? "survey_full" : "survey"
237+
);
225238
}
226-
const tourId = urlParams.get('gleap_tour');
239+
const tourId = urlParams.get("gleap_tour");
227240
if (tourId && tourId.length > 0) {
228-
var tourDelay = parseInt(urlParams.get('gleap_tour_delay'));
241+
var tourDelay = parseInt(urlParams.get("gleap_tour_delay"));
229242
if (isNaN(tourDelay)) {
230243
tourDelay = 4;
231244
}
@@ -234,7 +247,7 @@ class Gleap {
234247
Gleap.startProductTour(tourId);
235248
}, tourDelay * 1000);
236249
}
237-
} catch (exp) { }
250+
} catch (exp) {}
238251
}
239252

240253
/**
@@ -260,7 +273,7 @@ class Gleap {
260273

261274
/**
262275
* Enable or disable Gleap session tracking through cookies.
263-
* @param {*} useCookies
276+
* @param {*} useCookies
264277
*/
265278
static setUseCookies(useCookies) {
266279
GleapSession.getInstance().useCookies = useCookies;
@@ -284,9 +297,7 @@ class Gleap {
284297
* @param {*} userData
285298
*/
286299
static updateContact(userData) {
287-
return GleapSession.getInstance().updateSession(
288-
gleapDataParser(userData),
289-
);
300+
return GleapSession.getInstance().updateSession(gleapDataParser(userData));
290301
}
291302

292303
/**
@@ -361,7 +372,7 @@ class Gleap {
361372

362373
/**
363374
* Set custom replay options.
364-
* @param {*} options
375+
* @param {*} options
365376
*/
366377
static setReplayOptions(options) {
367378
GleapReplayRecorder.getInstance().setOptions(options);
@@ -687,8 +698,8 @@ class Gleap {
687698
);
688699
feedback
689700
.sendFeedback()
690-
.then(() => { })
691-
.catch((error) => { });
701+
.then(() => {})
702+
.catch((error) => {});
692703
}
693704

694705
/**
@@ -733,8 +744,7 @@ class Gleap {
733744
options = {},
734745
isSurvey = false
735746
) {
736-
const { autostartDrawing, hideBackButton, format } =
737-
options;
747+
const { autostartDrawing, hideBackButton, format } = options;
738748
const sessionInstance = GleapSession.getInstance();
739749
if (!sessionInstance.ready) {
740750
return;
@@ -1117,9 +1127,12 @@ class Gleap {
11171127

11181128
static startProductTour(tourId) {
11191129
const self = this;
1120-
GleapSession.getInstance().startProductTourConfig(tourId).then((config) => {
1121-
self.startProductTourWithConfig(tourId, config);
1122-
}).catch((error) => { });
1130+
GleapSession.getInstance()
1131+
.startProductTourConfig(tourId)
1132+
.then((config) => {
1133+
self.startProductTourWithConfig(tourId, config);
1134+
})
1135+
.catch((error) => {});
11231136
}
11241137

11251138
static startProductTourWithConfig(tourId, config) {
@@ -1136,7 +1149,7 @@ class Gleap {
11361149
static showBanner(data) {
11371150
try {
11381151
GleapBannerManager.getInstance().showBanner(data);
1139-
} catch (e) { }
1152+
} catch (e) {}
11401153
}
11411154

11421155
static showNotification(data) {
@@ -1185,51 +1198,51 @@ if (typeof window !== "undefined") {
11851198

11861199
const handleGleapLink = (href) => {
11871200
try {
1188-
const urlParts = href.split('/');
1201+
const urlParts = href.split("/");
11891202
const type = urlParts[2];
1190-
if (type === 'article') {
1203+
if (type === "article") {
11911204
const identifier = urlParts[3];
11921205
Gleap.openHelpCenterArticle(identifier, true);
11931206
}
11941207

1195-
if (type === 'collection') {
1208+
if (type === "collection") {
11961209
const identifier = urlParts[3];
11971210
Gleap.openHelpCenterCollection(identifier, true);
11981211
}
11991212

1200-
if (type === 'flow') {
1213+
if (type === "flow") {
12011214
const identifier = urlParts[3];
12021215
Gleap.startFeedbackFlow(identifier, true);
12031216
}
12041217

1205-
if (type === 'survey') {
1218+
if (type === "survey") {
12061219
const identifier = urlParts[3];
12071220
Gleap.showSurvey(identifier);
12081221
}
12091222

1210-
if (type === 'bot') {
1223+
if (type === "bot") {
12111224
const identifier = urlParts[3];
12121225
Gleap.startBot(identifier, true);
12131226
}
12141227

1215-
if (type === 'news') {
1228+
if (type === "news") {
12161229
const identifier = urlParts[3];
12171230
Gleap.openNewsArticle(identifier, true);
12181231
}
12191232

1220-
if (type === 'checklist') {
1233+
if (type === "checklist") {
12211234
const identifier = urlParts[3];
12221235
Gleap.startChecklist(identifier, true);
12231236
}
12241237

1225-
if (type === 'tour') {
1238+
if (type === "tour") {
12261239
const identifier = urlParts[3];
12271240
Gleap.startProductTour(identifier);
12281241
}
12291242
} catch (e) {
12301243
console.error("Failed to handle Gleap link: ", href);
12311244
}
1232-
}
1245+
};
12331246

12341247
export {
12351248
GleapNetworkIntercepter,

0 commit comments

Comments
 (0)