@openreplay/tracker 17.1.0 → 17.1.2
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/entry.js +18 -7
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +18 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/modules/analytics/batcher.d.ts +2 -3
- package/dist/cjs/main/modules/analytics/types.d.ts +4 -4
- package/dist/cjs/main/modules/viewport.d.ts +7 -0
- package/dist/lib/entry.js +18 -7
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +18 -7
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/modules/analytics/batcher.d.ts +2 -3
- package/dist/lib/main/modules/analytics/types.d.ts +4 -4
- package/dist/lib/main/modules/viewport.d.ts +7 -0
- package/dist/types/main/modules/analytics/batcher.d.ts +2 -3
- package/dist/types/main/modules/analytics/types.d.ts +4 -4
- package/dist/types/main/modules/viewport.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { categories } from './types';
|
|
2
1
|
interface PeopleEvent {
|
|
3
2
|
type: string;
|
|
4
3
|
timestamp: number;
|
|
@@ -25,8 +24,8 @@ declare class Batcher {
|
|
|
25
24
|
constructor(backendUrl: string, getToken: () => string | null, init: () => Promise<void>);
|
|
26
25
|
getBatches(): {
|
|
27
26
|
data: {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
user_actions: PeopleEvent[];
|
|
28
|
+
events: Event[];
|
|
30
29
|
};
|
|
31
30
|
};
|
|
32
31
|
addEvent(event: any): void;
|
|
@@ -8,11 +8,11 @@ export declare const mutationTypes: {
|
|
|
8
8
|
incrementProperty: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const categories: {
|
|
11
|
-
people:
|
|
12
|
-
events:
|
|
11
|
+
readonly people: "user_actions";
|
|
12
|
+
readonly events: "events";
|
|
13
13
|
};
|
|
14
14
|
export declare const createEvent: (category: (typeof categories)[keyof typeof categories], type?: (typeof mutationTypes)[keyof typeof mutationTypes], timestamp?: number, payload?: Record<string, any>) => {
|
|
15
|
-
category:
|
|
15
|
+
category: "user_actions";
|
|
16
16
|
data: {
|
|
17
17
|
type: string | undefined;
|
|
18
18
|
user_id: any;
|
|
@@ -21,7 +21,7 @@ export declare const createEvent: (category: (typeof categories)[keyof typeof ca
|
|
|
21
21
|
name?: undefined;
|
|
22
22
|
};
|
|
23
23
|
} | {
|
|
24
|
-
category:
|
|
24
|
+
category: "events";
|
|
25
25
|
data: {
|
|
26
26
|
name: any;
|
|
27
27
|
payload: any;
|
|
@@ -2,5 +2,12 @@ import type App from '../app/index.js';
|
|
|
2
2
|
export interface Options {
|
|
3
3
|
urlSanitizer?: (url: string) => string;
|
|
4
4
|
titleSanitizer?: (title: string) => string;
|
|
5
|
+
/** if present, tracker will remove given symbol to present url as regular router url on replay level;
|
|
6
|
+
*
|
|
7
|
+
* applied BEFORE sanitizers.
|
|
8
|
+
*
|
|
9
|
+
* @example passing '#/' will result in 'site.com/#/path' -> 'site.com/path'
|
|
10
|
+
*/
|
|
11
|
+
replaceHashSymbol?: string;
|
|
5
12
|
}
|
|
6
13
|
export default function (app: App, options?: Options): void;
|
package/dist/lib/entry.js
CHANGED
|
@@ -4398,7 +4398,7 @@ class App {
|
|
|
4398
4398
|
this.stopCallbacks = [];
|
|
4399
4399
|
this.commitCallbacks = [];
|
|
4400
4400
|
this.activityState = ActivityState.NotActive;
|
|
4401
|
-
this.version = '17.1.
|
|
4401
|
+
this.version = '17.1.2'; // TODO: version compatability check inside each plugin.
|
|
4402
4402
|
this.socketMode = false;
|
|
4403
4403
|
this.compressionThreshold = 24 * 1000;
|
|
4404
4404
|
this.bc = null;
|
|
@@ -5505,6 +5505,7 @@ class App {
|
|
|
5505
5505
|
assistOnly: startOpts.assistOnly ?? this.socketMode,
|
|
5506
5506
|
width: window.screen.width,
|
|
5507
5507
|
height: window.screen.height,
|
|
5508
|
+
referrer: document.referrer,
|
|
5508
5509
|
}),
|
|
5509
5510
|
});
|
|
5510
5511
|
if (r.status !== 200) {
|
|
@@ -7001,11 +7002,21 @@ function Viewport (app, options) {
|
|
|
7001
7002
|
const urlSanitizer = options?.urlSanitizer || ((u) => u);
|
|
7002
7003
|
const titleSanitizer = options?.titleSanitizer || ((t) => t);
|
|
7003
7004
|
const sendSetPageLocation = app.safe(() => {
|
|
7004
|
-
const
|
|
7005
|
-
if (
|
|
7006
|
-
url =
|
|
7005
|
+
const currURL = document.URL;
|
|
7006
|
+
if (currURL !== url) {
|
|
7007
|
+
url = currURL;
|
|
7008
|
+
if (options?.replaceHashSymbol) {
|
|
7009
|
+
// replace hash router symbol if needed without affecting pathname of the url
|
|
7010
|
+
const u = new URL(currURL);
|
|
7011
|
+
const hashRoute = u.hash.startsWith("#/") ? u.hash.slice(2) : "";
|
|
7012
|
+
const routePath = hashRoute ? "/" + hashRoute.replace(/^\/+/, "") : "";
|
|
7013
|
+
const cleaned = u.origin + u.pathname.replace(/\/$/, "") + routePath + u.search;
|
|
7014
|
+
url = cleaned;
|
|
7015
|
+
}
|
|
7007
7016
|
const sanitized = urlSanitizer(url);
|
|
7008
|
-
const safeTitle = app.sanitizer.privateMode
|
|
7017
|
+
const safeTitle = app.sanitizer.privateMode
|
|
7018
|
+
? stringWiper(document.title)
|
|
7019
|
+
: titleSanitizer(document.title);
|
|
7009
7020
|
const safeUrl = app.sanitizer.privateMode ? stringWiper(sanitized) : sanitized;
|
|
7010
7021
|
const safeReferrer = app.sanitizer.privateMode ? stringWiper(referrer) : referrer;
|
|
7011
7022
|
app.send(SetPageLocation(safeUrl, safeReferrer, navigationStart, safeTitle));
|
|
@@ -9217,7 +9228,7 @@ class ConstantProperties {
|
|
|
9217
9228
|
user_id: this.user_id,
|
|
9218
9229
|
distinct_id: this.deviceId,
|
|
9219
9230
|
sdk_edition: 'web',
|
|
9220
|
-
sdk_version: '17.1.
|
|
9231
|
+
sdk_version: '17.1.2',
|
|
9221
9232
|
timezone: getUTCOffsetString(),
|
|
9222
9233
|
search_engine: this.searchEngine,
|
|
9223
9234
|
};
|
|
@@ -9861,7 +9872,7 @@ class API {
|
|
|
9861
9872
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9862
9873
|
const doNotTrack = this.checkDoNotTrack();
|
|
9863
9874
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9864
|
-
trackerVersion: '17.1.
|
|
9875
|
+
trackerVersion: '17.1.2',
|
|
9865
9876
|
projectKey: this.options.projectKey,
|
|
9866
9877
|
doNotTrack,
|
|
9867
9878
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|