@openreplay/tracker 4.1.10 → 4.1.11
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/.eslintignore +0 -3
- package/README.md +18 -22
- package/cjs/app/guards.d.ts +12 -11
- package/cjs/app/guards.js +1 -2
- package/cjs/app/index.d.ts +8 -11
- package/cjs/app/index.js +8 -27
- package/cjs/app/logger.d.ts +3 -3
- package/cjs/app/messages.d.ts +52 -0
- package/cjs/app/messages.gen.d.ts +6 -8
- package/cjs/app/messages.gen.js +94 -116
- package/cjs/app/messages.js +234 -0
- package/cjs/app/nodes.d.ts +1 -1
- package/cjs/app/observer/iframe_offsets.d.ts +1 -1
- package/cjs/app/observer/observer.js +5 -5
- package/cjs/app/observer/top_observer.d.ts +2 -2
- package/cjs/app/observer/top_observer.js +1 -1
- package/cjs/app/session.d.ts +2 -2
- package/cjs/app/ticker.d.ts +1 -1
- package/cjs/common/interaction.d.ts +5 -5
- package/cjs/common/messages.gen.d.ts +86 -104
- package/cjs/index.d.ts +2 -6
- package/cjs/index.js +5 -7
- package/cjs/modules/cssrules.js +1 -1
- package/cjs/modules/focus.js +2 -2
- package/cjs/modules/fonts.js +2 -2
- package/cjs/modules/img.js +5 -6
- package/cjs/modules/input.d.ts +1 -1
- package/cjs/modules/input.js +23 -15
- package/cjs/modules/mouse.js +1 -1
- package/cjs/modules/timing.js +3 -7
- package/cjs/modules/viewport.js +1 -3
- package/cjs/vendors/finder/finder.d.ts +1 -1
- package/lib/app/guards.d.ts +12 -11
- package/lib/app/guards.js +1 -2
- package/lib/app/index.d.ts +8 -11
- package/lib/app/index.js +9 -28
- package/lib/app/logger.d.ts +3 -3
- package/lib/app/messages.d.ts +52 -0
- package/lib/app/messages.gen.d.ts +6 -8
- package/lib/app/messages.gen.js +87 -107
- package/lib/app/messages.js +181 -0
- package/lib/app/nodes.d.ts +1 -1
- package/lib/app/observer/iframe_offsets.d.ts +1 -1
- package/lib/app/observer/observer.js +5 -5
- package/lib/app/observer/top_observer.d.ts +2 -2
- package/lib/app/observer/top_observer.js +1 -1
- package/lib/app/session.d.ts +2 -2
- package/lib/app/ticker.d.ts +1 -1
- package/lib/common/interaction.d.ts +5 -5
- package/lib/common/messages.gen.d.ts +86 -104
- package/lib/common/tsconfig.tsbuildinfo +1 -1
- package/lib/index.d.ts +2 -6
- package/lib/index.js +6 -8
- package/lib/modules/cssrules.js +1 -1
- package/lib/modules/focus.js +2 -2
- package/lib/modules/fonts.js +2 -2
- package/lib/modules/img.js +5 -6
- package/lib/modules/input.d.ts +1 -1
- package/lib/modules/input.js +23 -15
- package/lib/modules/mouse.js +1 -1
- package/lib/modules/timing.js +4 -8
- package/lib/modules/viewport.js +1 -3
- package/lib/vendors/finder/finder.d.ts +1 -1
- package/package.json +3 -8
- package/tsconfig-base.json +1 -2
- package/CHANGELOG.md +0 -19
- package/cjs/modules/network.d.ts +0 -28
- package/cjs/modules/network.js +0 -203
- package/jest.config.js +0 -11
- package/lib/modules/network.d.ts +0 -28
- package/lib/modules/network.js +0 -200
package/.eslintignore
CHANGED
package/README.md
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
The main package of the [OpenReplay](https://openreplay.com/) tracker.
|
|
4
4
|
|
|
5
|
-
## Documentation
|
|
6
|
-
|
|
7
|
-
For launch options and available public methods, [refer to the documentation](https://docs.openreplay.com/installation/javascript-sdk#options)
|
|
8
|
-
|
|
9
5
|
## Installation
|
|
10
6
|
|
|
11
7
|
```bash
|
|
12
|
-
npm i @openreplay/tracker
|
|
8
|
+
npm i @openreplay/tracker
|
|
13
9
|
```
|
|
14
10
|
|
|
15
11
|
## Usage
|
|
@@ -17,30 +13,30 @@ npm i @openreplay/tracker
|
|
|
17
13
|
Initialize the package from your codebase entry point and start the tracker. You must set the `projectKey` option in the constructor. Its value can can be found in your OpenReplay dashboard under [Preferences -> Projects](https://app.openreplay.com/client/projects).
|
|
18
14
|
|
|
19
15
|
```js
|
|
20
|
-
import Tracker from '@openreplay/tracker'
|
|
16
|
+
import Tracker from '@openreplay/tracker';
|
|
21
17
|
|
|
22
18
|
const tracker = new Tracker({
|
|
23
19
|
projectKey: YOUR_PROJECT_KEY,
|
|
20
|
+
});
|
|
21
|
+
tracker.start({
|
|
22
|
+
userID: "Mr.Smith",
|
|
23
|
+
metadata: {
|
|
24
|
+
version: "3.5.0",
|
|
25
|
+
balance: "10M",
|
|
26
|
+
role: "admin",
|
|
27
|
+
}
|
|
28
|
+
}).then(startedSession => {
|
|
29
|
+
if (startedSession.success) {
|
|
30
|
+
console.log(startedSession)
|
|
31
|
+
}
|
|
24
32
|
})
|
|
25
|
-
tracker
|
|
26
|
-
.start({
|
|
27
|
-
userID: 'Mr.Smith',
|
|
28
|
-
metadata: {
|
|
29
|
-
version: '3.5.0',
|
|
30
|
-
balance: '10M',
|
|
31
|
-
role: 'admin',
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
.then((startedSession) => {
|
|
35
|
-
if (startedSession.success) {
|
|
36
|
-
console.log(startedSession)
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
33
|
```
|
|
40
34
|
|
|
41
35
|
Then you can use OpenReplay JavaScript API anywhere in your code.
|
|
42
36
|
|
|
43
37
|
```js
|
|
44
|
-
tracker.setUserID('my_user_id')
|
|
45
|
-
tracker.setMetadata('env', 'prod')
|
|
38
|
+
tracker.setUserID('my_user_id');
|
|
39
|
+
tracker.setMetadata('env', 'prod');
|
|
46
40
|
```
|
|
41
|
+
|
|
42
|
+
Read [our docs](https://docs.openreplay.com/) for more information.
|
package/cjs/app/guards.d.ts
CHANGED
|
@@ -4,17 +4,18 @@ export declare function isElementNode(node: Node): node is Element;
|
|
|
4
4
|
export declare function isTextNode(node: Node): node is Text;
|
|
5
5
|
export declare function isDocument(node: Node): node is Document;
|
|
6
6
|
export declare function isRootNode(node: Node): node is Document | DocumentFragment;
|
|
7
|
-
type TagTypeMap = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
declare type TagTypeMap = {
|
|
8
|
+
HTML: HTMLHtmlElement;
|
|
9
|
+
BODY: HTMLBodyElement;
|
|
10
|
+
IMG: HTMLImageElement;
|
|
11
|
+
INPUT: HTMLInputElement;
|
|
12
|
+
TEXTAREA: HTMLTextAreaElement;
|
|
13
|
+
SELECT: HTMLSelectElement;
|
|
14
|
+
LABEL: HTMLLabelElement;
|
|
15
|
+
IFRAME: HTMLIFrameElement;
|
|
16
|
+
STYLE: HTMLStyleElement;
|
|
17
|
+
style: SVGStyleElement;
|
|
18
|
+
LINK: HTMLLinkElement;
|
|
18
19
|
};
|
|
19
20
|
export declare function hasTag<T extends keyof TagTypeMap>(el: Node, tagName: T): el is TagTypeMap[typeof tagName];
|
|
20
21
|
export {};
|
package/cjs/app/guards.js
CHANGED
package/cjs/app/index.d.ts
CHANGED
|
@@ -22,19 +22,19 @@ interface OnStartInfo {
|
|
|
22
22
|
userUUID: string;
|
|
23
23
|
}
|
|
24
24
|
declare const CANCELED: "canceled";
|
|
25
|
-
type SuccessfulStart = OnStartInfo & {
|
|
25
|
+
declare type SuccessfulStart = OnStartInfo & {
|
|
26
26
|
success: true;
|
|
27
27
|
};
|
|
28
|
-
type UnsuccessfulStart = {
|
|
28
|
+
declare type UnsuccessfulStart = {
|
|
29
29
|
reason: typeof CANCELED | string;
|
|
30
30
|
success: false;
|
|
31
31
|
};
|
|
32
32
|
declare const UnsuccessfulStart: (reason: string) => UnsuccessfulStart;
|
|
33
33
|
declare const SuccessfulStart: (body: OnStartInfo) => SuccessfulStart;
|
|
34
|
-
export type StartPromiseReturn = SuccessfulStart | UnsuccessfulStart;
|
|
35
|
-
type StartCallback = (i: OnStartInfo) => void;
|
|
36
|
-
type CommitCallback = (messages: Array<Message>) => void;
|
|
37
|
-
type AppOptions = {
|
|
34
|
+
export declare type StartPromiseReturn = SuccessfulStart | UnsuccessfulStart;
|
|
35
|
+
declare type StartCallback = (i: OnStartInfo) => void;
|
|
36
|
+
declare type CommitCallback = (messages: Array<Message>) => void;
|
|
37
|
+
declare type AppOptions = {
|
|
38
38
|
revID: string;
|
|
39
39
|
node_id: string;
|
|
40
40
|
session_reset_key: string;
|
|
@@ -51,7 +51,7 @@ type AppOptions = {
|
|
|
51
51
|
sessionStorage: Storage | null;
|
|
52
52
|
onStart?: StartCallback;
|
|
53
53
|
} & WebworkerOptions & SessOptions;
|
|
54
|
-
export type Options = AppOptions & ObserverOptions & SanitizerOptions;
|
|
54
|
+
export declare type Options = AppOptions & ObserverOptions & SanitizerOptions;
|
|
55
55
|
export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";
|
|
56
56
|
export default class App {
|
|
57
57
|
readonly nodes: Nodes;
|
|
@@ -75,7 +75,6 @@ export default class App {
|
|
|
75
75
|
private readonly worker?;
|
|
76
76
|
constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>);
|
|
77
77
|
private _debug;
|
|
78
|
-
private _usingOldFetchPlugin;
|
|
79
78
|
send(message: Message, urgent?: boolean): void;
|
|
80
79
|
private commit;
|
|
81
80
|
private delay;
|
|
@@ -101,9 +100,7 @@ export default class App {
|
|
|
101
100
|
};
|
|
102
101
|
getSessionToken(): string | undefined;
|
|
103
102
|
getSessionID(): string | undefined;
|
|
104
|
-
getSessionURL(
|
|
105
|
-
withCurrentTime?: boolean;
|
|
106
|
-
}): string | undefined;
|
|
103
|
+
getSessionURL(): string | undefined;
|
|
107
104
|
getHost(): string;
|
|
108
105
|
getProjectKey(): string;
|
|
109
106
|
getBaseHref(): string;
|
package/cjs/app/index.js
CHANGED
|
@@ -33,8 +33,7 @@ class App {
|
|
|
33
33
|
this.stopCallbacks = [];
|
|
34
34
|
this.commitCallbacks = [];
|
|
35
35
|
this.activityState = ActivityState.NotActive;
|
|
36
|
-
this.version = '4.1.
|
|
37
|
-
this._usingOldFetchPlugin = false;
|
|
36
|
+
this.version = '4.1.11'; // TODO: version compatability check inside each plugin.
|
|
38
37
|
this.delay = 0;
|
|
39
38
|
this.projectKey = projectKey;
|
|
40
39
|
this.options = Object.assign({
|
|
@@ -77,7 +76,7 @@ class App {
|
|
|
77
76
|
this.session.applySessionHash(sessionToken);
|
|
78
77
|
}
|
|
79
78
|
try {
|
|
80
|
-
this.worker = new Worker(URL.createObjectURL(new Blob(['"use strict";class t{constructor(t,i,s,e=10,n=1e3){this.onUnauthorised=i,this.onFailure=s,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.ingestURL=t+"/v1/web/i"}authorise(t){this.token=t
|
|
79
|
+
this.worker = new Worker(URL.createObjectURL(new Blob(['"use strict";class t{constructor(t,i,s,e=10,n=1e3){this.onUnauthorised=i,this.onFailure=s,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.ingestURL=t+"/v1/web/i"}authorise(t){this.token=t}push(t){this.busy||!this.token?this.queue.push(t):this.sendBatch(t)}retry(t){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout(()=>this.sendBatch(t),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t){this.busy=!0,fetch(this.ingestURL,{body:t,method:"POST",headers:{Authorization:"Bearer "+this.token},keepalive:t.length<65536}).then(i=>{if(401===i.status)return this.busy=!1,void this.onUnauthorised();if(i.status>=400)return void this.retry(t);this.attemptsCount=0;const s=this.queue.shift();s?this.sendBatch(s):this.busy=!1}).catch(i=>{console.warn("OpenReplay:",i),this.retry(t)})}clean(){this.queue.length=0}}const i="function"==typeof TextEncoder?new TextEncoder:{encode(t){const i=t.length,s=new Uint8Array(3*i);let e=-1;for(let n=0,r=0,h=0;h!==i;){if(n=t.charCodeAt(h),h+=1,n>=55296&&n<=56319){if(h===i){s[e+=1]=239,s[e+=1]=191,s[e+=1]=189;break}if(r=t.charCodeAt(h),!(r>=56320&&r<=57343)){s[e+=1]=239,s[e+=1]=191,s[e+=1]=189;continue}if(n=1024*(n-55296)+r-56320+65536,h+=1,n>65535){s[e+=1]=240|n>>>18,s[e+=1]=128|n>>>12&63,s[e+=1]=128|n>>>6&63,s[e+=1]=128|63&n;continue}}n<=127?s[e+=1]=0|n:n<=2047?(s[e+=1]=192|n>>>6,s[e+=1]=128|63&n):(s[e+=1]=224|n>>>12,s[e+=1]=128|n>>>6&63,s[e+=1]=128|63&n)}return s.subarray(0,e+1)}};class s extends class{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}checkpoint(){this.checkpointOffset=this.offset}isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,i){this.data.set(t,i)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const s=i.encode(t),e=s.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(s,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}{encode(t){switch(t[0]){case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 82:return this.uint(t[1])&&this.uint(t[2]);case 0:return this.uint(t[1]);case 4:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 11:return this.uint(t[1]);case 12:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 17:return this.uint(t[1])&&this.string(t[2]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 20:return this.uint(t[1])&&this.uint(t[2]);case 22:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 24:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 25:return this.string(t[1])&&this.string(t[2])&&this.string(t[3]);case 27:return this.string(t[1])&&this.string(t[2]);case 28:case 29:return this.string(t[1]);case 30:return this.string(t[1])&&this.string(t[2]);case 37:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3]);case 38:return this.uint(t[1])&&this.uint(t[2]);case 39:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 41:return this.string(t[1])&&this.string(t[2]);case 42:return this.string(t[1]);case 44:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 45:case 46:return this.string(t[1])&&this.string(t[2]);case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 54:return this.uint(t[1])&&this.string(t[2]);case 55:return this.boolean(t[1]);case 57:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:return this.int(t[1]);case 59:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6])&&this.string(t[7]);case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 61:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 63:case 64:return this.string(t[1])&&this.string(t[2]);case 67:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 70:return this.uint(t[1])&&this.uint(t[2]);case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 75:case 76:case 77:return this.uint(t[1])&&this.uint(t[2]);case 79:return this.string(t[1])&&this.string(t[2]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])}}}class e{constructor(t,i,e,n){this.pageNo=t,this.timestamp=i,this.url=e,this.onBatch=n,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new s(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,i){for(let i=0;i<3;i++)this.sizeBuffer[i]=t>>8*i;this.encoder.set(this.sizeBuffer,i)}prepare(){if(!this.encoder.isEmpty())return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url];this.writeType(t),this.writeFields(t),this.isEmpty=!0}writeWithSize(t){const i=this.encoder;if(!this.writeType(t)||!i.skip(3))return!1;const s=i.getCurrentOffset(),e=this.writeFields(t);if(e){const e=i.getCurrentOffset()-s;if(e>16777215)return console.warn("OpenReplay: max message size overflow."),!1;this.writeSizeAt(e,s-3),i.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(0===t[0]&&(this.timestamp=t[1]),4===t[0]&&(this.url=t[1]),!this.writeWithSize(t))for(this.finaliseBatch();!this.writeWithSize(t);){if(this.beaconSize===this.beaconSizeLimit)return console.warn("OpenReplay: beacon size overflow. Skipping large message.",t,this),this.encoder.reset(),void this.prepare();this.beaconSize=Math.min(2*this.beaconSize,this.beaconSizeLimit),this.encoder=new s(this.beaconSize),this.prepare()}}finaliseBatch(){this.isEmpty||(this.onBatch(this.encoder.flush()),this.prepare())}clean(){this.encoder.reset()}}var n;!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active"}(n||(n={}));let r=null,h=null;function u(){h&&h.finaliseBatch()}function a(){n.Stopping,null!==g&&(clearInterval(g),g=null),h&&(h.clean(),h=null),r&&(r.clean(),r=null),n.NotActive}function o(){postMessage("restart"),a()}n.NotActive;let c,g=null;self.onmessage=({data:i})=>{if(null!=i){if("stop"===i)return u(),void a();if(Array.isArray(i)){if(!h)throw new Error("WebWorker: writer not initialised. Service Should be Started.");const t=h;i.forEach(i=>{55===i[0]&&(i[1]?c=setTimeout(()=>o(),18e5):clearTimeout(c)),t.writeMessage(i)})}else{if("start"===i.type)return n.Starting,r=new t(i.ingestPoint,()=>{o()},t=>{!function(t){postMessage({type:"failure",reason:t}),a()}(t)},i.connAttemptCount,i.connAttemptGap),h=new e(i.pageNo,i.timestamp,i.url,t=>r&&r.push(t)),null===g&&(g=setInterval(u,1e4)),n.Active;if("auth"===i.type){if(!r)throw new Error("WebWorker: sender not initialised. Received auth.");if(!h)throw new Error("WebWorker: writer not initialised. Received auth.");return r.authorise(i.token),void(i.beaconSizeLimit&&h.setBeaconSizeLimit(i.beaconSizeLimit))}}}else u()};'], { type: 'text/javascript' })));
|
|
81
80
|
this.worker.onerror = (e) => {
|
|
82
81
|
this._debug('webworker_error', e);
|
|
83
82
|
};
|
|
@@ -86,9 +85,6 @@ class App {
|
|
|
86
85
|
this.stop(false);
|
|
87
86
|
this.start({}, true);
|
|
88
87
|
}
|
|
89
|
-
else if (data === 'not_init') {
|
|
90
|
-
console.warn('WebWorker: writer not initialised. Restarting tracker');
|
|
91
|
-
}
|
|
92
88
|
else if (data.type === 'failure') {
|
|
93
89
|
this.stop(false);
|
|
94
90
|
this._debug('worker_failed', data.reason);
|
|
@@ -126,16 +122,6 @@ class App {
|
|
|
126
122
|
if (this.activityState === ActivityState.NotActive) {
|
|
127
123
|
return;
|
|
128
124
|
}
|
|
129
|
-
// === Back compatibility with Fetch/Axios plugins ===
|
|
130
|
-
if (message[0] === 39 /* MType.Fetch */) {
|
|
131
|
-
this._usingOldFetchPlugin = true;
|
|
132
|
-
(0, utils_js_1.deprecationWarn)('Fetch plugin', "'network' init option", '/installation/network-options');
|
|
133
|
-
(0, utils_js_1.deprecationWarn)('Axios plugin', "'network' init option", '/installation/network-options');
|
|
134
|
-
}
|
|
135
|
-
if (this._usingOldFetchPlugin && message[0] === 21 /* MType.NetworkRequest */) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
// ====================================================
|
|
139
125
|
this.messages.push(message);
|
|
140
126
|
// TODO: commit on start if there were `urgent` sends;
|
|
141
127
|
// Clarify where urgent can be used for;
|
|
@@ -230,21 +216,16 @@ class App {
|
|
|
230
216
|
getSessionID() {
|
|
231
217
|
return this.session.getInfo().sessionID || undefined;
|
|
232
218
|
}
|
|
233
|
-
getSessionURL(
|
|
234
|
-
const { projectID, sessionID
|
|
219
|
+
getSessionURL() {
|
|
220
|
+
const { projectID, sessionID } = this.session.getInfo();
|
|
235
221
|
if (!projectID || !sessionID) {
|
|
236
222
|
this.debug.error('OpenReplay error: Unable to build session URL');
|
|
237
223
|
return undefined;
|
|
238
224
|
}
|
|
239
225
|
const ingest = this.options.ingestPoint;
|
|
240
|
-
const isSaas =
|
|
241
|
-
const projectPath = isSaas ?
|
|
242
|
-
|
|
243
|
-
if (options === null || options === void 0 ? void 0 : options.withCurrentTime) {
|
|
244
|
-
const jumpTo = (0, utils_js_1.now)() - timestamp;
|
|
245
|
-
return `${url}?jumpto=${jumpTo}`;
|
|
246
|
-
}
|
|
247
|
-
return url;
|
|
226
|
+
const isSaas = ingest === exports.DEFAULT_INGEST_POINT;
|
|
227
|
+
const projectPath = isSaas ? ingest.replace('api', 'app') : ingest;
|
|
228
|
+
return projectPath.replace(/ingest$/, `${projectID}/session/${sessionID}`);
|
|
248
229
|
}
|
|
249
230
|
getHost() {
|
|
250
231
|
return new URL(this.options.ingestPoint).host;
|
|
@@ -347,7 +328,7 @@ class App {
|
|
|
347
328
|
return Promise.reject('no worker found after start request (this might not happen)');
|
|
348
329
|
}
|
|
349
330
|
if (this.activityState === ActivityState.NotActive) {
|
|
350
|
-
return Promise.reject('Tracker stopped during
|
|
331
|
+
return Promise.reject('Tracker stopped during authorisation');
|
|
351
332
|
}
|
|
352
333
|
const { token, userUUID, projectID, beaconSizeLimit, delay, // derived from token
|
|
353
334
|
sessionID, // derived from token
|
package/cjs/app/logger.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export declare const LogLevel: {
|
|
|
5
5
|
readonly Errors: 2;
|
|
6
6
|
readonly Silent: 0;
|
|
7
7
|
};
|
|
8
|
-
type LogLevel = typeof LogLevel[keyof typeof LogLevel];
|
|
9
|
-
type CustomLevel = {
|
|
8
|
+
declare type LogLevel = typeof LogLevel[keyof typeof LogLevel];
|
|
9
|
+
declare type CustomLevel = {
|
|
10
10
|
error: boolean;
|
|
11
11
|
warn: boolean;
|
|
12
12
|
log: boolean;
|
|
@@ -15,7 +15,7 @@ interface _Options {
|
|
|
15
15
|
level: LogLevel | CustomLevel;
|
|
16
16
|
messages?: number[];
|
|
17
17
|
}
|
|
18
|
-
export type Options = true | _Options | LogLevel;
|
|
18
|
+
export declare type Options = true | _Options | LogLevel;
|
|
19
19
|
export default class Logger {
|
|
20
20
|
private readonly options;
|
|
21
21
|
constructor(options?: Options);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as Messages from '../common/messages.gen.js';
|
|
2
|
+
export { default } from '../common/messages.gen.js';
|
|
3
|
+
export declare function BatchMetadata(version: number, pageNo: number, firstIndex: number, timestamp: number, location: string): Messages.BatchMetadata;
|
|
4
|
+
export declare function PartitionedMessage(partNo: number, partTotal: number): Messages.PartitionedMessage;
|
|
5
|
+
export declare function Timestamp(timestamp: number): Messages.Timestamp;
|
|
6
|
+
export declare function SetPageLocation(url: string, referrer: string, navigationStart: number): Messages.SetPageLocation;
|
|
7
|
+
export declare function SetViewportSize(width: number, height: number): Messages.SetViewportSize;
|
|
8
|
+
export declare function SetViewportScroll(x: number, y: number): Messages.SetViewportScroll;
|
|
9
|
+
export declare function CreateDocument(): Messages.CreateDocument;
|
|
10
|
+
export declare function CreateElementNode(id: number, parentID: number, index: number, tag: string, svg: boolean): Messages.CreateElementNode;
|
|
11
|
+
export declare function CreateTextNode(id: number, parentID: number, index: number): Messages.CreateTextNode;
|
|
12
|
+
export declare function MoveNode(id: number, parentID: number, index: number): Messages.MoveNode;
|
|
13
|
+
export declare function RemoveNode(id: number): Messages.RemoveNode;
|
|
14
|
+
export declare function SetNodeAttribute(id: number, name: string, value: string): Messages.SetNodeAttribute;
|
|
15
|
+
export declare function RemoveNodeAttribute(id: number, name: string): Messages.RemoveNodeAttribute;
|
|
16
|
+
export declare function SetNodeData(id: number, data: string): Messages.SetNodeData;
|
|
17
|
+
export declare function SetNodeScroll(id: number, x: number, y: number): Messages.SetNodeScroll;
|
|
18
|
+
export declare function SetInputTarget(id: number, label: string): Messages.SetInputTarget;
|
|
19
|
+
export declare function SetInputValue(id: number, value: string, mask: number): Messages.SetInputValue;
|
|
20
|
+
export declare function SetInputChecked(id: number, checked: boolean): Messages.SetInputChecked;
|
|
21
|
+
export declare function MouseMove(x: number, y: number): Messages.MouseMove;
|
|
22
|
+
export declare function ConsoleLog(level: string, value: string): Messages.ConsoleLog;
|
|
23
|
+
export declare function PageLoadTiming(requestStart: number, responseStart: number, responseEnd: number, domContentLoadedEventStart: number, domContentLoadedEventEnd: number, loadEventStart: number, loadEventEnd: number, firstPaint: number, firstContentfulPaint: number): Messages.PageLoadTiming;
|
|
24
|
+
export declare function PageRenderTiming(speedIndex: number, visuallyComplete: number, timeToInteractive: number): Messages.PageRenderTiming;
|
|
25
|
+
export declare function JSException(name: string, message: string, payload: string, metadata: string): Messages.JSException;
|
|
26
|
+
export declare function RawCustomEvent(name: string, payload: string): Messages.RawCustomEvent;
|
|
27
|
+
export declare function UserID(id: string): Messages.UserID;
|
|
28
|
+
export declare function UserAnonymousID(id: string): Messages.UserAnonymousID;
|
|
29
|
+
export declare function Metadata(key: string, value: string): Messages.Metadata;
|
|
30
|
+
export declare function CSSInsertRule(id: number, rule: string, index: number): Messages.CSSInsertRule;
|
|
31
|
+
export declare function CSSDeleteRule(id: number, index: number): Messages.CSSDeleteRule;
|
|
32
|
+
export declare function Fetch(method: string, url: string, request: string, response: string, status: number, timestamp: number, duration: number): Messages.Fetch;
|
|
33
|
+
export declare function Profiler(name: string, duration: number, args: string, result: string): Messages.Profiler;
|
|
34
|
+
export declare function OTable(key: string, value: string): Messages.OTable;
|
|
35
|
+
export declare function StateAction(type: string): Messages.StateAction;
|
|
36
|
+
export declare function Redux(action: string, state: string, duration: number): Messages.Redux;
|
|
37
|
+
export declare function Vuex(mutation: string, state: string): Messages.Vuex;
|
|
38
|
+
export declare function MobX(type: string, payload: string): Messages.MobX;
|
|
39
|
+
export declare function NgRx(action: string, state: string, duration: number): Messages.NgRx;
|
|
40
|
+
export declare function GraphQL(operationKind: string, operationName: string, variables: string, response: string): Messages.GraphQL;
|
|
41
|
+
export declare function PerformanceTrack(frames: number, ticks: number, totalJSHeapSize: number, usedJSHeapSize: number): Messages.PerformanceTrack;
|
|
42
|
+
export declare function ResourceTiming(timestamp: number, duration: number, ttfb: number, headerSize: number, encodedBodySize: number, decodedBodySize: number, url: string, initiator: string): Messages.ResourceTiming;
|
|
43
|
+
export declare function ConnectionInformation(downlink: number, type: string): Messages.ConnectionInformation;
|
|
44
|
+
export declare function SetPageVisibility(hidden: boolean): Messages.SetPageVisibility;
|
|
45
|
+
export declare function LongTask(timestamp: number, duration: number, context: number, containerType: number, containerSrc: string, containerId: string, containerName: string): Messages.LongTask;
|
|
46
|
+
export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
|
|
47
|
+
export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
|
|
48
|
+
export declare function TechnicalInfo(type: string, value: string): Messages.TechnicalInfo;
|
|
49
|
+
export declare function CustomIssue(name: string, payload: string): Messages.CustomIssue;
|
|
50
|
+
export declare function CSSInsertRuleURLBased(id: number, rule: string, index: number, baseURL: string): Messages.CSSInsertRuleURLBased;
|
|
51
|
+
export declare function MouseClick(id: number, hesitationTime: number, label: string, selector: string): Messages.MouseClick;
|
|
52
|
+
export declare function CreateIFrameDocument(frameID: number, id: number): Messages.CreateIFrameDocument;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as Messages from '../common/messages.gen.js';
|
|
2
|
-
export { default
|
|
2
|
+
export { default } from '../common/messages.gen.js';
|
|
3
|
+
export declare function BatchMetadata(version: number, pageNo: number, firstIndex: number, timestamp: number, location: string): Messages.BatchMetadata;
|
|
4
|
+
export declare function PartitionedMessage(partNo: number, partTotal: number): Messages.PartitionedMessage;
|
|
3
5
|
export declare function Timestamp(timestamp: number): Messages.Timestamp;
|
|
4
6
|
export declare function SetPageLocation(url: string, referrer: string, navigationStart: number): Messages.SetPageLocation;
|
|
5
7
|
export declare function SetViewportSize(width: number, height: number): Messages.SetViewportSize;
|
|
@@ -17,11 +19,11 @@ export declare function SetInputTarget(id: number, label: string): Messages.SetI
|
|
|
17
19
|
export declare function SetInputValue(id: number, value: string, mask: number): Messages.SetInputValue;
|
|
18
20
|
export declare function SetInputChecked(id: number, checked: boolean): Messages.SetInputChecked;
|
|
19
21
|
export declare function MouseMove(x: number, y: number): Messages.MouseMove;
|
|
20
|
-
export declare function NetworkRequest(type: string, method: string, url: string, request: string, response: string, status: number, timestamp: number, duration: number): Messages.NetworkRequest;
|
|
21
22
|
export declare function ConsoleLog(level: string, value: string): Messages.ConsoleLog;
|
|
22
23
|
export declare function PageLoadTiming(requestStart: number, responseStart: number, responseEnd: number, domContentLoadedEventStart: number, domContentLoadedEventEnd: number, loadEventStart: number, loadEventEnd: number, firstPaint: number, firstContentfulPaint: number): Messages.PageLoadTiming;
|
|
23
24
|
export declare function PageRenderTiming(speedIndex: number, visuallyComplete: number, timeToInteractive: number): Messages.PageRenderTiming;
|
|
24
|
-
export declare function
|
|
25
|
+
export declare function JSExceptionDeprecated(name: string, message: string, payload: string): Messages.JSExceptionDeprecated;
|
|
26
|
+
export declare function RawCustomEvent(name: string, payload: string): Messages.RawCustomEvent;
|
|
25
27
|
export declare function UserID(id: string): Messages.UserID;
|
|
26
28
|
export declare function UserAnonymousID(id: string): Messages.UserAnonymousID;
|
|
27
29
|
export declare function Metadata(key: string, value: string): Messages.Metadata;
|
|
@@ -37,8 +39,6 @@ export declare function MobX(type: string, payload: string): Messages.MobX;
|
|
|
37
39
|
export declare function NgRx(action: string, state: string, duration: number): Messages.NgRx;
|
|
38
40
|
export declare function GraphQL(operationKind: string, operationName: string, variables: string, response: string): Messages.GraphQL;
|
|
39
41
|
export declare function PerformanceTrack(frames: number, ticks: number, totalJSHeapSize: number, usedJSHeapSize: number): Messages.PerformanceTrack;
|
|
40
|
-
export declare function StringDict(key: number, value: string): Messages.StringDict;
|
|
41
|
-
export declare function SetNodeAttributeDict(id: number, nameKey: number, valueKey: number): Messages.SetNodeAttributeDict;
|
|
42
42
|
export declare function ResourceTiming(timestamp: number, duration: number, ttfb: number, headerSize: number, encodedBodySize: number, decodedBodySize: number, url: string, initiator: string): Messages.ResourceTiming;
|
|
43
43
|
export declare function ConnectionInformation(downlink: number, type: string): Messages.ConnectionInformation;
|
|
44
44
|
export declare function SetPageVisibility(hidden: boolean): Messages.SetPageVisibility;
|
|
@@ -57,7 +57,5 @@ export declare function AdoptedSSInsertRuleURLBased(sheetID: number, rule: strin
|
|
|
57
57
|
export declare function AdoptedSSDeleteRule(sheetID: number, index: number): Messages.AdoptedSSDeleteRule;
|
|
58
58
|
export declare function AdoptedSSAddOwner(sheetID: number, id: number): Messages.AdoptedSSAddOwner;
|
|
59
59
|
export declare function AdoptedSSRemoveOwner(sheetID: number, id: number): Messages.AdoptedSSRemoveOwner;
|
|
60
|
-
export declare function JSException(name: string, message: string, payload: string, metadata: string): Messages.JSException;
|
|
61
60
|
export declare function Zustand(mutation: string, state: string): Messages.Zustand;
|
|
62
|
-
export declare function
|
|
63
|
-
export declare function PartitionedMessage(partNo: number, partTotal: number): Messages.PartitionedMessage;
|
|
61
|
+
export declare function JSException(name: string, message: string, payload: string, metadata: string): Messages.JSException;
|