@openreplay/tracker 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/app/guards.d.ts +1 -0
- package/cjs/app/guards.js +6 -1
- package/cjs/app/index.d.ts +1 -1
- package/cjs/app/index.js +16 -10
- package/cjs/app/messages.gen.d.ts +1 -0
- package/cjs/app/messages.gen.js +10 -1
- package/cjs/app/nodes.d.ts +1 -1
- package/cjs/app/nodes.js +3 -5
- package/cjs/app/observer/iframe_observer.js +1 -0
- package/cjs/app/observer/iframe_offsets.d.ts +8 -0
- package/cjs/app/observer/iframe_offsets.js +59 -0
- package/cjs/app/observer/observer.js +4 -4
- package/cjs/app/observer/top_observer.d.ts +2 -4
- package/cjs/app/observer/top_observer.js +11 -21
- package/cjs/app/sanitizer.d.ts +10 -4
- package/cjs/app/sanitizer.js +33 -15
- package/cjs/app/session.js +1 -1
- package/cjs/common/messages.gen.d.ts +8 -2
- package/cjs/common/messages.gen.js +1 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +7 -7
- package/cjs/modules/constructedStyleSheets.d.ts +4 -0
- package/cjs/modules/{adoptedStyleSheets.js → constructedStyleSheets.js} +21 -20
- package/cjs/modules/cssrules.js +65 -18
- package/cjs/modules/img.js +27 -19
- package/cjs/modules/input.js +2 -2
- package/cjs/modules/mouse.js +11 -7
- package/cjs/modules/scroll.js +32 -12
- package/cjs/utils.d.ts +5 -3
- package/cjs/utils.js +18 -13
- package/lib/app/guards.d.ts +1 -0
- package/lib/app/guards.js +4 -0
- package/lib/app/index.d.ts +1 -1
- package/lib/app/index.js +16 -10
- package/lib/app/messages.gen.d.ts +1 -0
- package/lib/app/messages.gen.js +8 -0
- package/lib/app/nodes.d.ts +1 -1
- package/lib/app/nodes.js +3 -5
- package/lib/app/observer/iframe_observer.js +1 -0
- package/lib/app/observer/iframe_offsets.d.ts +8 -0
- package/lib/app/observer/iframe_offsets.js +56 -0
- package/lib/app/observer/observer.js +4 -4
- package/lib/app/observer/top_observer.d.ts +2 -4
- package/lib/app/observer/top_observer.js +11 -21
- package/lib/app/sanitizer.d.ts +10 -4
- package/lib/app/sanitizer.js +32 -15
- package/lib/app/session.js +1 -1
- package/lib/common/messages.gen.d.ts +8 -2
- package/lib/common/messages.gen.js +1 -0
- package/lib/common/tsconfig.tsbuildinfo +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +5 -6
- package/lib/modules/constructedStyleSheets.d.ts +4 -0
- package/lib/modules/{adoptedStyleSheets.js → constructedStyleSheets.js} +20 -21
- package/lib/modules/cssrules.js +67 -19
- package/lib/modules/img.js +28 -20
- package/lib/modules/input.js +3 -3
- package/lib/modules/mouse.js +11 -7
- package/lib/modules/scroll.js +33 -13
- package/lib/utils.d.ts +5 -3
- package/lib/utils.js +17 -11
- package/package.json +1 -1
- package/cjs/modules/adoptedStyleSheets.d.ts +0 -2
- package/lib/modules/adoptedStyleSheets.d.ts +0 -2
package/lib/app/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export default class App {
|
|
|
29
29
|
this.stopCallbacks = [];
|
|
30
30
|
this.commitCallbacks = [];
|
|
31
31
|
this.activityState = ActivityState.NotActive;
|
|
32
|
-
this.version = '4.0.
|
|
32
|
+
this.version = '4.0.2'; // TODO: version compatability check inside each plugin.
|
|
33
33
|
this.projectKey = projectKey;
|
|
34
34
|
this.options = Object.assign({
|
|
35
35
|
revID: '',
|
|
@@ -71,17 +71,17 @@ export default class App {
|
|
|
71
71
|
this.session.applySessionHash(sessionToken);
|
|
72
72
|
}
|
|
73
73
|
try {
|
|
74
|
-
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():(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])}}}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!==
|
|
74
|
+
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():(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])}}}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!==f&&(clearInterval(f),f=null),h&&(h.clean(),h=null),r&&(r.clean(),r=null),n.NotActive}function o(){self.postMessage("restart"),a()}n.NotActive;let c,f=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()},()=>{self.postMessage("failed"),a()},i.connAttemptCount,i.connAttemptGap),h=new e(i.pageNo,i.timestamp,i.url,t=>r&&r.push(t)),null===f&&(f=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' })));
|
|
75
75
|
this.worker.onerror = (e) => {
|
|
76
76
|
this._debug('webworker_error', e);
|
|
77
77
|
};
|
|
78
78
|
this.worker.onmessage = ({ data }) => {
|
|
79
79
|
if (data === 'failed') {
|
|
80
|
-
this.stop();
|
|
80
|
+
this.stop(false);
|
|
81
81
|
this._debug('worker_failed', {}); // add context (from worker)
|
|
82
82
|
}
|
|
83
83
|
else if (data === 'restart') {
|
|
84
|
-
this.stop();
|
|
84
|
+
this.stop(false);
|
|
85
85
|
this.start({ forceNew: true });
|
|
86
86
|
}
|
|
87
87
|
};
|
|
@@ -150,8 +150,6 @@ export default class App {
|
|
|
150
150
|
}; // TODO: correct typing
|
|
151
151
|
}
|
|
152
152
|
attachCommitCallback(cb) {
|
|
153
|
-
// TODO!: what if start callback added when activityState === Active ?
|
|
154
|
-
// For example - attachEventListener() called during dynamic <iframe> appearance
|
|
155
153
|
this.commitCallbacks.push(cb);
|
|
156
154
|
}
|
|
157
155
|
attachStartCallback(cb, useSafe = false) {
|
|
@@ -166,6 +164,7 @@ export default class App {
|
|
|
166
164
|
}
|
|
167
165
|
this.stopCallbacks.push(cb);
|
|
168
166
|
}
|
|
167
|
+
// Use app.nodes.attachNodeListener for registered nodes instead
|
|
169
168
|
attachEventListener(target, type, listener, useSafe = true, useCapture = true) {
|
|
170
169
|
if (useSafe) {
|
|
171
170
|
listener = this.safe(listener);
|
|
@@ -217,7 +216,7 @@ export default class App {
|
|
|
217
216
|
return this.options.ingestPoint.replace(/ingest$/, `${projectID}/session/${sessionID}`);
|
|
218
217
|
}
|
|
219
218
|
getHost() {
|
|
220
|
-
return new URL(this.options.ingestPoint).
|
|
219
|
+
return new URL(this.options.ingestPoint).host;
|
|
221
220
|
}
|
|
222
221
|
getProjectKey() {
|
|
223
222
|
return this.projectKey;
|
|
@@ -288,14 +287,15 @@ export default class App {
|
|
|
288
287
|
});
|
|
289
288
|
const sReset = this.sessionStorage.getItem(this.options.session_reset_key);
|
|
290
289
|
this.sessionStorage.removeItem(this.options.session_reset_key);
|
|
290
|
+
const shouldReset = startOpts.forceNew || sReset !== null;
|
|
291
291
|
return window
|
|
292
292
|
.fetch(this.options.ingestPoint + '/v1/web/start', {
|
|
293
293
|
method: 'POST',
|
|
294
294
|
headers: {
|
|
295
295
|
'Content-Type': 'application/json',
|
|
296
296
|
},
|
|
297
|
-
body: JSON.stringify(Object.assign(Object.assign({}, this.getTrackerInfo()), { timestamp, userID: this.session.getInfo().userID, token: this.session.getSessionToken(), deviceMemory,
|
|
298
|
-
jsHeapSizeLimit
|
|
297
|
+
body: JSON.stringify(Object.assign(Object.assign({}, this.getTrackerInfo()), { timestamp, userID: this.session.getInfo().userID, token: shouldReset ? undefined : this.session.getSessionToken(), deviceMemory,
|
|
298
|
+
jsHeapSizeLimit })),
|
|
299
299
|
})
|
|
300
300
|
.then((r) => {
|
|
301
301
|
if (r.status === 200) {
|
|
@@ -313,6 +313,9 @@ export default class App {
|
|
|
313
313
|
if (!this.worker) {
|
|
314
314
|
return Promise.reject('no worker found after start request (this might not happen)');
|
|
315
315
|
}
|
|
316
|
+
if (this.activityState === ActivityState.NotActive) {
|
|
317
|
+
return Promise.reject('Tracker stopped during authorisation');
|
|
318
|
+
}
|
|
316
319
|
const { token, userUUID, sessionID, projectID, beaconSizeLimit, startTimestamp, // real startTS, derived from sessionID
|
|
317
320
|
} = r;
|
|
318
321
|
if (typeof token !== 'string' ||
|
|
@@ -322,9 +325,12 @@ export default class App {
|
|
|
322
325
|
(typeof beaconSizeLimit !== 'number' && typeof beaconSizeLimit !== 'undefined')) {
|
|
323
326
|
return Promise.reject(`Incorrect server response: ${JSON.stringify(r)}`);
|
|
324
327
|
}
|
|
328
|
+
if (sessionID !== this.session.getInfo().sessionID) {
|
|
329
|
+
this.session.reset();
|
|
330
|
+
}
|
|
325
331
|
this.session.setSessionToken(token);
|
|
326
|
-
this.localStorage.setItem(this.options.local_uuid_key, userUUID);
|
|
327
332
|
this.session.update({ sessionID, timestamp: startTimestamp || timestamp, projectID }); // TODO: no no-explicit 'any'
|
|
333
|
+
this.localStorage.setItem(this.options.local_uuid_key, userUUID);
|
|
328
334
|
const startWorkerMsg = {
|
|
329
335
|
type: 'auth',
|
|
330
336
|
token,
|
|
@@ -55,3 +55,4 @@ export declare function AdoptedSSInsertRuleURLBased(sheetID: number, rule: strin
|
|
|
55
55
|
export declare function AdoptedSSDeleteRule(sheetID: number, index: number): Messages.AdoptedSSDeleteRule;
|
|
56
56
|
export declare function AdoptedSSAddOwner(sheetID: number, id: number): Messages.AdoptedSSAddOwner;
|
|
57
57
|
export declare function AdoptedSSRemoveOwner(sheetID: number, id: number): Messages.AdoptedSSRemoveOwner;
|
|
58
|
+
export declare function Zustand(mutation: string, state: string): Messages.Zustand;
|
package/lib/app/messages.gen.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Auto-generated, do not edit
|
|
2
|
+
/* eslint-disable */
|
|
2
3
|
export function BatchMetadata(version, pageNo, firstIndex, timestamp, location) {
|
|
3
4
|
return [
|
|
4
5
|
81 /* BatchMetadata */,
|
|
@@ -432,3 +433,10 @@ export function AdoptedSSRemoveOwner(sheetID, id) {
|
|
|
432
433
|
id,
|
|
433
434
|
];
|
|
434
435
|
}
|
|
436
|
+
export function Zustand(mutation, state) {
|
|
437
|
+
return [
|
|
438
|
+
79 /* Zustand */,
|
|
439
|
+
mutation,
|
|
440
|
+
state,
|
|
441
|
+
];
|
|
442
|
+
}
|
package/lib/app/nodes.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export default class Nodes {
|
|
|
6
6
|
private readonly elementListeners;
|
|
7
7
|
constructor(node_id: string);
|
|
8
8
|
attachNodeCallback(nodeCallback: NodeCallback): void;
|
|
9
|
-
|
|
9
|
+
attachNodeListener(node: Node, type: string, listener: EventListener): void;
|
|
10
10
|
registerNode(node: Node): [/*id:*/ number, /*isNew:*/ boolean];
|
|
11
11
|
unregisterNode(node: Node): number | undefined;
|
|
12
12
|
cleanTree(): void;
|
package/lib/app/nodes.js
CHANGED
|
@@ -9,20 +9,18 @@ export default class Nodes {
|
|
|
9
9
|
attachNodeCallback(nodeCallback) {
|
|
10
10
|
this.nodeCallbacks.push(nodeCallback);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
attachElementListener(type, node, elementListener) {
|
|
12
|
+
attachNodeListener(node, type, listener) {
|
|
14
13
|
const id = this.getID(node);
|
|
15
14
|
if (id === undefined) {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
|
-
node.addEventListener(type,
|
|
17
|
+
node.addEventListener(type, listener);
|
|
19
18
|
let listeners = this.elementListeners.get(id);
|
|
20
19
|
if (listeners === undefined) {
|
|
21
20
|
listeners = [];
|
|
22
21
|
this.elementListeners.set(id, listeners);
|
|
23
|
-
return;
|
|
24
22
|
}
|
|
25
|
-
listeners.push([type,
|
|
23
|
+
listeners.push([type, listener]);
|
|
26
24
|
}
|
|
27
25
|
registerNode(node) {
|
|
28
26
|
let id = node[this.node_id];
|
|
@@ -9,6 +9,7 @@ export default class IFrameObserver extends Observer {
|
|
|
9
9
|
} //log TODO common app.logger
|
|
10
10
|
// Have to observe document, because the inner <html> might be changed
|
|
11
11
|
this.observeRoot(doc, (docID) => {
|
|
12
|
+
//MBTODO: do not send if empty (send on load? it might be in-place iframe, like our replayer, which does not get loaded)
|
|
12
13
|
if (docID === undefined) {
|
|
13
14
|
console.log('OpenReplay: Iframe document not bound');
|
|
14
15
|
return;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Le truc - for defining an absolute offset for (nested) iframe documents. (To track mouse movments)
|
|
2
|
+
export default class IFrameOffsets {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.states = new Map();
|
|
5
|
+
}
|
|
6
|
+
calcOffset(state) {
|
|
7
|
+
let parLeft = 0, parTop = 0;
|
|
8
|
+
if (state.parent) {
|
|
9
|
+
;
|
|
10
|
+
[parLeft, parTop] = this.calcOffset(state.parent);
|
|
11
|
+
}
|
|
12
|
+
if (!state.offset) {
|
|
13
|
+
const { left, top } = state.iFrame.getBoundingClientRect();
|
|
14
|
+
state.offset = [left, top];
|
|
15
|
+
}
|
|
16
|
+
const [left, top] = state.offset;
|
|
17
|
+
return [parLeft + left, parTop + top]; // TODO: store absolute sum, invalidate whole subtree. Otherwise it is summated on each mousemove
|
|
18
|
+
}
|
|
19
|
+
getDocumentOffset(doc) {
|
|
20
|
+
const state = this.states.get(doc);
|
|
21
|
+
if (!state) {
|
|
22
|
+
return [0, 0];
|
|
23
|
+
} // topmost doc
|
|
24
|
+
return this.calcOffset(state);
|
|
25
|
+
}
|
|
26
|
+
observe(iFrame) {
|
|
27
|
+
var _a;
|
|
28
|
+
const doc = iFrame.contentDocument;
|
|
29
|
+
if (!doc) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const parentDoc = iFrame.ownerDocument;
|
|
33
|
+
const parentState = this.states.get(parentDoc);
|
|
34
|
+
const state = {
|
|
35
|
+
offset: null,
|
|
36
|
+
iFrame,
|
|
37
|
+
parent: parentState || null,
|
|
38
|
+
clear: () => {
|
|
39
|
+
var _a;
|
|
40
|
+
parentDoc.removeEventListener('scroll', invalidateOffset);
|
|
41
|
+
(_a = parentDoc.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('resize', invalidateOffset);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const invalidateOffset = () => {
|
|
45
|
+
state.offset = null;
|
|
46
|
+
};
|
|
47
|
+
// anything more reliable? This does not cover all cases (layout changes are ignored, for ex.)
|
|
48
|
+
parentDoc.addEventListener('scroll', invalidateOffset);
|
|
49
|
+
(_a = parentDoc.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('resize', invalidateOffset);
|
|
50
|
+
this.states.set(doc, state);
|
|
51
|
+
}
|
|
52
|
+
clear() {
|
|
53
|
+
this.states.forEach((s) => s.clear());
|
|
54
|
+
this.states.clear();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -221,7 +221,7 @@ export default class Observer {
|
|
|
221
221
|
return false;
|
|
222
222
|
}
|
|
223
223
|
this.app.sanitizer.handleNode(id, parentID, node);
|
|
224
|
-
if (this.app.sanitizer.
|
|
224
|
+
if (this.app.sanitizer.isHidden(parentID)) {
|
|
225
225
|
return false;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -249,12 +249,12 @@ export default class Observer {
|
|
|
249
249
|
if (isElementNode(node)) {
|
|
250
250
|
let el = node;
|
|
251
251
|
if (parentID !== undefined) {
|
|
252
|
-
if (this.app.sanitizer.
|
|
252
|
+
if (this.app.sanitizer.isHidden(id)) {
|
|
253
253
|
const width = el.clientWidth;
|
|
254
254
|
const height = el.clientHeight;
|
|
255
255
|
el = node.cloneNode();
|
|
256
|
-
el.style.width = width
|
|
257
|
-
el.style.height = height
|
|
256
|
+
el.style.width = `${width}px`;
|
|
257
|
+
el.style.height = `${height}px`;
|
|
258
258
|
}
|
|
259
259
|
this.app.send(CreateElementNode(id, parentID, index, el.tagName, isSVGElement(node)));
|
|
260
260
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import Observer from './observer.js';
|
|
2
|
+
import { Offset } from './iframe_offsets.js';
|
|
2
3
|
import App from '../index.js';
|
|
3
4
|
export interface Options {
|
|
4
5
|
captureIFrames: boolean;
|
|
5
6
|
}
|
|
6
7
|
declare type Context = Window & typeof globalThis;
|
|
7
8
|
declare type ContextCallback = (context: Context) => void;
|
|
8
|
-
declare type Offset = {
|
|
9
|
-
top: number;
|
|
10
|
-
left: number;
|
|
11
|
-
};
|
|
12
9
|
export default class TopObserver extends Observer {
|
|
13
10
|
private readonly options;
|
|
11
|
+
private readonly iframeOffsets;
|
|
14
12
|
constructor(app: App, options: Partial<Options>);
|
|
15
13
|
private readonly contextCallbacks;
|
|
16
14
|
private readonly contextsSet;
|
|
@@ -2,16 +2,14 @@ import Observer from './observer.js';
|
|
|
2
2
|
import { isElementNode, hasTag } from '../guards.js';
|
|
3
3
|
import IFrameObserver from './iframe_observer.js';
|
|
4
4
|
import ShadowRootObserver from './shadow_root_observer.js';
|
|
5
|
+
import IFrameOffsets from './iframe_offsets.js';
|
|
5
6
|
import { CreateDocument } from '../messages.gen.js';
|
|
6
7
|
import { IN_BROWSER, hasOpenreplayAttribute } from '../../utils.js';
|
|
7
|
-
function isPatchedDocument(doc) {
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
return typeof doc.__openreplay__getOffset === 'function';
|
|
10
|
-
}
|
|
11
8
|
const attachShadowNativeFn = IN_BROWSER ? Element.prototype.attachShadow : () => new ShadowRoot();
|
|
12
9
|
export default class TopObserver extends Observer {
|
|
13
10
|
constructor(app, options) {
|
|
14
11
|
super(app, true);
|
|
12
|
+
this.iframeOffsets = new IFrameOffsets();
|
|
15
13
|
this.contextCallbacks = [];
|
|
16
14
|
// Attached once per Tracker instance
|
|
17
15
|
this.contextsSet = new Set();
|
|
@@ -38,17 +36,14 @@ export default class TopObserver extends Observer {
|
|
|
38
36
|
attachContextCallback(cb) {
|
|
39
37
|
this.contextCallbacks.push(cb);
|
|
40
38
|
}
|
|
41
|
-
// Le truc
|
|
42
39
|
getDocumentOffset(doc) {
|
|
43
|
-
|
|
44
|
-
return doc.__openreplay__getOffset();
|
|
45
|
-
}
|
|
46
|
-
return { top: 0, left: 0 };
|
|
40
|
+
return this.iframeOffsets.getDocumentOffset(doc);
|
|
47
41
|
}
|
|
48
42
|
handleIframe(iframe) {
|
|
49
43
|
let doc = null;
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
// setTimeout is required. Otherwise some event listeners (scroll, mousemove) applied in modules
|
|
45
|
+
// do not work on the iframe document when it 've been loaded dynamically ((why?))
|
|
46
|
+
const handle = this.app.safe(() => setTimeout(() => {
|
|
52
47
|
const id = this.app.nodes.getID(iframe);
|
|
53
48
|
if (id === undefined) {
|
|
54
49
|
//log
|
|
@@ -59,27 +54,21 @@ export default class TopObserver extends Observer {
|
|
|
59
54
|
if (currentDoc && currentDoc !== doc) {
|
|
60
55
|
const observer = new IFrameObserver(this.app);
|
|
61
56
|
this.iframeObservers.push(observer);
|
|
62
|
-
observer.observe(iframe);
|
|
57
|
+
observer.observe(iframe); // TODO: call unregisterNode for the previous doc if present (incapsulate: one iframe - one observer)
|
|
63
58
|
doc = currentDoc;
|
|
64
|
-
|
|
65
|
-
const { top, left } = this.getDocumentOffset(iframe.ownerDocument);
|
|
66
|
-
return {
|
|
67
|
-
top: iframe.offsetTop + top,
|
|
68
|
-
left: iframe.offsetLeft + left,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
59
|
+
this.iframeOffsets.observe(iframe);
|
|
71
60
|
}
|
|
72
61
|
if (currentWin &&
|
|
73
62
|
// Sometimes currentWin.window is null (not in specification). Such window object is not functional
|
|
74
63
|
currentWin === currentWin.window &&
|
|
75
64
|
!this.contextsSet.has(currentWin) // for each context callbacks called once per Tracker (TopObserver) instance
|
|
65
|
+
//TODO: more explicit logic
|
|
76
66
|
) {
|
|
77
67
|
this.contextsSet.add(currentWin);
|
|
78
68
|
//@ts-ignore https://github.com/microsoft/TypeScript/issues/41684
|
|
79
69
|
this.contextCallbacks.forEach((cb) => cb(currentWin));
|
|
80
|
-
win = currentWin;
|
|
81
70
|
}
|
|
82
|
-
});
|
|
71
|
+
}, 0));
|
|
83
72
|
iframe.addEventListener('load', handle); // why app.attachEventListener not working?
|
|
84
73
|
handle();
|
|
85
74
|
}
|
|
@@ -108,6 +97,7 @@ export default class TopObserver extends Observer {
|
|
|
108
97
|
}, window.document.documentElement);
|
|
109
98
|
}
|
|
110
99
|
disconnect() {
|
|
100
|
+
this.iframeOffsets.clear();
|
|
111
101
|
Element.prototype.attachShadow = attachShadowNativeFn;
|
|
112
102
|
this.iframeObservers.forEach((o) => o.disconnect());
|
|
113
103
|
this.iframeObservers = [];
|
package/lib/app/sanitizer.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import type App from './index.js';
|
|
2
|
+
export declare enum SanitizeLevel {
|
|
3
|
+
Plain = 0,
|
|
4
|
+
Obscured = 1,
|
|
5
|
+
Hidden = 2
|
|
6
|
+
}
|
|
2
7
|
export interface Options {
|
|
3
8
|
obscureTextEmails: boolean;
|
|
4
9
|
obscureTextNumbers: boolean;
|
|
10
|
+
domSanitizer?: (node: Element) => SanitizeLevel;
|
|
5
11
|
}
|
|
6
12
|
export default class Sanitizer {
|
|
7
13
|
private readonly app;
|
|
8
|
-
private readonly
|
|
9
|
-
private readonly
|
|
14
|
+
private readonly obscured;
|
|
15
|
+
private readonly hidden;
|
|
10
16
|
private readonly options;
|
|
11
17
|
constructor(app: App, options: Partial<Options>);
|
|
12
18
|
handleNode(id: number, parentID: number, node: Node): void;
|
|
13
19
|
sanitize(id: number, data: string): string;
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
isObscured(id: number): boolean;
|
|
21
|
+
isHidden(id: number): boolean;
|
|
16
22
|
getInnerTextSecure(el: HTMLElement): string;
|
|
17
23
|
clear(): void;
|
|
18
24
|
}
|
package/lib/app/sanitizer.js
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
1
|
import { stars, hasOpenreplayAttribute } from '../utils.js';
|
|
2
2
|
import { isElementNode } from './guards.js';
|
|
3
|
+
export var SanitizeLevel;
|
|
4
|
+
(function (SanitizeLevel) {
|
|
5
|
+
SanitizeLevel[SanitizeLevel["Plain"] = 0] = "Plain";
|
|
6
|
+
SanitizeLevel[SanitizeLevel["Obscured"] = 1] = "Obscured";
|
|
7
|
+
SanitizeLevel[SanitizeLevel["Hidden"] = 2] = "Hidden";
|
|
8
|
+
})(SanitizeLevel || (SanitizeLevel = {}));
|
|
3
9
|
export default class Sanitizer {
|
|
4
10
|
constructor(app, options) {
|
|
5
11
|
this.app = app;
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
12
|
+
this.obscured = new Set();
|
|
13
|
+
this.hidden = new Set();
|
|
8
14
|
this.options = Object.assign({
|
|
9
15
|
obscureTextEmails: true,
|
|
10
16
|
obscureTextNumbers: false,
|
|
11
17
|
}, options);
|
|
12
18
|
}
|
|
13
19
|
handleNode(id, parentID, node) {
|
|
14
|
-
if (this.
|
|
15
|
-
(isElementNode(node) &&
|
|
16
|
-
|
|
20
|
+
if (this.obscured.has(parentID) ||
|
|
21
|
+
(isElementNode(node) &&
|
|
22
|
+
(hasOpenreplayAttribute(node, 'masked') || hasOpenreplayAttribute(node, 'obscured')))) {
|
|
23
|
+
this.obscured.add(id);
|
|
17
24
|
}
|
|
18
|
-
if (this.
|
|
19
|
-
(isElementNode(node) &&
|
|
20
|
-
|
|
25
|
+
if (this.hidden.has(parentID) ||
|
|
26
|
+
(isElementNode(node) &&
|
|
27
|
+
(hasOpenreplayAttribute(node, 'htmlmasked') || hasOpenreplayAttribute(node, 'hidden')))) {
|
|
28
|
+
this.hidden.add(id);
|
|
29
|
+
}
|
|
30
|
+
if (this.options.domSanitizer !== undefined && isElementNode(node)) {
|
|
31
|
+
const sanitizeLevel = this.options.domSanitizer(node);
|
|
32
|
+
if (sanitizeLevel === SanitizeLevel.Obscured) {
|
|
33
|
+
this.obscured.add(id);
|
|
34
|
+
}
|
|
35
|
+
if (sanitizeLevel === SanitizeLevel.Hidden) {
|
|
36
|
+
this.hidden.add(id);
|
|
37
|
+
}
|
|
21
38
|
}
|
|
22
39
|
}
|
|
23
40
|
sanitize(id, data) {
|
|
24
|
-
if (this.
|
|
41
|
+
if (this.obscured.has(id)) {
|
|
25
42
|
// TODO: is it the best place to put trim() ? Might trimmed spaces be considered in layout in certain cases?
|
|
26
43
|
return data
|
|
27
44
|
.trim()
|
|
@@ -35,11 +52,11 @@ export default class Sanitizer {
|
|
|
35
52
|
}
|
|
36
53
|
return data;
|
|
37
54
|
}
|
|
38
|
-
|
|
39
|
-
return this.
|
|
55
|
+
isObscured(id) {
|
|
56
|
+
return this.obscured.has(id);
|
|
40
57
|
}
|
|
41
|
-
|
|
42
|
-
return this.
|
|
58
|
+
isHidden(id) {
|
|
59
|
+
return this.hidden.has(id);
|
|
43
60
|
}
|
|
44
61
|
getInnerTextSecure(el) {
|
|
45
62
|
const id = this.app.nodes.getID(el);
|
|
@@ -49,7 +66,7 @@ export default class Sanitizer {
|
|
|
49
66
|
return this.sanitize(id, el.innerText);
|
|
50
67
|
}
|
|
51
68
|
clear() {
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
69
|
+
this.obscured.clear();
|
|
70
|
+
this.hidden.clear();
|
|
54
71
|
}
|
|
55
72
|
}
|
package/lib/app/session.js
CHANGED
|
@@ -53,7 +53,8 @@ export declare const enum Type {
|
|
|
53
53
|
AdoptedSSInsertRuleURLBased = 73,
|
|
54
54
|
AdoptedSSDeleteRule = 75,
|
|
55
55
|
AdoptedSSAddOwner = 76,
|
|
56
|
-
AdoptedSSRemoveOwner = 77
|
|
56
|
+
AdoptedSSRemoveOwner = 77,
|
|
57
|
+
Zustand = 79
|
|
57
58
|
}
|
|
58
59
|
export declare type BatchMetadata = [
|
|
59
60
|
Type.BatchMetadata,
|
|
@@ -378,5 +379,10 @@ export declare type AdoptedSSRemoveOwner = [
|
|
|
378
379
|
number,
|
|
379
380
|
number
|
|
380
381
|
];
|
|
381
|
-
declare type
|
|
382
|
+
export declare type Zustand = [
|
|
383
|
+
Type.Zustand,
|
|
384
|
+
string,
|
|
385
|
+
string
|
|
386
|
+
];
|
|
387
|
+
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 | JSException | 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;
|
|
382
388
|
export default Message;
|