@openreplay/tracker 3.3.0 → 3.4.1
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/cjs/app/index.d.ts +6 -1
- package/cjs/app/index.js +49 -19
- package/cjs/app/observer.d.ts +19 -2
- package/cjs/app/observer.js +119 -39
- package/cjs/index.js +11 -7
- package/cjs/messages/index.d.ts +8 -0
- package/cjs/messages/index.js +15 -0
- package/cjs/messages/webworker.d.ts +1 -0
- package/cjs/messages/writer.js +3 -0
- package/cjs/modules/console.js +1 -1
- package/cjs/modules/cssrules.js +1 -2
- package/cjs/modules/img.js +2 -2
- package/cjs/modules/mouse.d.ts +5 -1
- package/cjs/modules/mouse.js +8 -3
- package/cjs/modules/timing.js +20 -15
- package/cjs/utils.d.ts +1 -1
- package/cjs/utils.js +3 -12
- package/cjs/vendors/finder/finder.js +12 -8
- package/lib/app/index.d.ts +6 -1
- package/lib/app/index.js +51 -21
- package/lib/app/observer.d.ts +19 -2
- package/lib/app/observer.js +121 -41
- package/lib/index.js +12 -8
- package/lib/messages/index.d.ts +8 -0
- package/lib/messages/index.js +14 -0
- package/lib/messages/tsconfig.tsbuildinfo +1 -1
- package/lib/messages/webworker.d.ts +1 -0
- package/lib/messages/writer.js +3 -0
- package/lib/modules/console.js +1 -1
- package/lib/modules/cssrules.js +1 -2
- package/lib/modules/img.js +3 -3
- package/lib/modules/mouse.d.ts +5 -1
- package/lib/modules/mouse.js +8 -3
- package/lib/modules/timing.js +20 -15
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +1 -9
- package/lib/vendors/finder/finder.js +12 -8
- package/package.json +2 -1
package/lib/utils.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export declare function timestamp(): number;
|
|
|
2
2
|
export declare const stars: (str: string) => string;
|
|
3
3
|
export declare function normSpaces(str: string): string;
|
|
4
4
|
export declare function isURL(s: string): boolean;
|
|
5
|
-
export declare function getBaseURI(): string;
|
|
6
5
|
export declare const IN_BROWSER: boolean;
|
|
7
6
|
export declare const log: {
|
|
8
7
|
(...data: any[]): void;
|
|
@@ -12,6 +11,7 @@ export declare const warn: {
|
|
|
12
11
|
(...data: any[]): void;
|
|
13
12
|
(message?: any, ...optionalParams: any[]): void;
|
|
14
13
|
};
|
|
14
|
+
export declare const DOCS_HOST = "https://docs.openreplay.com";
|
|
15
15
|
export declare function deprecationWarn(nameOfFeature: string, useInstead: string, docsPath?: string): void;
|
|
16
16
|
export declare function getLabelAttribute(e: Element): string | null;
|
|
17
17
|
export declare function hasOpenreplayAttribute(e: Element, name: string): boolean;
|
package/lib/utils.js
CHANGED
|
@@ -11,18 +11,10 @@ export function normSpaces(str) {
|
|
|
11
11
|
export function isURL(s) {
|
|
12
12
|
return s.substr(0, 8) === 'https://' || s.substr(0, 7) === 'http://';
|
|
13
13
|
}
|
|
14
|
-
export function getBaseURI() {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
if (document.baseURI) {
|
|
17
|
-
return document.baseURI;
|
|
18
|
-
}
|
|
19
|
-
// IE only
|
|
20
|
-
return ((_b = (_a = document.head) === null || _a === void 0 ? void 0 : _a.getElementsByTagName("base")[0]) === null || _b === void 0 ? void 0 : _b.getAttribute("href")) || location.origin + location.pathname;
|
|
21
|
-
}
|
|
22
14
|
export const IN_BROWSER = !(typeof window === "undefined");
|
|
23
15
|
export const log = console.log;
|
|
24
16
|
export const warn = console.warn;
|
|
25
|
-
const DOCS_HOST = 'https://docs.openreplay.com';
|
|
17
|
+
export const DOCS_HOST = 'https://docs.openreplay.com';
|
|
26
18
|
const warnedFeatures = {};
|
|
27
19
|
export function deprecationWarn(nameOfFeature, useInstead, docsPath = "/") {
|
|
28
20
|
if (warnedFeatures[nameOfFeature]) {
|
|
@@ -211,42 +211,46 @@ function maybe(...level) {
|
|
|
211
211
|
function notEmpty(value) {
|
|
212
212
|
return value !== null && value !== undefined;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function combinations(stack, path = []) {
|
|
215
|
+
const paths = [];
|
|
215
216
|
if (stack.length > 0) {
|
|
216
217
|
for (let node of stack[0]) {
|
|
217
|
-
|
|
218
|
+
paths.push(...combinations(stack.slice(1, stack.length), path.concat(node)));
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
else {
|
|
221
|
-
|
|
222
|
+
paths.push(path);
|
|
222
223
|
}
|
|
224
|
+
return paths;
|
|
223
225
|
}
|
|
224
226
|
function sort(paths) {
|
|
225
227
|
return Array.from(paths).sort((a, b) => penalty(a) - penalty(b));
|
|
226
228
|
}
|
|
227
|
-
function
|
|
229
|
+
function optimize(path, input, scope = {
|
|
228
230
|
counter: 0,
|
|
229
231
|
visited: new Map()
|
|
230
232
|
}) {
|
|
233
|
+
const paths = [];
|
|
231
234
|
if (path.length > 2 && path.length > config.optimizedMinLength) {
|
|
232
235
|
for (let i = 1; i < path.length - 1; i++) {
|
|
233
236
|
if (scope.counter > config.maxNumberOfTries) {
|
|
234
|
-
return; // Okay At least I tried!
|
|
237
|
+
return paths; // Okay At least I tried!
|
|
235
238
|
}
|
|
236
239
|
scope.counter += 1;
|
|
237
240
|
const newPath = [...path];
|
|
238
241
|
newPath.splice(i, 1);
|
|
239
242
|
const newPathKey = selector(newPath);
|
|
240
243
|
if (scope.visited.has(newPathKey)) {
|
|
241
|
-
return;
|
|
244
|
+
return paths;
|
|
242
245
|
}
|
|
243
246
|
if (unique(newPath) && same(newPath, input)) {
|
|
244
|
-
|
|
247
|
+
paths.push(newPath);
|
|
245
248
|
scope.visited.set(newPathKey, true);
|
|
246
|
-
|
|
249
|
+
paths.push(...optimize(newPath, input, scope));
|
|
247
250
|
}
|
|
248
251
|
}
|
|
249
252
|
}
|
|
253
|
+
return paths;
|
|
250
254
|
}
|
|
251
255
|
function same(path, input) {
|
|
252
256
|
return rootDocument.querySelector(selector(path)) === input;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openreplay/tracker",
|
|
3
3
|
"description": "The OpenReplay tracker main package",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logging",
|
|
7
7
|
"replay"
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@medv/finder": "^2.0.0",
|
|
42
|
+
"@openreplay/tracker-vuex": "^3.0.0",
|
|
42
43
|
"error-stack-parser": "^2.0.6"
|
|
43
44
|
},
|
|
44
45
|
"engines": {
|