@openreplay/tracker 15.0.6 → 15.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +48 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/observer/observer.d.ts +4 -1
- package/dist/cjs/main/app/observer/top_observer.d.ts +1 -0
- package/dist/lib/index.js +48 -12
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/observer/observer.d.ts +4 -1
- package/dist/lib/main/app/observer/top_observer.d.ts +1 -0
- package/dist/types/main/app/observer/observer.d.ts +4 -1
- package/dist/types/main/app/observer/top_observer.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3729,6 +3729,7 @@ class Nodes {
|
|
|
3729
3729
|
}
|
|
3730
3730
|
|
|
3731
3731
|
const iconCache = {};
|
|
3732
|
+
const svgUrlCache = {};
|
|
3732
3733
|
const domParser = new DOMParser();
|
|
3733
3734
|
async function parseUseEl(useElement, mode) {
|
|
3734
3735
|
try {
|
|
@@ -3745,13 +3746,43 @@ async function parseUseEl(useElement, mode) {
|
|
|
3745
3746
|
if (iconCache[symbolId]) {
|
|
3746
3747
|
return iconCache[symbolId];
|
|
3747
3748
|
}
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3749
|
+
let svgDoc;
|
|
3750
|
+
if (svgUrlCache[url]) {
|
|
3751
|
+
if (svgUrlCache[url] === 1) {
|
|
3752
|
+
await new Promise((resolve) => {
|
|
3753
|
+
let tries = 0;
|
|
3754
|
+
const interval = setInterval(() => {
|
|
3755
|
+
if (tries > 100) {
|
|
3756
|
+
clearInterval(interval);
|
|
3757
|
+
resolve(false);
|
|
3758
|
+
}
|
|
3759
|
+
if (svgUrlCache[url] !== 1) {
|
|
3760
|
+
svgDoc = svgUrlCache[url];
|
|
3761
|
+
clearInterval(interval);
|
|
3762
|
+
resolve(true);
|
|
3763
|
+
}
|
|
3764
|
+
else {
|
|
3765
|
+
tries++;
|
|
3766
|
+
}
|
|
3767
|
+
}, 100);
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
3770
|
+
else {
|
|
3771
|
+
svgDoc = svgUrlCache[url] ?? `<svg xmlns="http://www.w3.org/2000/svg"></svg>`;
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
svgUrlCache[url] = 1;
|
|
3776
|
+
const response = await fetch(url);
|
|
3777
|
+
const svgText = await response.text();
|
|
3778
|
+
svgDoc = domParser.parseFromString(svgText, 'image/svg+xml');
|
|
3779
|
+
svgUrlCache[url] = svgDoc;
|
|
3780
|
+
}
|
|
3781
|
+
// @ts-ignore
|
|
3751
3782
|
const symbol = svgDoc.getElementById(symbolId);
|
|
3752
3783
|
if (!symbol) {
|
|
3753
3784
|
console.debug('Openreplay: Symbol not found in SVG.');
|
|
3754
|
-
return;
|
|
3785
|
+
return '';
|
|
3755
3786
|
}
|
|
3756
3787
|
if (mode === 'inline') ;
|
|
3757
3788
|
if (mode === 'svgtext') {
|
|
@@ -3806,7 +3837,7 @@ var RecentsType;
|
|
|
3806
3837
|
RecentsType[RecentsType["Changed"] = 2] = "Changed";
|
|
3807
3838
|
})(RecentsType || (RecentsType = {}));
|
|
3808
3839
|
class Observer {
|
|
3809
|
-
constructor(app, isTopContext = false) {
|
|
3840
|
+
constructor(app, isTopContext = false, options = { disableSprites: false }) {
|
|
3810
3841
|
this.app = app;
|
|
3811
3842
|
this.isTopContext = isTopContext;
|
|
3812
3843
|
this.commited = [];
|
|
@@ -3814,6 +3845,8 @@ class Observer {
|
|
|
3814
3845
|
this.indexes = [];
|
|
3815
3846
|
this.attributesMap = new Map();
|
|
3816
3847
|
this.textSet = new Set();
|
|
3848
|
+
this.disableSprites = false;
|
|
3849
|
+
this.disableSprites = options.disableSprites;
|
|
3817
3850
|
this.observer = createMutationObserver(this.app.safe((mutations) => {
|
|
3818
3851
|
for (const mutation of mutations) {
|
|
3819
3852
|
// mutations order is sequential
|
|
@@ -3908,7 +3941,7 @@ class Observer {
|
|
|
3908
3941
|
if (value === null) {
|
|
3909
3942
|
this.app.send(RemoveNodeAttribute(id, name));
|
|
3910
3943
|
}
|
|
3911
|
-
if (isUseElement(node) && name === 'href') {
|
|
3944
|
+
if (isUseElement(node) && name === 'href' && !this.disableSprites) {
|
|
3912
3945
|
parseUseEl(node, 'svgtext')
|
|
3913
3946
|
.then((svgData) => {
|
|
3914
3947
|
if (svgData) {
|
|
@@ -4262,7 +4295,11 @@ class IFrameOffsets {
|
|
|
4262
4295
|
const attachShadowNativeFn = IN_BROWSER ? Element.prototype.attachShadow : () => new ShadowRoot();
|
|
4263
4296
|
class TopObserver extends Observer {
|
|
4264
4297
|
constructor(params) {
|
|
4265
|
-
|
|
4298
|
+
const opts = Object.assign({
|
|
4299
|
+
captureIFrames: true,
|
|
4300
|
+
disableSprites: false,
|
|
4301
|
+
}, params.options);
|
|
4302
|
+
super(params.app, true, opts);
|
|
4266
4303
|
this.iframeOffsets = new IFrameOffsets();
|
|
4267
4304
|
this.contextCallbacks = [];
|
|
4268
4305
|
// Attached once per Tracker instance
|
|
@@ -4272,9 +4309,7 @@ class TopObserver extends Observer {
|
|
|
4272
4309
|
this.docObservers = new WeakMap();
|
|
4273
4310
|
this.shadowRootObservers = new WeakMap();
|
|
4274
4311
|
this.app = params.app;
|
|
4275
|
-
this.options =
|
|
4276
|
-
captureIFrames: true,
|
|
4277
|
-
}, params.options);
|
|
4312
|
+
this.options = opts;
|
|
4278
4313
|
// IFrames
|
|
4279
4314
|
this.app.nodes.attachNodeCallback((node) => {
|
|
4280
4315
|
if (hasTag(node, 'iframe') &&
|
|
@@ -4703,7 +4738,7 @@ class App {
|
|
|
4703
4738
|
this.stopCallbacks = [];
|
|
4704
4739
|
this.commitCallbacks = [];
|
|
4705
4740
|
this.activityState = ActivityState.NotActive;
|
|
4706
|
-
this.version = '15.0.
|
|
4741
|
+
this.version = '15.0.7'; // TODO: version compatability check inside each plugin.
|
|
4707
4742
|
this.socketMode = false;
|
|
4708
4743
|
this.compressionThreshold = 24 * 1000;
|
|
4709
4744
|
this.bc = null;
|
|
@@ -5036,6 +5071,7 @@ class App {
|
|
|
5036
5071
|
fixedCanvasScaling: false,
|
|
5037
5072
|
disableCanvas: false,
|
|
5038
5073
|
captureIFrames: true,
|
|
5074
|
+
disableSprites: false,
|
|
5039
5075
|
obscureTextEmails: true,
|
|
5040
5076
|
obscureTextNumbers: false,
|
|
5041
5077
|
crossdomain: {
|
|
@@ -9165,7 +9201,7 @@ class API {
|
|
|
9165
9201
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9166
9202
|
const doNotTrack = this.checkDoNotTrack();
|
|
9167
9203
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9168
|
-
trackerVersion: '15.0.
|
|
9204
|
+
trackerVersion: '15.0.7',
|
|
9169
9205
|
projectKey: this.options.projectKey,
|
|
9170
9206
|
doNotTrack,
|
|
9171
9207
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|