Skip to content

Commit 221c6ea

Browse files
committed
v8.5.9
1 parent eb976bc commit 221c6ea

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Gleap = window.Gleap;
22

3-
//Gleap.setFrameUrl("http://0.0.0.0:3001");
4-
//Gleap.setApiUrl("http://0.0.0.0:9000");
3+
Gleap.setFrameUrl("http://0.0.0.0:3001");
4+
Gleap.setApiUrl("http://0.0.0.0:9000");
55
Gleap.initialize("DUPaIr7s689BBblcFI4pc5aBgYJTm7Sc");
66
//Gleap.setEnvironment("dev");
77

index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ export namespace Gleap {
102102
): void;
103103
function showSurvey(
104104
actionType: string,
105-
outboundId: string,
106-
format: string
105+
format?: string
107106
): void;
108107
function on(event: string, callback: (data?: any) => void): void;
109108
function getIdentity(): any;

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

published/8.5.9/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: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ class Gleap {
153153

154154
// Inject the notification container
155155
GleapNotificationManager.getInstance().injectNotificationUI();
156+
157+
// Check for URL params.
158+
Gleap.checkForUrlParams();
156159
})
157160
.catch(function (err) {
158161
console.warn("Failed to initialize Gleap.");
@@ -162,6 +165,27 @@ class Gleap {
162165
sessionInstance.startSession();
163166
}
164167

168+
static checkForUrlParams() {
169+
if (typeof window === "undefined" || !window.location.search) {
170+
return;
171+
}
172+
173+
try {
174+
const urlParams = new URLSearchParams(window.location.search);
175+
const feedbackFlow = urlParams.get('gleap_feedback');
176+
if (feedbackFlow && feedbackFlow.length > 0) {
177+
Gleap.startFeedbackFlow(feedbackFlow);
178+
}
179+
const surveyFlow = urlParams.get('gleap_survey');
180+
const surveyFlowFormat = urlParams.get('gleap_survey_format');
181+
if (surveyFlow && surveyFlow.length > 0) {
182+
Gleap.showSurvey(surveyFlow, surveyFlowFormat === "survey_full" ? "survey_full" : "survey");
183+
}
184+
} catch (exp) {
185+
console.log(exp);
186+
}
187+
}
188+
165189
/**
166190
* Destroy
167191
* @returns
@@ -524,14 +548,12 @@ class Gleap {
524548
/**
525549
* Shows a survey manually.
526550
* @param {*} actionType
527-
* @param {*} outboundId
528551
* @param {*} format
529552
*/
530-
static showSurvey(actionType, outboundId, format) {
553+
static showSurvey(actionType, format = "survey") {
531554
Gleap.startFeedbackFlowWithOptions(
532555
actionType,
533556
{
534-
actionOutboundId: outboundId,
535557
hideBackButton: true,
536558
format,
537559
},
@@ -556,7 +578,7 @@ class Gleap {
556578
options = {},
557579
isSurvey = false
558580
) {
559-
const { actionOutboundId, autostartDrawing, hideBackButton, format } =
581+
const { autostartDrawing, hideBackButton, format } =
560582
options;
561583
const sessionInstance = GleapSession.getInstance();
562584
if (!sessionInstance.ready) {
@@ -581,7 +603,6 @@ class Gleap {
581603
name: action,
582604
data: {
583605
flow: feedbackFlow,
584-
actionOutboundId: actionOutboundId,
585606
hideBackButton: hideBackButton,
586607
format,
587608
},
@@ -832,11 +853,11 @@ class Gleap {
832853
performActions(actions) {
833854
for (let i = 0; i < actions.length; i++) {
834855
const action = actions[i];
835-
if (action && action.outbound && action.actionType) {
856+
if (action && action.actionType) {
836857
if (action.actionType === "notification") {
837858
Gleap.showNotification(action);
838859
} else {
839-
Gleap.showSurvey(action.actionType, action.outbound, action.format);
860+
Gleap.showSurvey(action.actionType, action.format);
840861
}
841862
}
842863
}

0 commit comments

Comments
 (0)