@@ -25,7 +25,11 @@ import GleapTagManager from "./GleapTagManager";
2525import GleapAdminManager from "./GleapAdminManager" ;
2626import 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
11861199const 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
12341247export {
12351248 GleapNetworkIntercepter ,
0 commit comments