@@ -25,7 +25,11 @@ import GleapTagManager from "./GleapTagManager";
25
25
import GleapAdminManager from "./GleapAdminManager" ;
26
26
import GleapProductTours from "./GleapProductTours" ;
27
27
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
+ ) {
29
33
HTMLCanvasElement . prototype . __originalGetContext =
30
34
HTMLCanvasElement . prototype . getContext ;
31
35
HTMLCanvasElement . prototype . getContext = function ( type , options ) {
@@ -88,15 +92,15 @@ class Gleap {
88
92
89
93
/**
90
94
* Set tags to be submitted with each ticket.
91
- * @param {* } tags
95
+ * @param {* } tags
92
96
*/
93
97
static setTags ( tags ) {
94
98
GleapTagManager . getInstance ( ) . setTags ( tags ) ;
95
99
}
96
100
97
101
/**
98
102
* Sets a custom URL handler.
99
- * @param {* } urlHandler
103
+ * @param {* } urlHandler
100
104
*/
101
105
static setUrlHandler ( urlHandler ) {
102
106
GleapFrameManager . getInstance ( ) . setUrlHandler ( urlHandler ) ;
@@ -113,7 +117,7 @@ class Gleap {
113
117
114
118
/**
115
119
* Disable the in-app notifications.
116
- * @param {* } disableInAppNotifications
120
+ * @param {* } disableInAppNotifications
117
121
*/
118
122
static setDisableInAppNotifications ( disableInAppNotifications ) {
119
123
const instance = this . getInstance ( ) ;
@@ -122,7 +126,7 @@ class Gleap {
122
126
123
127
/**
124
128
* Disable the default page tracking.
125
- * @param {* } disablePageTracking
129
+ * @param {* } disablePageTracking
126
130
*/
127
131
static setDisablePageTracking ( disablePageTracking ) {
128
132
const instance = this . getInstance ( ) ;
@@ -214,18 +218,27 @@ class Gleap {
214
218
215
219
try {
216
220
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" ) ;
218
228
if ( feedbackFlow && feedbackFlow . length > 0 ) {
219
229
Gleap . startFeedbackFlow ( feedbackFlow ) ;
220
230
}
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" ) ;
223
233
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
+ ) ;
225
238
}
226
- const tourId = urlParams . get ( ' gleap_tour' ) ;
239
+ const tourId = urlParams . get ( " gleap_tour" ) ;
227
240
if ( tourId && tourId . length > 0 ) {
228
- var tourDelay = parseInt ( urlParams . get ( ' gleap_tour_delay' ) ) ;
241
+ var tourDelay = parseInt ( urlParams . get ( " gleap_tour_delay" ) ) ;
229
242
if ( isNaN ( tourDelay ) ) {
230
243
tourDelay = 4 ;
231
244
}
@@ -234,7 +247,7 @@ class Gleap {
234
247
Gleap . startProductTour ( tourId ) ;
235
248
} , tourDelay * 1000 ) ;
236
249
}
237
- } catch ( exp ) { }
250
+ } catch ( exp ) { }
238
251
}
239
252
240
253
/**
@@ -260,7 +273,7 @@ class Gleap {
260
273
261
274
/**
262
275
* Enable or disable Gleap session tracking through cookies.
263
- * @param {* } useCookies
276
+ * @param {* } useCookies
264
277
*/
265
278
static setUseCookies ( useCookies ) {
266
279
GleapSession . getInstance ( ) . useCookies = useCookies ;
@@ -284,9 +297,7 @@ class Gleap {
284
297
* @param {* } userData
285
298
*/
286
299
static updateContact ( userData ) {
287
- return GleapSession . getInstance ( ) . updateSession (
288
- gleapDataParser ( userData ) ,
289
- ) ;
300
+ return GleapSession . getInstance ( ) . updateSession ( gleapDataParser ( userData ) ) ;
290
301
}
291
302
292
303
/**
@@ -361,7 +372,7 @@ class Gleap {
361
372
362
373
/**
363
374
* Set custom replay options.
364
- * @param {* } options
375
+ * @param {* } options
365
376
*/
366
377
static setReplayOptions ( options ) {
367
378
GleapReplayRecorder . getInstance ( ) . setOptions ( options ) ;
@@ -687,8 +698,8 @@ class Gleap {
687
698
) ;
688
699
feedback
689
700
. sendFeedback ( )
690
- . then ( ( ) => { } )
691
- . catch ( ( error ) => { } ) ;
701
+ . then ( ( ) => { } )
702
+ . catch ( ( error ) => { } ) ;
692
703
}
693
704
694
705
/**
@@ -733,8 +744,7 @@ class Gleap {
733
744
options = { } ,
734
745
isSurvey = false
735
746
) {
736
- const { autostartDrawing, hideBackButton, format } =
737
- options ;
747
+ const { autostartDrawing, hideBackButton, format } = options ;
738
748
const sessionInstance = GleapSession . getInstance ( ) ;
739
749
if ( ! sessionInstance . ready ) {
740
750
return ;
@@ -1117,9 +1127,12 @@ class Gleap {
1117
1127
1118
1128
static startProductTour ( tourId ) {
1119
1129
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 ) => { } ) ;
1123
1136
}
1124
1137
1125
1138
static startProductTourWithConfig ( tourId , config ) {
@@ -1136,7 +1149,7 @@ class Gleap {
1136
1149
static showBanner ( data ) {
1137
1150
try {
1138
1151
GleapBannerManager . getInstance ( ) . showBanner ( data ) ;
1139
- } catch ( e ) { }
1152
+ } catch ( e ) { }
1140
1153
}
1141
1154
1142
1155
static showNotification ( data ) {
@@ -1185,51 +1198,51 @@ if (typeof window !== "undefined") {
1185
1198
1186
1199
const handleGleapLink = ( href ) => {
1187
1200
try {
1188
- const urlParts = href . split ( '/' ) ;
1201
+ const urlParts = href . split ( "/" ) ;
1189
1202
const type = urlParts [ 2 ] ;
1190
- if ( type === ' article' ) {
1203
+ if ( type === " article" ) {
1191
1204
const identifier = urlParts [ 3 ] ;
1192
1205
Gleap . openHelpCenterArticle ( identifier , true ) ;
1193
1206
}
1194
1207
1195
- if ( type === ' collection' ) {
1208
+ if ( type === " collection" ) {
1196
1209
const identifier = urlParts [ 3 ] ;
1197
1210
Gleap . openHelpCenterCollection ( identifier , true ) ;
1198
1211
}
1199
1212
1200
- if ( type === ' flow' ) {
1213
+ if ( type === " flow" ) {
1201
1214
const identifier = urlParts [ 3 ] ;
1202
1215
Gleap . startFeedbackFlow ( identifier , true ) ;
1203
1216
}
1204
1217
1205
- if ( type === ' survey' ) {
1218
+ if ( type === " survey" ) {
1206
1219
const identifier = urlParts [ 3 ] ;
1207
1220
Gleap . showSurvey ( identifier ) ;
1208
1221
}
1209
1222
1210
- if ( type === ' bot' ) {
1223
+ if ( type === " bot" ) {
1211
1224
const identifier = urlParts [ 3 ] ;
1212
1225
Gleap . startBot ( identifier , true ) ;
1213
1226
}
1214
1227
1215
- if ( type === ' news' ) {
1228
+ if ( type === " news" ) {
1216
1229
const identifier = urlParts [ 3 ] ;
1217
1230
Gleap . openNewsArticle ( identifier , true ) ;
1218
1231
}
1219
1232
1220
- if ( type === ' checklist' ) {
1233
+ if ( type === " checklist" ) {
1221
1234
const identifier = urlParts [ 3 ] ;
1222
1235
Gleap . startChecklist ( identifier , true ) ;
1223
1236
}
1224
1237
1225
- if ( type === ' tour' ) {
1238
+ if ( type === " tour" ) {
1226
1239
const identifier = urlParts [ 3 ] ;
1227
1240
Gleap . startProductTour ( identifier ) ;
1228
1241
}
1229
1242
} catch ( e ) {
1230
1243
console . error ( "Failed to handle Gleap link: " , href ) ;
1231
1244
}
1232
- }
1245
+ } ;
1233
1246
1234
1247
export {
1235
1248
GleapNetworkIntercepter ,
0 commit comments