Skip to content

Commit

Permalink
v12.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Oct 24, 2023
1 parent c1872ba commit 0c9ff0c
Show file tree
Hide file tree
Showing 9 changed files with 2,583 additions and 3,719 deletions.
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ <h2 class="sub-headline">
<div class="header-container-image">
<img class="head-image" src="./pexels-niklas-jeromin-12734294.jpg" />
</div>
<canvas id="myCanvas" width="200" height="200" style="border:1px solid #000000;"></canvas>

<script>
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
var radius = 70;

ctx.beginPath();
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
ctx.fillStyle = 'blue';
ctx.fill();
ctx.stroke();
</script>
<div class="content" id="haha">
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
Expand All @@ -217,6 +232,7 @@ <h2 class="sub-headline">
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
</div>

</body>

</html>
13 changes: 12 additions & 1 deletion demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ const Gleap = window.Gleap;

// Gleap.setLanguage("en");

Gleap.initialize("X5C0grjFCjUMbZKi131MjZLaGRwg2iKH");
Gleap.setReplayOptions({
recordCanvas: true,
sampling: {
canvas: 15,
},
dataURLOptions: {
type: 'image/webp',
quality: 0.6,
},
});

Gleap.initialize("U7alA97Vzu15arf4XFpPyxNOdNAv4u0H");

/*Gleap.setUrlHandler((url, newTab) => {
alert("URL: " + url + " newTab: " + newTab);
Expand Down
37 changes: 37 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,42 @@ export namespace Gleap {
function on(event: string, callback: (data?: any) => void): void;
function getIdentity(): any;
function isUserIdentified(): boolean;
function setReplayOptions(options: {
blockClass?: string | RegExp;
blockSelector?: string;
ignoreClass?: string | RegExp;
ignoreSelector?: string;
ignoreCSSAttributes?: string[];
maskTextClass?: string | RegExp;
maskTextSelector?: string;
maskAllInputs?: boolean;
maskInputOptions?: {
password?: boolean;
[key: string]: any;
};
maskInputFn?: (text: string) => string;
maskTextFn?: (text: string) => string;
slimDOMOptions?: {
[key: string]: any;
};
dataURLOptions?: {
[key: string]: any;
};
hooks?: {
[key: string]: any;
};
packFn?: (events: any) => any;
sampling?: any;
recordCanvas?: boolean;
recordCrossOriginIframes?: boolean;
recordAfter?: 'DOMContentLoaded' | 'load';
inlineImages?: boolean;
collectFonts?: boolean;
userTriggeredOnInput?: boolean;
plugins?: {
[key: string]: any;
}[];
errorHandler?: (error: Error) => void;
}): void;
}
export default Gleap;
2 changes: 1 addition & 1 deletion published/12.1.1/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion published/latest/index.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/Gleap.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ class Gleap {
GleapNetworkIntercepter.getInstance().setMaxRequests(maxRequests);
}

/**
* Set custom replay options.
* @param {*} options
*/
static setReplayOptions(options) {
GleapReplayRecorder.getInstance().setOptions(options);
}

/**
* Closes any open Gleap dialogs.
*/
Expand Down
62 changes: 37 additions & 25 deletions src/GleapReplayRecorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default class GleapReplayRecorder {
events = [];
bufferSize = 0;
stopFunction = undefined;
customOptions = {};

// GleapReplayRecorder singleton
static instance;
Expand All @@ -20,6 +21,10 @@ export default class GleapReplayRecorder {

constructor() { }

setOptions(options) {
this.customOptions = options;
}

/**
* Start replays
* @returns
Expand All @@ -30,38 +35,45 @@ export default class GleapReplayRecorder {
this.startDate = Date.now();
var events = this.events;

var options = {
inlineStylesheet: true,
blockClass: "gl-block",
ignoreClass: "gl-ignore",
maskTextClass: "gl-mask",
dataURLOptions: {
quality: 0.7,
},
recordCanvas: false,
sampling: {
scroll: 150,
mouseInteraction: {
MouseUp: false,
MouseDown: false,
Click: true,
ContextMenu: true,
DblClick: true,
Focus: true,
Blur: true,
TouchStart: true,
TouchEnd: false,
},
},
collectFonts: false,
recordCrossOriginIframes: false,
};

try {
this.stopFunction = rrwebRecord({
...options,
...this.customOptions,
emit(rrwebEvent) {
const { event } = ensureMaxMessageSize(rrwebEvent);
events.push(event);
},
recordCanvas: false,
dataURLOptions: {
quality: 0.7,
},
sampling: {
scroll: 150,
mouseInteraction: {
MouseUp: false,
MouseDown: false,
Click: true,
ContextMenu: true,
DblClick: true,
Focus: true,
Blur: true,
TouchStart: true,
TouchEnd: false,
},
},
collectFonts: false,
inlineStylesheet: true,
recordCrossOriginIframes: false,
blockClass: "gl-block",
ignoreClass: "gl-ignore",
maskTextClass: "gl-mask",
});
} catch (e) { }
} catch (e) {
console.error(e);
}
}

/**
Expand Down
Loading

0 comments on commit 0c9ff0c

Please sign in to comment.