@openreplay/tracker 4.1.7-beta.1 → 4.1.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.
@@ -6,6 +6,7 @@ export declare function isDocument(node: Node): node is Document;
6
6
  export declare function isRootNode(node: Node): node is Document | DocumentFragment;
7
7
  declare type TagTypeMap = {
8
8
  HTML: HTMLHtmlElement;
9
+ BODY: HTMLBodyElement;
9
10
  IMG: HTMLImageElement;
10
11
  INPUT: HTMLInputElement;
11
12
  TEXTAREA: HTMLTextAreaElement;
@@ -109,8 +109,7 @@ export default class App {
109
109
  active(): boolean;
110
110
  resetNextPageSession(flag: boolean): void;
111
111
  private _start;
112
- start(options?: StartOptions): Promise<StartPromiseReturn>;
112
+ start(...args: Parameters<App['_start']>): Promise<StartPromiseReturn>;
113
113
  stop(stopWorker?: boolean): void;
114
- restart(): void;
115
114
  }
116
115
  export {};
package/cjs/app/index.js CHANGED
@@ -33,7 +33,7 @@ class App {
33
33
  this.stopCallbacks = [];
34
34
  this.commitCallbacks = [];
35
35
  this.activityState = ActivityState.NotActive;
36
- this.version = '4.1.6'; // TODO: version compatability check inside each plugin.
36
+ this.version = '4.1.7'; // TODO: version compatability check inside each plugin.
37
37
  this.delay = 0;
38
38
  this.projectKey = projectKey;
39
39
  this.options = Object.assign({
@@ -76,14 +76,14 @@ class App {
76
76
  this.session.applySessionHash(sessionToken);
77
77
  }
78
78
  try {
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 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' })));
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' })));
80
80
  this.worker.onerror = (e) => {
81
81
  this._debug('webworker_error', e);
82
82
  };
83
83
  this.worker.onmessage = ({ data }) => {
84
84
  if (data === 'restart') {
85
85
  this.stop(false);
86
- this.start({ forceNew: true }); // TODO: keep userID & metadata (draw scenarios)
86
+ this.start({}, true);
87
87
  }
88
88
  else if (data.type === 'failure') {
89
89
  this.stop(false);
@@ -107,7 +107,7 @@ class App {
107
107
  }
108
108
  _debug(context, e) {
109
109
  if (this.options.__debug_report_edp !== null) {
110
- fetch(this.options.__debug_report_edp, {
110
+ void fetch(this.options.__debug_report_edp, {
111
111
  method: 'POST',
112
112
  headers: { 'Content-Type': 'application/json' },
113
113
  body: JSON.stringify({
@@ -178,8 +178,8 @@ class App {
178
178
  if (useSafe) {
179
179
  listener = this.safe(listener);
180
180
  }
181
- this.attachStartCallback(() => target.addEventListener(type, listener, useCapture), useSafe);
182
- this.attachStopCallback(() => target.removeEventListener(type, listener, useCapture), useSafe);
181
+ this.attachStartCallback(() => target === null || target === void 0 ? void 0 : target.addEventListener(type, listener, useCapture), useSafe);
182
+ this.attachStopCallback(() => target === null || target === void 0 ? void 0 : target.removeEventListener(type, listener, useCapture), useSafe);
183
183
  }
184
184
  // TODO: full correct semantic
185
185
  checkRequiredVersion(version) {
@@ -268,7 +268,7 @@ class App {
268
268
  this.sessionStorage.removeItem(this.options.session_reset_key);
269
269
  }
270
270
  }
271
- _start(startOpts) {
271
+ _start(startOpts = {}, resetByWorker = false) {
272
272
  if (!this.worker) {
273
273
  return Promise.resolve(UnsuccessfulStart('No worker found: perhaps, CSP is not set.'));
274
274
  }
@@ -279,6 +279,13 @@ class App {
279
279
  if (startOpts.sessionHash) {
280
280
  this.session.applySessionHash(startOpts.sessionHash);
281
281
  }
282
+ if (startOpts.forceNew) { // Reset session metadata only if requested directly
283
+ this.session.reset();
284
+ }
285
+ this.session.assign({
286
+ userID: startOpts.userID,
287
+ metadata: startOpts.metadata,
288
+ });
282
289
  const timestamp = (0, utils_js_1.now)();
283
290
  this.worker.postMessage({
284
291
  type: 'start',
@@ -289,23 +296,16 @@ class App {
289
296
  connAttemptCount: this.options.connAttemptCount,
290
297
  connAttemptGap: this.options.connAttemptGap,
291
298
  });
292
- this.session.update({
293
- // TODO: transparent "session" module logic AND explicit internal api for plugins.
294
- // "updating" with old metadata in order to trigger session's UpdateCallbacks.
295
- // (for the case of internal .start() calls, like on "restart" webworker signal or assistent connection in tracker-assist )
296
- metadata: startOpts.metadata || this.session.getInfo().metadata,
297
- userID: startOpts.userID,
298
- });
299
- const sReset = this.sessionStorage.getItem(this.options.session_reset_key);
299
+ const lsReset = this.sessionStorage.getItem(this.options.session_reset_key) !== null;
300
300
  this.sessionStorage.removeItem(this.options.session_reset_key);
301
- const shouldReset = startOpts.forceNew || sReset !== null;
301
+ const needNewSessionID = startOpts.forceNew || lsReset || resetByWorker;
302
302
  return window
303
303
  .fetch(this.options.ingestPoint + '/v1/web/start', {
304
304
  method: 'POST',
305
305
  headers: {
306
306
  'Content-Type': 'application/json',
307
307
  },
308
- body: JSON.stringify(Object.assign(Object.assign({}, this.getTrackerInfo()), { timestamp, userID: this.session.getInfo().userID, token: shouldReset ? undefined : this.session.getSessionToken(), deviceMemory: performance_js_1.deviceMemory,
308
+ body: JSON.stringify(Object.assign(Object.assign({}, this.getTrackerInfo()), { timestamp, userID: this.session.getInfo().userID, token: needNewSessionID ? undefined : this.session.getSessionToken(), deviceMemory: performance_js_1.deviceMemory,
309
309
  jsHeapSizeLimit: performance_js_1.jsHeapSizeLimit })),
310
310
  })
311
311
  .then((r) => {
@@ -327,23 +327,28 @@ class App {
327
327
  if (this.activityState === ActivityState.NotActive) {
328
328
  return Promise.reject('Tracker stopped during authorisation');
329
329
  }
330
- const { token, userUUID, sessionID, projectID, beaconSizeLimit, startTimestamp, // real startTS, derived from sessionID
331
- delay, } = r;
330
+ const { token, userUUID, projectID, beaconSizeLimit, delay, // derived from token
331
+ sessionID, // derived from token
332
+ startTimestamp, // real startTS (server time), derived from sessionID
333
+ } = r;
332
334
  if (typeof token !== 'string' ||
333
335
  typeof userUUID !== 'string' ||
334
- //typeof startTimestamp !== 'number' ||
335
- //typeof sessionID !== 'string' ||
336
+ (typeof startTimestamp !== 'number' && typeof startTimestamp !== 'undefined') ||
337
+ typeof sessionID !== 'string' ||
336
338
  typeof delay !== 'number' ||
337
339
  (typeof beaconSizeLimit !== 'number' && typeof beaconSizeLimit !== 'undefined')) {
338
340
  return Promise.reject(`Incorrect server response: ${JSON.stringify(r)}`);
339
341
  }
340
342
  this.delay = delay;
341
- const prevSessionID = this.session.getInfo().sessionID;
342
- if (prevSessionID && prevSessionID !== sessionID) {
343
- this.session.reset();
344
- }
345
343
  this.session.setSessionToken(token);
346
- this.session.update({ sessionID, timestamp: startTimestamp || timestamp, projectID }); // TODO: no no-explicit 'any'
344
+ this.session.assign({
345
+ sessionID,
346
+ timestamp: startTimestamp || timestamp,
347
+ projectID,
348
+ });
349
+ // Resend Metadata in case of updated sessionID
350
+ Object.entries(this.session.getInfo().metadata)
351
+ .forEach(([key, value]) => this.send((0, messages_gen_js_1.Metadata)(key, value)));
347
352
  this.localStorage.setItem(this.options.local_uuid_key, userUUID);
348
353
  this.worker.postMessage({
349
354
  type: 'auth',
@@ -351,7 +356,8 @@ class App {
351
356
  beaconSizeLimit,
352
357
  });
353
358
  const onStartInfo = { sessionToken: token, userUUID, sessionID };
354
- this.startCallbacks.forEach((cb) => cb(onStartInfo)); // TODO: start as early as possible (before receiving the token)
359
+ // TODO: start as early as possible (before receiving the token)
360
+ this.startCallbacks.forEach((cb) => cb(onStartInfo)); // MBTODO: callbacks after DOM "mounted" (observed)
355
361
  this.observer.observe();
356
362
  this.ticker.start();
357
363
  this.activityState = ActivityState.Active;
@@ -373,16 +379,16 @@ class App {
373
379
  return UnsuccessfulStart(START_ERROR);
374
380
  });
375
381
  }
376
- start(options = {}) {
382
+ start(...args) {
377
383
  if (!document.hidden) {
378
- return this._start(options);
384
+ return this._start(...args);
379
385
  }
380
386
  else {
381
387
  return new Promise((resolve) => {
382
388
  const onVisibilityChange = () => {
383
389
  if (!document.hidden) {
384
390
  document.removeEventListener('visibilitychange', onVisibilityChange);
385
- resolve(this._start(options));
391
+ resolve(this._start(...args));
386
392
  }
387
393
  };
388
394
  document.addEventListener('visibilitychange', onVisibilityChange);
@@ -407,9 +413,5 @@ class App {
407
413
  }
408
414
  }
409
415
  }
410
- restart() {
411
- this.stop(false);
412
- this.start({ forceNew: false });
413
- }
414
416
  }
415
417
  exports.default = App;
@@ -42,6 +42,8 @@ export declare function PerformanceTrack(frames: number, ticks: number, totalJSH
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;
45
+ export declare function LoadFontFace(parentID: number, family: string, source: string, descriptors: string): Messages.LoadFontFace;
46
+ export declare function SetNodeFocus(id: number): Messages.SetNodeFocus;
45
47
  export declare function LongTask(timestamp: number, duration: number, context: number, containerType: number, containerSrc: string, containerId: string, containerName: string): Messages.LongTask;
46
48
  export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
47
49
  export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
@@ -2,8 +2,8 @@
2
2
  // Auto-generated, do not edit
3
3
  /* eslint-disable */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.CreateIFrameDocument = exports.MouseClick = exports.CSSInsertRuleURLBased = exports.CustomIssue = exports.TechnicalInfo = exports.SetCSSDataURLBased = exports.SetNodeAttributeURLBased = exports.LongTask = exports.SetPageVisibility = exports.ConnectionInformation = exports.ResourceTiming = exports.PerformanceTrack = exports.GraphQL = exports.NgRx = exports.MobX = exports.Vuex = exports.Redux = exports.StateAction = exports.OTable = exports.Profiler = exports.Fetch = exports.CSSDeleteRule = exports.CSSInsertRule = exports.Metadata = exports.UserAnonymousID = exports.UserID = exports.RawCustomEvent = exports.JSExceptionDeprecated = exports.PageRenderTiming = exports.PageLoadTiming = exports.ConsoleLog = exports.MouseMove = exports.SetInputChecked = exports.SetInputValue = exports.SetInputTarget = exports.SetNodeScroll = exports.SetNodeData = exports.RemoveNodeAttribute = exports.SetNodeAttribute = exports.RemoveNode = exports.MoveNode = exports.CreateTextNode = exports.CreateElementNode = exports.CreateDocument = exports.SetViewportScroll = exports.SetViewportSize = exports.SetPageLocation = exports.Timestamp = exports.PartitionedMessage = exports.BatchMetadata = void 0;
6
- exports.JSException = exports.Zustand = exports.AdoptedSSRemoveOwner = exports.AdoptedSSAddOwner = exports.AdoptedSSDeleteRule = exports.AdoptedSSInsertRuleURLBased = exports.AdoptedSSReplaceURLBased = void 0;
5
+ exports.CSSInsertRuleURLBased = exports.CustomIssue = exports.TechnicalInfo = exports.SetCSSDataURLBased = exports.SetNodeAttributeURLBased = exports.LongTask = exports.SetNodeFocus = exports.LoadFontFace = exports.SetPageVisibility = exports.ConnectionInformation = exports.ResourceTiming = exports.PerformanceTrack = exports.GraphQL = exports.NgRx = exports.MobX = exports.Vuex = exports.Redux = exports.StateAction = exports.OTable = exports.Profiler = exports.Fetch = exports.CSSDeleteRule = exports.CSSInsertRule = exports.Metadata = exports.UserAnonymousID = exports.UserID = exports.RawCustomEvent = exports.JSExceptionDeprecated = exports.PageRenderTiming = exports.PageLoadTiming = exports.ConsoleLog = exports.MouseMove = exports.SetInputChecked = exports.SetInputValue = exports.SetInputTarget = exports.SetNodeScroll = exports.SetNodeData = exports.RemoveNodeAttribute = exports.SetNodeAttribute = exports.RemoveNode = exports.MoveNode = exports.CreateTextNode = exports.CreateElementNode = exports.CreateDocument = exports.SetViewportScroll = exports.SetViewportSize = exports.SetPageLocation = exports.Timestamp = exports.PartitionedMessage = exports.BatchMetadata = void 0;
6
+ exports.JSException = exports.Zustand = exports.AdoptedSSRemoveOwner = exports.AdoptedSSAddOwner = exports.AdoptedSSDeleteRule = exports.AdoptedSSInsertRuleURLBased = exports.AdoptedSSReplaceURLBased = exports.CreateIFrameDocument = exports.MouseClick = void 0;
7
7
  function BatchMetadata(version, pageNo, firstIndex, timestamp, location) {
8
8
  return [
9
9
  81 /* BatchMetadata */,
@@ -373,6 +373,23 @@ function SetPageVisibility(hidden) {
373
373
  ];
374
374
  }
375
375
  exports.SetPageVisibility = SetPageVisibility;
376
+ function LoadFontFace(parentID, family, source, descriptors) {
377
+ return [
378
+ 57 /* LoadFontFace */,
379
+ parentID,
380
+ family,
381
+ source,
382
+ descriptors,
383
+ ];
384
+ }
385
+ exports.LoadFontFace = LoadFontFace;
386
+ function SetNodeFocus(id) {
387
+ return [
388
+ 58 /* SetNodeFocus */,
389
+ id,
390
+ ];
391
+ }
392
+ exports.SetNodeFocus = SetNodeFocus;
376
393
  function LongTask(timestamp, duration, context, containerType, containerSrc, containerId, containerName) {
377
394
  return [
378
395
  59 /* LongTask */,
@@ -96,6 +96,8 @@ class TopObserver extends observer_js_1.default {
96
96
  // Alternatively - observe(#document) then bindNode(documentElement)
97
97
  this.observeRoot(window.document, () => {
98
98
  this.app.send((0, messages_gen_js_1.CreateDocument)());
99
+ // it has no node_id here
100
+ this.app.nodes.callNodeCallbacks(document, true);
99
101
  }, window.document.documentElement);
100
102
  }
101
103
  disconnect() {
@@ -23,7 +23,7 @@ export default class Session {
23
23
  constructor(app: App, options: Options);
24
24
  attachUpdateCallback(cb: OnUpdateCallback): void;
25
25
  private handleUpdate;
26
- update(newInfo: Partial<SessionInfo>): void;
26
+ assign(newInfo: Partial<SessionInfo>): void;
27
27
  setMetadata(key: string, value: string): void;
28
28
  setUserID(userID: string): void;
29
29
  private getPageNumber;
@@ -21,7 +21,7 @@ class Session {
21
21
  }
22
22
  this.callbacks.forEach((cb) => cb(newInfo));
23
23
  }
24
- update(newInfo) {
24
+ assign(newInfo) {
25
25
  if (newInfo.userID !== undefined) {
26
26
  // TODO clear nullable/undefinable types
27
27
  this.userID = newInfo.userID;
@@ -41,6 +41,8 @@ export declare const enum Type {
41
41
  ResourceTiming = 53,
42
42
  ConnectionInformation = 54,
43
43
  SetPageVisibility = 55,
44
+ LoadFontFace = 57,
45
+ SetNodeFocus = 58,
44
46
  LongTask = 59,
45
47
  SetNodeAttributeURLBased = 60,
46
48
  SetCSSDataURLBased = 61,
@@ -300,6 +302,17 @@ export declare type SetPageVisibility = [
300
302
  Type.SetPageVisibility,
301
303
  boolean
302
304
  ];
305
+ export declare type LoadFontFace = [
306
+ Type.LoadFontFace,
307
+ number,
308
+ string,
309
+ string,
310
+ string
311
+ ];
312
+ export declare type SetNodeFocus = [
313
+ Type.SetNodeFocus,
314
+ number
315
+ ];
303
316
  export declare type LongTask = [
304
317
  Type.LongTask,
305
318
  number,
@@ -392,5 +405,5 @@ export declare type JSException = [
392
405
  string,
393
406
  string
394
407
  ];
395
- declare type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | ConsoleLog | PageLoadTiming | PageRenderTiming | JSExceptionDeprecated | RawCustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | JSException;
408
+ declare type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | ConsoleLog | PageLoadTiming | PageRenderTiming | JSExceptionDeprecated | RawCustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | JSException;
396
409
  export default Message;
package/cjs/index.js CHANGED
@@ -20,6 +20,8 @@ const performance_js_1 = require("./modules/performance.js");
20
20
  const scroll_js_1 = require("./modules/scroll.js");
21
21
  const viewport_js_1 = require("./modules/viewport.js");
22
22
  const cssrules_js_1 = require("./modules/cssrules.js");
23
+ const focus_js_1 = require("./modules/focus.js");
24
+ const fonts_js_1 = require("./modules/fonts.js");
23
25
  const constructedStyleSheets_js_1 = require("./modules/constructedStyleSheets.js");
24
26
  const utils_js_1 = require("./utils.js");
25
27
  const DOCS_SETUP = '/installation/setup-or';
@@ -110,6 +112,8 @@ class API {
110
112
  (0, timing_js_1.default)(app, options);
111
113
  (0, performance_js_1.default)(app, options);
112
114
  (0, scroll_js_1.default)(app);
115
+ (0, focus_js_1.default)(app);
116
+ (0, fonts_js_1.default)(app);
113
117
  window.__OPENREPLAY__ = this;
114
118
  if (options.autoResetOnWindowOpen) {
115
119
  const wOpen = window.open;
@@ -134,7 +138,7 @@ class API {
134
138
  // no-cors issue only with text/plain or not-set Content-Type
135
139
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
136
140
  req.send(JSON.stringify({
137
- trackerVersion: '4.1.6',
141
+ trackerVersion: '4.1.7',
138
142
  projectKey: options.projectKey,
139
143
  doNotTrack,
140
144
  // TODO: add precise reason (an exact API missing)
@@ -20,10 +20,6 @@ function default_1(app) {
20
20
  return;
21
21
  }
22
22
  if (!hasAdoptedSS(document)) {
23
- app.attachStartCallback(() => {
24
- // MBTODO: pre-start sendQueue app
25
- app.send((0, messages_gen_js_1.TechnicalInfo)('no_adopted_stylesheets', ''));
26
- });
27
23
  return;
28
24
  }
29
25
  const styleSheetIDMap = new Map();
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const guards_js_1 = require("../app/guards.js");
4
+ const messages_gen_js_1 = require("../app/messages.gen.js");
5
+ function default_1(app) {
6
+ function sendSetNodeFocus(n) {
7
+ const id = app.nodes.getID(n);
8
+ if (id !== undefined) {
9
+ app.send((0, messages_gen_js_1.SetNodeFocus)(id));
10
+ }
11
+ }
12
+ let blurred = false;
13
+ app.nodes.attachNodeCallback((node) => {
14
+ if (!(0, guards_js_1.hasTag)(node, 'BODY')) {
15
+ return;
16
+ }
17
+ app.nodes.attachNodeListener(node, 'focus', (e) => {
18
+ if (!(0, guards_js_1.isNode)(e.target)) {
19
+ return;
20
+ }
21
+ sendSetNodeFocus(e.target);
22
+ blurred = false;
23
+ });
24
+ app.nodes.attachNodeListener(node, 'blur', (e) => {
25
+ if (e.relatedTarget === null) {
26
+ blurred = true;
27
+ setTimeout(() => {
28
+ if (blurred) {
29
+ app.send((0, messages_gen_js_1.SetNodeFocus)(-1));
30
+ }
31
+ }, 0);
32
+ }
33
+ });
34
+ });
35
+ app.attachStartCallback(() => {
36
+ let elem = document.activeElement;
37
+ while (elem && (0, guards_js_1.hasTag)(elem, 'IFRAME') && elem.contentDocument) {
38
+ elem = elem.contentDocument.activeElement;
39
+ }
40
+ if (elem && elem !== elem.ownerDocument.body) {
41
+ sendSetNodeFocus(elem);
42
+ }
43
+ }, true);
44
+ }
45
+ exports.default = default_1;
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const guards_js_1 = require("../app/guards.js");
4
+ const messages_gen_js_1 = require("../app/messages.gen.js");
5
+ function default_1(app) {
6
+ if (!window.FontFace) {
7
+ return;
8
+ }
9
+ const docFonts = new Map();
10
+ const patchWindow = (wnd) => {
11
+ class FontFaceInterceptor extends wnd.FontFace {
12
+ constructor(...args) {
13
+ //maybe do this on load(). In this case check if the document.fonts.load(...) function calls the font's load()
14
+ if (typeof args[1] === 'string') {
15
+ let desc = '';
16
+ if (args[2]) {
17
+ app.safe(() => {
18
+ desc = JSON.stringify(args[2]);
19
+ });
20
+ }
21
+ const ffData = [args[0], args[1], desc];
22
+ const ffDataArr = docFonts.get(wnd.document) || [];
23
+ ffDataArr.push(ffData);
24
+ docFonts.set(wnd.document, ffDataArr);
25
+ const parentID = wnd === window ? 0 : app.nodes.getID(wnd.document);
26
+ if (parentID === undefined) {
27
+ return;
28
+ }
29
+ if (app.active()) {
30
+ app.send((0, messages_gen_js_1.LoadFontFace)(parentID, ...ffData));
31
+ }
32
+ }
33
+ super(...args);
34
+ }
35
+ }
36
+ wnd.FontFace = FontFaceInterceptor;
37
+ };
38
+ app.observer.attachContextCallback(patchWindow);
39
+ patchWindow(window);
40
+ app.nodes.attachNodeCallback((node) => {
41
+ if (!(0, guards_js_1.isDocument)(node)) {
42
+ return;
43
+ }
44
+ const ffDataArr = docFonts.get(node);
45
+ if (!ffDataArr) {
46
+ return;
47
+ }
48
+ const parentID = node.defaultView === window ? 0 : app.nodes.getID(node);
49
+ if (parentID === undefined) {
50
+ return;
51
+ }
52
+ ffDataArr.forEach((ffData) => {
53
+ app.send((0, messages_gen_js_1.LoadFontFace)(parentID, ...ffData));
54
+ });
55
+ });
56
+ }
57
+ exports.default = default_1;
package/cjs/utils.js CHANGED
@@ -5,6 +5,15 @@ const DEPRECATED_ATTRS = { htmlmasked: 'hidden', masked: 'obscured' };
5
5
  exports.IN_BROWSER = !(typeof window === 'undefined');
6
6
  exports.IS_FIREFOX = exports.IN_BROWSER && navigator.userAgent.match(/firefox|fxios/i);
7
7
  exports.MAX_STR_LEN = 1e5;
8
+ // TODO: time adjustment
9
+ // // Bad to use `performance.timeOrigin || performance.timing.navigationStart`
10
+ // // https://github.com/mdn/content/issues/4713
11
+ // const timeOrigin: number | false =
12
+ // IN_BROWSER && (Date.now() - performance.now())
13
+ // export const now: () => number =
14
+ // IN_BROWSER && timeOrigin && !!performance.now
15
+ // ? () => Math.round(performance.now() + timeOrigin)
16
+ // : () => Date.now()
8
17
  const navigationStart = exports.IN_BROWSER && (performance.timing.navigationStart || performance.timeOrigin);
9
18
  // performance.now() is buggy in some browsers
10
19
  exports.now = exports.IN_BROWSER && performance.now() && navigationStart
@@ -6,6 +6,7 @@ export declare function isDocument(node: Node): node is Document;
6
6
  export declare function isRootNode(node: Node): node is Document | DocumentFragment;
7
7
  declare type TagTypeMap = {
8
8
  HTML: HTMLHtmlElement;
9
+ BODY: HTMLBodyElement;
9
10
  IMG: HTMLImageElement;
10
11
  INPUT: HTMLInputElement;
11
12
  TEXTAREA: HTMLTextAreaElement;
@@ -109,8 +109,7 @@ export default class App {
109
109
  active(): boolean;
110
110
  resetNextPageSession(flag: boolean): void;
111
111
  private _start;
112
- start(options?: StartOptions): Promise<StartPromiseReturn>;
112
+ start(...args: Parameters<App['_start']>): Promise<StartPromiseReturn>;
113
113
  stop(stopWorker?: boolean): void;
114
- restart(): void;
115
114
  }
116
115
  export {};
package/lib/app/index.js CHANGED
@@ -30,7 +30,7 @@ export default class App {
30
30
  this.stopCallbacks = [];
31
31
  this.commitCallbacks = [];
32
32
  this.activityState = ActivityState.NotActive;
33
- this.version = '4.1.6'; // TODO: version compatability check inside each plugin.
33
+ this.version = '4.1.7'; // TODO: version compatability check inside each plugin.
34
34
  this.delay = 0;
35
35
  this.projectKey = projectKey;
36
36
  this.options = Object.assign({
@@ -73,14 +73,14 @@ export default class App {
73
73
  this.session.applySessionHash(sessionToken);
74
74
  }
75
75
  try {
76
- 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 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' })));
76
+ 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' })));
77
77
  this.worker.onerror = (e) => {
78
78
  this._debug('webworker_error', e);
79
79
  };
80
80
  this.worker.onmessage = ({ data }) => {
81
81
  if (data === 'restart') {
82
82
  this.stop(false);
83
- this.start({ forceNew: true }); // TODO: keep userID & metadata (draw scenarios)
83
+ this.start({}, true);
84
84
  }
85
85
  else if (data.type === 'failure') {
86
86
  this.stop(false);
@@ -104,7 +104,7 @@ export default class App {
104
104
  }
105
105
  _debug(context, e) {
106
106
  if (this.options.__debug_report_edp !== null) {
107
- fetch(this.options.__debug_report_edp, {
107
+ void fetch(this.options.__debug_report_edp, {
108
108
  method: 'POST',
109
109
  headers: { 'Content-Type': 'application/json' },
110
110
  body: JSON.stringify({
@@ -175,8 +175,8 @@ export default class App {
175
175
  if (useSafe) {
176
176
  listener = this.safe(listener);
177
177
  }
178
- this.attachStartCallback(() => target.addEventListener(type, listener, useCapture), useSafe);
179
- this.attachStopCallback(() => target.removeEventListener(type, listener, useCapture), useSafe);
178
+ this.attachStartCallback(() => target === null || target === void 0 ? void 0 : target.addEventListener(type, listener, useCapture), useSafe);
179
+ this.attachStopCallback(() => target === null || target === void 0 ? void 0 : target.removeEventListener(type, listener, useCapture), useSafe);
180
180
  }
181
181
  // TODO: full correct semantic
182
182
  checkRequiredVersion(version) {
@@ -265,7 +265,7 @@ export default class App {
265
265
  this.sessionStorage.removeItem(this.options.session_reset_key);
266
266
  }
267
267
  }
268
- _start(startOpts) {
268
+ _start(startOpts = {}, resetByWorker = false) {
269
269
  if (!this.worker) {
270
270
  return Promise.resolve(UnsuccessfulStart('No worker found: perhaps, CSP is not set.'));
271
271
  }
@@ -276,6 +276,13 @@ export default class App {
276
276
  if (startOpts.sessionHash) {
277
277
  this.session.applySessionHash(startOpts.sessionHash);
278
278
  }
279
+ if (startOpts.forceNew) { // Reset session metadata only if requested directly
280
+ this.session.reset();
281
+ }
282
+ this.session.assign({
283
+ userID: startOpts.userID,
284
+ metadata: startOpts.metadata,
285
+ });
279
286
  const timestamp = now();
280
287
  this.worker.postMessage({
281
288
  type: 'start',
@@ -286,23 +293,16 @@ export default class App {
286
293
  connAttemptCount: this.options.connAttemptCount,
287
294
  connAttemptGap: this.options.connAttemptGap,
288
295
  });
289
- this.session.update({
290
- // TODO: transparent "session" module logic AND explicit internal api for plugins.
291
- // "updating" with old metadata in order to trigger session's UpdateCallbacks.
292
- // (for the case of internal .start() calls, like on "restart" webworker signal or assistent connection in tracker-assist )
293
- metadata: startOpts.metadata || this.session.getInfo().metadata,
294
- userID: startOpts.userID,
295
- });
296
- const sReset = this.sessionStorage.getItem(this.options.session_reset_key);
296
+ const lsReset = this.sessionStorage.getItem(this.options.session_reset_key) !== null;
297
297
  this.sessionStorage.removeItem(this.options.session_reset_key);
298
- const shouldReset = startOpts.forceNew || sReset !== null;
298
+ const needNewSessionID = startOpts.forceNew || lsReset || resetByWorker;
299
299
  return window
300
300
  .fetch(this.options.ingestPoint + '/v1/web/start', {
301
301
  method: 'POST',
302
302
  headers: {
303
303
  'Content-Type': 'application/json',
304
304
  },
305
- body: JSON.stringify(Object.assign(Object.assign({}, this.getTrackerInfo()), { timestamp, userID: this.session.getInfo().userID, token: shouldReset ? undefined : this.session.getSessionToken(), deviceMemory,
305
+ body: JSON.stringify(Object.assign(Object.assign({}, this.getTrackerInfo()), { timestamp, userID: this.session.getInfo().userID, token: needNewSessionID ? undefined : this.session.getSessionToken(), deviceMemory,
306
306
  jsHeapSizeLimit })),
307
307
  })
308
308
  .then((r) => {
@@ -324,23 +324,28 @@ export default class App {
324
324
  if (this.activityState === ActivityState.NotActive) {
325
325
  return Promise.reject('Tracker stopped during authorisation');
326
326
  }
327
- const { token, userUUID, sessionID, projectID, beaconSizeLimit, startTimestamp, // real startTS, derived from sessionID
328
- delay, } = r;
327
+ const { token, userUUID, projectID, beaconSizeLimit, delay, // derived from token
328
+ sessionID, // derived from token
329
+ startTimestamp, // real startTS (server time), derived from sessionID
330
+ } = r;
329
331
  if (typeof token !== 'string' ||
330
332
  typeof userUUID !== 'string' ||
331
- //typeof startTimestamp !== 'number' ||
332
- //typeof sessionID !== 'string' ||
333
+ (typeof startTimestamp !== 'number' && typeof startTimestamp !== 'undefined') ||
334
+ typeof sessionID !== 'string' ||
333
335
  typeof delay !== 'number' ||
334
336
  (typeof beaconSizeLimit !== 'number' && typeof beaconSizeLimit !== 'undefined')) {
335
337
  return Promise.reject(`Incorrect server response: ${JSON.stringify(r)}`);
336
338
  }
337
339
  this.delay = delay;
338
- const prevSessionID = this.session.getInfo().sessionID;
339
- if (prevSessionID && prevSessionID !== sessionID) {
340
- this.session.reset();
341
- }
342
340
  this.session.setSessionToken(token);
343
- this.session.update({ sessionID, timestamp: startTimestamp || timestamp, projectID }); // TODO: no no-explicit 'any'
341
+ this.session.assign({
342
+ sessionID,
343
+ timestamp: startTimestamp || timestamp,
344
+ projectID,
345
+ });
346
+ // Resend Metadata in case of updated sessionID
347
+ Object.entries(this.session.getInfo().metadata)
348
+ .forEach(([key, value]) => this.send(Metadata(key, value)));
344
349
  this.localStorage.setItem(this.options.local_uuid_key, userUUID);
345
350
  this.worker.postMessage({
346
351
  type: 'auth',
@@ -348,7 +353,8 @@ export default class App {
348
353
  beaconSizeLimit,
349
354
  });
350
355
  const onStartInfo = { sessionToken: token, userUUID, sessionID };
351
- this.startCallbacks.forEach((cb) => cb(onStartInfo)); // TODO: start as early as possible (before receiving the token)
356
+ // TODO: start as early as possible (before receiving the token)
357
+ this.startCallbacks.forEach((cb) => cb(onStartInfo)); // MBTODO: callbacks after DOM "mounted" (observed)
352
358
  this.observer.observe();
353
359
  this.ticker.start();
354
360
  this.activityState = ActivityState.Active;
@@ -370,16 +376,16 @@ export default class App {
370
376
  return UnsuccessfulStart(START_ERROR);
371
377
  });
372
378
  }
373
- start(options = {}) {
379
+ start(...args) {
374
380
  if (!document.hidden) {
375
- return this._start(options);
381
+ return this._start(...args);
376
382
  }
377
383
  else {
378
384
  return new Promise((resolve) => {
379
385
  const onVisibilityChange = () => {
380
386
  if (!document.hidden) {
381
387
  document.removeEventListener('visibilitychange', onVisibilityChange);
382
- resolve(this._start(options));
388
+ resolve(this._start(...args));
383
389
  }
384
390
  };
385
391
  document.addEventListener('visibilitychange', onVisibilityChange);
@@ -404,8 +410,4 @@ export default class App {
404
410
  }
405
411
  }
406
412
  }
407
- restart() {
408
- this.stop(false);
409
- this.start({ forceNew: false });
410
- }
411
413
  }
@@ -42,6 +42,8 @@ export declare function PerformanceTrack(frames: number, ticks: number, totalJSH
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;
45
+ export declare function LoadFontFace(parentID: number, family: string, source: string, descriptors: string): Messages.LoadFontFace;
46
+ export declare function SetNodeFocus(id: number): Messages.SetNodeFocus;
45
47
  export declare function LongTask(timestamp: number, duration: number, context: number, containerType: number, containerSrc: string, containerId: string, containerName: string): Messages.LongTask;
46
48
  export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
47
49
  export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
@@ -327,6 +327,21 @@ export function SetPageVisibility(hidden) {
327
327
  hidden,
328
328
  ];
329
329
  }
330
+ export function LoadFontFace(parentID, family, source, descriptors) {
331
+ return [
332
+ 57 /* LoadFontFace */,
333
+ parentID,
334
+ family,
335
+ source,
336
+ descriptors,
337
+ ];
338
+ }
339
+ export function SetNodeFocus(id) {
340
+ return [
341
+ 58 /* SetNodeFocus */,
342
+ id,
343
+ ];
344
+ }
330
345
  export function LongTask(timestamp, duration, context, containerType, containerSrc, containerId, containerName) {
331
346
  return [
332
347
  59 /* LongTask */,
@@ -94,6 +94,8 @@ export default class TopObserver extends Observer {
94
94
  // Alternatively - observe(#document) then bindNode(documentElement)
95
95
  this.observeRoot(window.document, () => {
96
96
  this.app.send(CreateDocument());
97
+ // it has no node_id here
98
+ this.app.nodes.callNodeCallbacks(document, true);
97
99
  }, window.document.documentElement);
98
100
  }
99
101
  disconnect() {
@@ -23,7 +23,7 @@ export default class Session {
23
23
  constructor(app: App, options: Options);
24
24
  attachUpdateCallback(cb: OnUpdateCallback): void;
25
25
  private handleUpdate;
26
- update(newInfo: Partial<SessionInfo>): void;
26
+ assign(newInfo: Partial<SessionInfo>): void;
27
27
  setMetadata(key: string, value: string): void;
28
28
  setUserID(userID: string): void;
29
29
  private getPageNumber;
@@ -19,7 +19,7 @@ export default class Session {
19
19
  }
20
20
  this.callbacks.forEach((cb) => cb(newInfo));
21
21
  }
22
- update(newInfo) {
22
+ assign(newInfo) {
23
23
  if (newInfo.userID !== undefined) {
24
24
  // TODO clear nullable/undefinable types
25
25
  this.userID = newInfo.userID;
@@ -41,6 +41,8 @@ export declare const enum Type {
41
41
  ResourceTiming = 53,
42
42
  ConnectionInformation = 54,
43
43
  SetPageVisibility = 55,
44
+ LoadFontFace = 57,
45
+ SetNodeFocus = 58,
44
46
  LongTask = 59,
45
47
  SetNodeAttributeURLBased = 60,
46
48
  SetCSSDataURLBased = 61,
@@ -300,6 +302,17 @@ export declare type SetPageVisibility = [
300
302
  Type.SetPageVisibility,
301
303
  boolean
302
304
  ];
305
+ export declare type LoadFontFace = [
306
+ Type.LoadFontFace,
307
+ number,
308
+ string,
309
+ string,
310
+ string
311
+ ];
312
+ export declare type SetNodeFocus = [
313
+ Type.SetNodeFocus,
314
+ number
315
+ ];
303
316
  export declare type LongTask = [
304
317
  Type.LongTask,
305
318
  number,
@@ -392,5 +405,5 @@ export declare type JSException = [
392
405
  string,
393
406
  string
394
407
  ];
395
- declare type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | ConsoleLog | PageLoadTiming | PageRenderTiming | JSExceptionDeprecated | RawCustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | JSException;
408
+ declare type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | ConsoleLog | PageLoadTiming | PageRenderTiming | JSExceptionDeprecated | RawCustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | JSException;
396
409
  export default Message;
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../src/common/messages.gen.ts","../../src/common/interaction.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/glob/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/resolve/index.d.ts"],"fileInfos":[{"version":"ca3c1cd7464b613bf148a1422cb3201fe083e08565a02dc99eaad0d2977c16a7","affectsGlobalScope":true,"impliedFormat":1},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true,"impliedFormat":1},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true,"impliedFormat":1},{"version":"4378fc8122ec9d1a685b01eb66c46f62aba6b239ca7228bb6483bcf8259ee493","affectsGlobalScope":true,"impliedFormat":1},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true,"impliedFormat":1},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true,"impliedFormat":1},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true,"impliedFormat":1},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true,"impliedFormat":1},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true,"impliedFormat":1},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true,"impliedFormat":1},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true,"impliedFormat":1},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true,"impliedFormat":1},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true,"impliedFormat":1},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true,"impliedFormat":1},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true,"impliedFormat":1},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true,"impliedFormat":1},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true,"impliedFormat":1},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true,"impliedFormat":1},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true,"impliedFormat":1},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true,"impliedFormat":1},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true,"impliedFormat":1},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true,"impliedFormat":1},{"version":"ca06fa264234f5895ebfe13ec1f578ee1c18a0d02219a54c3cdad296686251cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true,"impliedFormat":1},"0be6884583877cf9cb8a4aaea570562fd4ac89971a8a308c061e3923ad289654","d823dfc1284a4a9d3ce9775f2b84a2ecf07d89ceb3c354cef144bb1fae485fa9","89ccbe04e737ce613f5f04990271cfa84901446350b8551b0555ddf19319723b","9122ed7070e054b73ebab37c2373a196def2d90e7d1a9a7fcd9d46b0e51fae78","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true,"impliedFormat":1},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"3e4624c306340ad303cc536a07004e81336c3f088308a9e4a9f4c957a3cda2fd","affectsGlobalScope":true,"impliedFormat":1},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true,"impliedFormat":1},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","34ec1daf3566f26c43dbab380af0de1aac29166e57e4f9ef379a2f154e0cb290","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"249a2b90439cdfd51709539fbfa4dfe0791cbae6efce1e9b327ba8f8cd703f49","affectsGlobalScope":true,"impliedFormat":1},"2f60ac046e587e917d739f1edc77540eb0ec34f83090dae4ebd5f96c1c9578d4","a9b6b0f7b1e30359283b131ba6d1c51ee2d3601a2f12e1623141e6a1a60c92a5","aeee0090b38de0dd47ca9a79ad5c2d156e3e09d92306719b0b45a3e96098e564","7bac475dcdd9f7e4e9da934d32c305bc889c4ce3c8ac0ef45a93a8d670fff607","09416dd69576b03a3f485adf329a02f043e4a481e060ef5b208194e488d31fd9","8acf99b1c8682276a63ea5bb68433782715892726b97e4604a415e4e56bce41c",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true,"impliedFormat":1},"3b145a2351f5cf16abf999c8d5f4481c74dffdc54ec1e9a89992e2622e1226c5","a907bf91df26df2400858ef75f749498fb5cf00062bf90a737ac3949cc07978d","d270fd4b565eda11a0a737c181892316b7a1ace06c7988d0246219c3df11db06","4275d5f964e7fc7afc18538e26b3748c207dd772998346d17f409749aa1f3a63",{"version":"59a638a504490fecaacf0020b9814b6abee37edb66047eb1ab9f7c2274bf1da0","affectsGlobalScope":true,"impliedFormat":1},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","d1a78a3c5708807e8de3e399f91df4797c62e44b02195eefc2209b2e713e54ee","8c4c1a64db28930732033c31418f817dcb9d09d706766707ae6d38f23faf0c53","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","556bf5c36deb62cffa1bf697c1789fe008ec82db0273025001db66732714e9d9","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true,"impliedFormat":1},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","653968fc1b35c5eb3d273d36fac1c1dc66f9537edf28f33485b8776bd956e23d",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true,"impliedFormat":1},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","a381f079c4804442f179d742fdb2e495fe28d67a47cac673485f75ae2e77aeca","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"bfe39beb986d2a2e512c091cbe924f1c415bc65de54de0e2f6a0dc6f84c183d9","affectsGlobalScope":true,"impliedFormat":1},"2af17363f8a062e3a8cd1b26030af0058b3f86e783f4fc6aa9f57247f240ebaa","06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","dfe08140492cdc135fb7fd9c4a652c05207b61a436906079b87da1d3111314bf","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","089e1f8603cbc35ab977c8dcc662eb754b82fca32ed1dfb16bd682726c2d5432","8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true,"impliedFormat":1},"64d5585e08ad1ab194b18bf4e851f22a626eae33ac7312ca4ba90bb7ea7daf64","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","8a19491eba2108d5c333c249699f40aff05ad312c04a17504573b27d91f0aede"],"options":{"composite":true,"declaration":true,"module":5,"noImplicitAny":true,"noImplicitThis":true,"outDir":"..","rootDir":"../../src","strictNullChecks":true,"target":2},"fileIdsList":[[86],[57,58,86,93,94],[42,86],[45,86],[46,51,86],[47,57,58,65,74,85,86],[47,48,57,65,86],[49,86],[50,51,58,66,86],[51,74,82,86],[52,54,57,65,86],[53,86],[54,55,86],[56,57,86],[57,86],[57,58,59,74,85,86],[57,58,59,74,77,86],[86,90],[60,65,74,85,86],[57,58,60,61,65,74,82,85,86],[60,62,74,82,85,86],[42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92],[57,63,86],[64,85,86],[54,57,65,74,86],[66,86],[67,86],[45,68,86],[69,84,86,90],[70,86],[71,86],[57,72,86],[72,73,86,88],[57,74,75,76,77,86],[74,76,86],[74,75,86],[77,86],[78,86],[57,80,81,86],[80,81,86],[51,65,74,82,86],[83,86],[65,84,86],[46,60,71,85,86],[51,86],[74,86,87],[86,88],[86,89],[46,51,57,59,68,74,85,86,88,90],[74,86,91],[86,93],[39,86]],"referencedMap":[[41,1],[95,2],[96,1],[94,1],[42,3],[43,3],[45,4],[46,5],[47,6],[48,7],[49,8],[50,9],[51,10],[52,11],[53,12],[54,13],[55,13],[56,14],[57,15],[58,16],[59,17],[44,18],[92,1],[60,19],[61,20],[62,21],[93,22],[63,23],[64,24],[65,25],[66,26],[67,27],[68,28],[69,29],[70,30],[71,31],[72,32],[73,33],[74,34],[76,35],[75,36],[77,37],[78,38],[79,1],[80,39],[81,40],[82,41],[83,42],[84,43],[85,44],[86,45],[87,46],[88,47],[89,48],[90,49],[91,50],[97,51],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[7,1],[37,1],[33,1],[34,1],[35,1],[36,1],[1,1],[38,1],[40,52],[39,1]],"exportedModulesMap":[[41,1],[95,2],[96,1],[94,1],[42,3],[43,3],[45,4],[46,5],[47,6],[48,7],[49,8],[50,9],[51,10],[52,11],[53,12],[54,13],[55,13],[56,14],[57,15],[58,16],[59,17],[44,18],[92,1],[60,19],[61,20],[62,21],[93,22],[63,23],[64,24],[65,25],[66,26],[67,27],[68,28],[69,29],[70,30],[71,31],[72,32],[73,33],[74,34],[76,35],[75,36],[77,37],[78,38],[79,1],[80,39],[81,40],[82,41],[83,42],[84,43],[85,44],[86,45],[87,46],[88,47],[89,48],[90,49],[91,50],[97,51],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[7,1],[37,1],[33,1],[34,1],[35,1],[36,1],[1,1],[38,1],[40,52],[39,1]],"semanticDiagnosticsPerFile":[41,95,96,94,42,43,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,44,92,60,61,62,93,63,64,65,66,67,68,69,70,71,72,73,74,76,75,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,97,9,8,2,10,11,12,13,14,15,16,17,3,4,21,18,19,20,22,23,24,5,25,26,27,28,6,29,30,31,32,7,37,33,34,35,36,1,38,40,39]},"version":"4.6.0-dev.20211126"}
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../src/common/messages.gen.ts","../../src/common/interaction.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/@types/minimatch/index.d.ts","../../node_modules/@types/glob/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/resolve/index.d.ts"],"fileInfos":[{"version":"ca3c1cd7464b613bf148a1422cb3201fe083e08565a02dc99eaad0d2977c16a7","affectsGlobalScope":true,"impliedFormat":1},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true,"impliedFormat":1},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true,"impliedFormat":1},{"version":"4378fc8122ec9d1a685b01eb66c46f62aba6b239ca7228bb6483bcf8259ee493","affectsGlobalScope":true,"impliedFormat":1},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true,"impliedFormat":1},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true,"impliedFormat":1},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true,"impliedFormat":1},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true,"impliedFormat":1},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true,"impliedFormat":1},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true,"impliedFormat":1},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true,"impliedFormat":1},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true,"impliedFormat":1},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true,"impliedFormat":1},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true,"impliedFormat":1},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true,"impliedFormat":1},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true,"impliedFormat":1},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true,"impliedFormat":1},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true,"impliedFormat":1},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true,"impliedFormat":1},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true,"impliedFormat":1},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true,"impliedFormat":1},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true,"impliedFormat":1},{"version":"ca06fa264234f5895ebfe13ec1f578ee1c18a0d02219a54c3cdad296686251cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true,"impliedFormat":1},"6e4591fbdda1e3267af1b30837f3f1ed63a433a012ac26ab0b306130c5cfa779","d823dfc1284a4a9d3ce9775f2b84a2ecf07d89ceb3c354cef144bb1fae485fa9","89ccbe04e737ce613f5f04990271cfa84901446350b8551b0555ddf19319723b","9122ed7070e054b73ebab37c2373a196def2d90e7d1a9a7fcd9d46b0e51fae78","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true,"impliedFormat":1},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"3e4624c306340ad303cc536a07004e81336c3f088308a9e4a9f4c957a3cda2fd","affectsGlobalScope":true,"impliedFormat":1},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true,"impliedFormat":1},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","025fc13211ed47d2798269017af3ec869122a050d5431a6ad3c1997900e65c58","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"249a2b90439cdfd51709539fbfa4dfe0791cbae6efce1e9b327ba8f8cd703f49","affectsGlobalScope":true,"impliedFormat":1},"2f60ac046e587e917d739f1edc77540eb0ec34f83090dae4ebd5f96c1c9578d4","a9b6b0f7b1e30359283b131ba6d1c51ee2d3601a2f12e1623141e6a1a60c92a5","aeee0090b38de0dd47ca9a79ad5c2d156e3e09d92306719b0b45a3e96098e564","7bac475dcdd9f7e4e9da934d32c305bc889c4ce3c8ac0ef45a93a8d670fff607","09416dd69576b03a3f485adf329a02f043e4a481e060ef5b208194e488d31fd9","8acf99b1c8682276a63ea5bb68433782715892726b97e4604a415e4e56bce41c",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true,"impliedFormat":1},"3b145a2351f5cf16abf999c8d5f4481c74dffdc54ec1e9a89992e2622e1226c5","a907bf91df26df2400858ef75f749498fb5cf00062bf90a737ac3949cc07978d","d270fd4b565eda11a0a737c181892316b7a1ace06c7988d0246219c3df11db06","4275d5f964e7fc7afc18538e26b3748c207dd772998346d17f409749aa1f3a63",{"version":"59a638a504490fecaacf0020b9814b6abee37edb66047eb1ab9f7c2274bf1da0","affectsGlobalScope":true,"impliedFormat":1},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","d1a78a3c5708807e8de3e399f91df4797c62e44b02195eefc2209b2e713e54ee","8c4c1a64db28930732033c31418f817dcb9d09d706766707ae6d38f23faf0c53","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","12a70315c8281e46d65696086dd25827408e967b305a22276ae2779fe519e0fe","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true,"impliedFormat":1},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","29d613c3964ea75b2b4e0d17098245c34529282e9cc72b7e4eeb2a7b12c27cb7",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true,"impliedFormat":1},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","a381f079c4804442f179d742fdb2e495fe28d67a47cac673485f75ae2e77aeca","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"bfe39beb986d2a2e512c091cbe924f1c415bc65de54de0e2f6a0dc6f84c183d9","affectsGlobalScope":true,"impliedFormat":1},"2af17363f8a062e3a8cd1b26030af0058b3f86e783f4fc6aa9f57247f240ebaa","06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","dfe08140492cdc135fb7fd9c4a652c05207b61a436906079b87da1d3111314bf","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","089e1f8603cbc35ab977c8dcc662eb754b82fca32ed1dfb16bd682726c2d5432","8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true,"impliedFormat":1},"82fc37849846a3a0264047621d5beb6ce2ddeb2f83bdee2c79523af3c3282d97","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","8a19491eba2108d5c333c249699f40aff05ad312c04a17504573b27d91f0aede"],"options":{"composite":true,"declaration":true,"module":5,"noImplicitAny":true,"noImplicitThis":true,"outDir":"..","rootDir":"../../src","strictNullChecks":true,"target":2},"fileIdsList":[[86],[57,58,86,93,94],[42,86],[45,86],[46,51,86],[47,57,58,65,74,85,86],[47,48,57,65,86],[49,86],[50,51,58,66,86],[51,74,82,86],[52,54,57,65,86],[53,86],[54,55,86],[56,57,86],[57,86],[57,58,59,74,85,86],[57,58,59,74,77,86],[86,90],[60,65,74,85,86],[57,58,60,61,65,74,82,85,86],[60,62,74,82,85,86],[42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92],[57,63,86],[64,85,86],[54,57,65,74,86],[66,86],[67,86],[45,68,86],[69,84,86,90],[70,86],[71,86],[57,72,86],[72,73,86,88],[57,74,75,76,77,86],[74,76,86],[74,75,86],[77,86],[78,86],[57,80,81,86],[80,81,86],[51,65,74,82,86],[83,86],[65,84,86],[46,60,71,85,86],[51,86],[74,86,87],[86,88],[86,89],[46,51,57,59,68,74,85,86,88,90],[74,86,91],[86,93],[39,86]],"referencedMap":[[41,1],[95,2],[96,1],[94,1],[42,3],[43,3],[45,4],[46,5],[47,6],[48,7],[49,8],[50,9],[51,10],[52,11],[53,12],[54,13],[55,13],[56,14],[57,15],[58,16],[59,17],[44,18],[92,1],[60,19],[61,20],[62,21],[93,22],[63,23],[64,24],[65,25],[66,26],[67,27],[68,28],[69,29],[70,30],[71,31],[72,32],[73,33],[74,34],[76,35],[75,36],[77,37],[78,38],[79,1],[80,39],[81,40],[82,41],[83,42],[84,43],[85,44],[86,45],[87,46],[88,47],[89,48],[90,49],[91,50],[97,51],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[7,1],[37,1],[33,1],[34,1],[35,1],[36,1],[1,1],[38,1],[40,52],[39,1]],"exportedModulesMap":[[41,1],[95,2],[96,1],[94,1],[42,3],[43,3],[45,4],[46,5],[47,6],[48,7],[49,8],[50,9],[51,10],[52,11],[53,12],[54,13],[55,13],[56,14],[57,15],[58,16],[59,17],[44,18],[92,1],[60,19],[61,20],[62,21],[93,22],[63,23],[64,24],[65,25],[66,26],[67,27],[68,28],[69,29],[70,30],[71,31],[72,32],[73,33],[74,34],[76,35],[75,36],[77,37],[78,38],[79,1],[80,39],[81,40],[82,41],[83,42],[84,43],[85,44],[86,45],[87,46],[88,47],[89,48],[90,49],[91,50],[97,51],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[7,1],[37,1],[33,1],[34,1],[35,1],[36,1],[1,1],[38,1],[40,52],[39,1]],"semanticDiagnosticsPerFile":[41,95,96,94,42,43,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,44,92,60,61,62,93,63,64,65,66,67,68,69,70,71,72,73,74,76,75,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,97,9,8,2,10,11,12,13,14,15,16,17,3,4,21,18,19,20,22,23,24,5,25,26,27,28,6,29,30,31,32,7,37,33,34,35,36,1,38,40,39]},"version":"4.6.0-dev.20211126"}
package/lib/index.js CHANGED
@@ -15,6 +15,8 @@ import Performance from './modules/performance.js';
15
15
  import Scroll from './modules/scroll.js';
16
16
  import Viewport from './modules/viewport.js';
17
17
  import CSSRules from './modules/cssrules.js';
18
+ import Focus from './modules/focus.js';
19
+ import Fonts from './modules/fonts.js';
18
20
  import ConstructedStyleSheets from './modules/constructedStyleSheets.js';
19
21
  import { IN_BROWSER, deprecationWarn, DOCS_HOST } from './utils.js';
20
22
  const DOCS_SETUP = '/installation/setup-or';
@@ -105,6 +107,8 @@ export default class API {
105
107
  Timing(app, options);
106
108
  Performance(app, options);
107
109
  Scroll(app);
110
+ Focus(app);
111
+ Fonts(app);
108
112
  window.__OPENREPLAY__ = this;
109
113
  if (options.autoResetOnWindowOpen) {
110
114
  const wOpen = window.open;
@@ -129,7 +133,7 @@ export default class API {
129
133
  // no-cors issue only with text/plain or not-set Content-Type
130
134
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
131
135
  req.send(JSON.stringify({
132
- trackerVersion: '4.1.6',
136
+ trackerVersion: '4.1.7',
133
137
  projectKey: options.projectKey,
134
138
  doNotTrack,
135
139
  // TODO: add precise reason (an exact API missing)
@@ -1,4 +1,4 @@
1
- import { TechnicalInfo, AdoptedSSReplaceURLBased, AdoptedSSInsertRuleURLBased, AdoptedSSAddOwner, AdoptedSSRemoveOwner, } from '../app/messages.gen.js';
1
+ import { AdoptedSSReplaceURLBased, AdoptedSSInsertRuleURLBased, AdoptedSSAddOwner, AdoptedSSRemoveOwner, } from '../app/messages.gen.js';
2
2
  import { isRootNode } from '../app/guards.js';
3
3
  function hasAdoptedSS(node) {
4
4
  return (isRootNode(node) &&
@@ -16,10 +16,6 @@ export default function (app) {
16
16
  return;
17
17
  }
18
18
  if (!hasAdoptedSS(document)) {
19
- app.attachStartCallback(() => {
20
- // MBTODO: pre-start sendQueue app
21
- app.send(TechnicalInfo('no_adopted_stylesheets', ''));
22
- });
23
19
  return;
24
20
  }
25
21
  const styleSheetIDMap = new Map();
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,42 @@
1
+ import { isNode, hasTag } from '../app/guards.js';
2
+ import { SetNodeFocus } from '../app/messages.gen.js';
3
+ export default function (app) {
4
+ function sendSetNodeFocus(n) {
5
+ const id = app.nodes.getID(n);
6
+ if (id !== undefined) {
7
+ app.send(SetNodeFocus(id));
8
+ }
9
+ }
10
+ let blurred = false;
11
+ app.nodes.attachNodeCallback((node) => {
12
+ if (!hasTag(node, 'BODY')) {
13
+ return;
14
+ }
15
+ app.nodes.attachNodeListener(node, 'focus', (e) => {
16
+ if (!isNode(e.target)) {
17
+ return;
18
+ }
19
+ sendSetNodeFocus(e.target);
20
+ blurred = false;
21
+ });
22
+ app.nodes.attachNodeListener(node, 'blur', (e) => {
23
+ if (e.relatedTarget === null) {
24
+ blurred = true;
25
+ setTimeout(() => {
26
+ if (blurred) {
27
+ app.send(SetNodeFocus(-1));
28
+ }
29
+ }, 0);
30
+ }
31
+ });
32
+ });
33
+ app.attachStartCallback(() => {
34
+ let elem = document.activeElement;
35
+ while (elem && hasTag(elem, 'IFRAME') && elem.contentDocument) {
36
+ elem = elem.contentDocument.activeElement;
37
+ }
38
+ if (elem && elem !== elem.ownerDocument.body) {
39
+ sendSetNodeFocus(elem);
40
+ }
41
+ }, true);
42
+ }
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,54 @@
1
+ import { isDocument } from '../app/guards.js';
2
+ import { LoadFontFace } from '../app/messages.gen.js';
3
+ export default function (app) {
4
+ if (!window.FontFace) {
5
+ return;
6
+ }
7
+ const docFonts = new Map();
8
+ const patchWindow = (wnd) => {
9
+ class FontFaceInterceptor extends wnd.FontFace {
10
+ constructor(...args) {
11
+ //maybe do this on load(). In this case check if the document.fonts.load(...) function calls the font's load()
12
+ if (typeof args[1] === 'string') {
13
+ let desc = '';
14
+ if (args[2]) {
15
+ app.safe(() => {
16
+ desc = JSON.stringify(args[2]);
17
+ });
18
+ }
19
+ const ffData = [args[0], args[1], desc];
20
+ const ffDataArr = docFonts.get(wnd.document) || [];
21
+ ffDataArr.push(ffData);
22
+ docFonts.set(wnd.document, ffDataArr);
23
+ const parentID = wnd === window ? 0 : app.nodes.getID(wnd.document);
24
+ if (parentID === undefined) {
25
+ return;
26
+ }
27
+ if (app.active()) {
28
+ app.send(LoadFontFace(parentID, ...ffData));
29
+ }
30
+ }
31
+ super(...args);
32
+ }
33
+ }
34
+ wnd.FontFace = FontFaceInterceptor;
35
+ };
36
+ app.observer.attachContextCallback(patchWindow);
37
+ patchWindow(window);
38
+ app.nodes.attachNodeCallback((node) => {
39
+ if (!isDocument(node)) {
40
+ return;
41
+ }
42
+ const ffDataArr = docFonts.get(node);
43
+ if (!ffDataArr) {
44
+ return;
45
+ }
46
+ const parentID = node.defaultView === window ? 0 : app.nodes.getID(node);
47
+ if (parentID === undefined) {
48
+ return;
49
+ }
50
+ ffDataArr.forEach((ffData) => {
51
+ app.send(LoadFontFace(parentID, ...ffData));
52
+ });
53
+ });
54
+ }
package/lib/utils.js CHANGED
@@ -2,6 +2,15 @@ const DEPRECATED_ATTRS = { htmlmasked: 'hidden', masked: 'obscured' };
2
2
  export const IN_BROWSER = !(typeof window === 'undefined');
3
3
  export const IS_FIREFOX = IN_BROWSER && navigator.userAgent.match(/firefox|fxios/i);
4
4
  export const MAX_STR_LEN = 1e5;
5
+ // TODO: time adjustment
6
+ // // Bad to use `performance.timeOrigin || performance.timing.navigationStart`
7
+ // // https://github.com/mdn/content/issues/4713
8
+ // const timeOrigin: number | false =
9
+ // IN_BROWSER && (Date.now() - performance.now())
10
+ // export const now: () => number =
11
+ // IN_BROWSER && timeOrigin && !!performance.now
12
+ // ? () => Math.round(performance.now() + timeOrigin)
13
+ // : () => Date.now()
5
14
  const navigationStart = IN_BROWSER && (performance.timing.navigationStart || performance.timeOrigin);
6
15
  // performance.now() is buggy in some browsers
7
16
  export const now = IN_BROWSER && performance.now() && navigationStart
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": "4.1.7-beta.1",
4
+ "version": "4.1.7",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"