Socket
Socket
Sign inDemoInstall

@openreplay/tracker

Package Overview
Dependencies
Maintainers
3
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openreplay/tracker - npm Package Compare versions

Comparing version 3.5.12 to 3.5.13-beta.0

cjs/app/guards.d.ts

4

cjs/app/index.d.ts

@@ -47,2 +47,4 @@ import type Message from "../common/messages.js";

__debug__?: LoggerOptions;
localStorage: Storage;
sessionStorage: Storage;
onStart?: StartCallback;

@@ -60,2 +62,4 @@ } & WebworkerOptions;

readonly session: Session;
readonly localStorage: Storage;
readonly sessionStorage: Storage;
private readonly messages;

@@ -62,0 +66,0 @@ private readonly observer;

36

cjs/app/index.js

@@ -35,3 +35,3 @@ "use strict";

this.activityState = ActivityState.NotActive;
this.version = '3.5.12'; // TODO: version compatability check inside each plugin.
this.version = '3.5.13-beta.0'; // TODO: version compatability check inside each plugin.
this.projectKey = projectKey;

@@ -50,6 +50,5 @@ this.options = Object.assign({

__debug_report_edp: null,
localStorage: window.localStorage,
sessionStorage: window.sessionStorage,
}, options);
if (sessionToken != null) {
sessionStorage.setItem(this.options.session_token_key, sessionToken);
}
this.revID = this.options.revID;

@@ -64,2 +63,7 @@ this.sanitizer = new sanitizer_js_1.default(this, options);

this.session = new session_js_1.default(this);
this.localStorage = this.options.localStorage;
this.sessionStorage = this.options.sessionStorage;
if (sessionToken != null) {
this.sessionStorage.setItem(this.options.session_token_key, sessionToken);
}
try {

@@ -172,3 +176,3 @@ this.worker = new Worker(URL.createObjectURL(new Blob([`"use strict";function t(t){function i(...i){return new t(...i)}return i.prototype=t.prototype,i}const i=new Map;const s=t(class{constructor(t,i,s){this.pageNo=t,this.firstIndex=i,this.timestamp=s,this._id=80}encode(t){return t.uint(80)&&t.uint(this.pageNo)&&t.uint(this.firstIndex)&&t.int(this.timestamp)}});i.set(80,s);const e=t(class{constructor(t){this.timestamp=t,this._id=0}encode(t){return t.uint(0)&&t.uint(this.timestamp)}});i.set(0,e);const n=t(class{constructor(t,i,s){this.url=t,this.referrer=i,this.navigationStart=s,this._id=4}encode(t){return t.uint(4)&&t.string(this.url)&&t.string(this.referrer)&&t.uint(this.navigationStart)}});i.set(4,n);const r=t(class{constructor(t,i){this.width=t,this.height=i,this._id=5}encode(t){return t.uint(5)&&t.uint(this.width)&&t.uint(this.height)}});i.set(5,r);const h=t(class{constructor(t,i){this.x=t,this.y=i,this._id=6}encode(t){return t.uint(6)&&t.int(this.x)&&t.int(this.y)}});i.set(6,h);const o=t(class{constructor(){this._id=7}encode(t){return t.uint(7)}});i.set(7,o);const c=t(class{constructor(t,i,s,e,n){this.id=t,this.parentID=i,this.index=s,this.tag=e,this.svg=n,this._id=8}encode(t){return t.uint(8)&&t.uint(this.id)&&t.uint(this.parentID)&&t.uint(this.index)&&t.string(this.tag)&&t.boolean(this.svg)}});i.set(8,c);const a=t(class{constructor(t,i,s){this.id=t,this.parentID=i,this.index=s,this._id=9}encode(t){return t.uint(9)&&t.uint(this.id)&&t.uint(this.parentID)&&t.uint(this.index)}});i.set(9,a);const u=t(class{constructor(t,i,s){this.id=t,this.parentID=i,this.index=s,this._id=10}encode(t){return t.uint(10)&&t.uint(this.id)&&t.uint(this.parentID)&&t.uint(this.index)}});i.set(10,u);const d=t(class{constructor(t){this.id=t,this._id=11}encode(t){return t.uint(11)&&t.uint(this.id)}});i.set(11,d);const l=t(class{constructor(t,i,s){this.id=t,this.name=i,this.value=s,this._id=12}encode(t){return t.uint(12)&&t.uint(this.id)&&t.string(this.name)&&t.string(this.value)}});i.set(12,l);const p=t(class{constructor(t,i){this.id=t,this.name=i,this._id=13}encode(t){return t.uint(13)&&t.uint(this.id)&&t.string(this.name)}});i.set(13,p);const m=t(class{constructor(t,i){this.id=t,this.data=i,this._id=14}encode(t){return t.uint(14)&&t.uint(this.id)&&t.string(this.data)}});i.set(14,m);const g=t(class{constructor(t,i,s){this.id=t,this.x=i,this.y=s,this._id=16}encode(t){return t.uint(16)&&t.uint(this.id)&&t.int(this.x)&&t.int(this.y)}});i.set(16,g);const f=t(class{constructor(t,i){this.id=t,this.label=i,this._id=17}encode(t){return t.uint(17)&&t.uint(this.id)&&t.string(this.label)}});i.set(17,f);const y=t(class{constructor(t,i,s){this.id=t,this.value=i,this.mask=s,this._id=18}encode(t){return t.uint(18)&&t.uint(this.id)&&t.string(this.value)&&t.int(this.mask)}});i.set(18,y);const _=t(class{constructor(t,i){this.id=t,this.checked=i,this._id=19}encode(t){return t.uint(19)&&t.uint(this.id)&&t.boolean(this.checked)}});i.set(19,_);const v=t(class{constructor(t,i){this.x=t,this.y=i,this._id=20}encode(t){return t.uint(20)&&t.uint(this.x)&&t.uint(this.y)}});i.set(20,v);const b=t(class{constructor(t,i){this.level=t,this.value=i,this._id=22}encode(t){return t.uint(22)&&t.string(this.level)&&t.string(this.value)}});i.set(22,b);const S=t(class{constructor(t,i,s,e,n,r,h,o,c){this.requestStart=t,this.responseStart=i,this.responseEnd=s,this.domContentLoadedEventStart=e,this.domContentLoadedEventEnd=n,this.loadEventStart=r,this.loadEventEnd=h,this.firstPaint=o,this.firstContentfulPaint=c,this._id=23}encode(t){return t.uint(23)&&t.uint(this.requestStart)&&t.uint(this.responseStart)&&t.uint(this.responseEnd)&&t.uint(this.domContentLoadedEventStart)&&t.uint(this.domContentLoadedEventEnd)&&t.uint(this.loadEventStart)&&t.uint(this.loadEventEnd)&&t.uint(this.firstPaint)&&t.uint(this.firstContentfulPaint)}});i.set(23,S);const w=t(class{constructor(t,i,s){this.speedIndex=t,this.visuallyComplete=i,this.timeToInteractive=s,this._id=24}encode(t){return t.uint(24)&&t.uint(this.speedIndex)&&t.uint(this.visuallyComplete)&&t.uint(this.timeToInteractive)}});i.set(24,w);const E=t(class{constructor(t,i,s){this.name=t,this.message=i,this.payload=s,this._id=25}encode(t){return t.uint(25)&&t.string(this.name)&&t.string(this.message)&&t.string(this.payload)}});i.set(25,E);const x=t(class{constructor(t,i){this.name=t,this.payload=i,this._id=27}encode(t){return t.uint(27)&&t.string(this.name)&&t.string(this.payload)}});i.set(27,x);const T=t(class{constructor(t){this.id=t,this._id=28}encode(t){return t.uint(28)&&t.string(this.id)}});i.set(28,T);const z=t(class{constructor(t){this.id=t,this._id=29}encode(t){return t.uint(29)&&t.string(this.id)}});i.set(29,z);const k=t(class{constructor(t,i){this.key=t,this.value=i,this._id=30}encode(t){return t.uint(30)&&t.string(this.key)&&t.string(this.value)}});i.set(30,k);const I=t(class{constructor(t,i,s){this.id=t,this.rule=i,this.index=s,this._id=37}encode(t){return t.uint(37)&&t.uint(this.id)&&t.string(this.rule)&&t.uint(this.index)}});i.set(37,I);const M=t(class{constructor(t,i){this.id=t,this.index=i,this._id=38}encode(t){return t.uint(38)&&t.uint(this.id)&&t.uint(this.index)}});i.set(38,M);const B=t(class{constructor(t,i,s,e,n,r,h){this.method=t,this.url=i,this.request=s,this.response=e,this.status=n,this.timestamp=r,this.duration=h,this._id=39}encode(t){return t.uint(39)&&t.string(this.method)&&t.string(this.url)&&t.string(this.request)&&t.string(this.response)&&t.uint(this.status)&&t.uint(this.timestamp)&&t.uint(this.duration)}});i.set(39,B);const L=t(class{constructor(t,i,s,e){this.name=t,this.duration=i,this.args=s,this.result=e,this._id=40}encode(t){return t.uint(40)&&t.string(this.name)&&t.uint(this.duration)&&t.string(this.args)&&t.string(this.result)}});i.set(40,L);const C=t(class{constructor(t,i){this.key=t,this.value=i,this._id=41}encode(t){return t.uint(41)&&t.string(this.key)&&t.string(this.value)}});i.set(41,C);const A=t(class{constructor(t){this.type=t,this._id=42}encode(t){return t.uint(42)&&t.string(this.type)}});i.set(42,A);const U=t(class{constructor(t,i,s){this.action=t,this.state=i,this.duration=s,this._id=44}encode(t){return t.uint(44)&&t.string(this.action)&&t.string(this.state)&&t.uint(this.duration)}});i.set(44,U);const N=t(class{constructor(t,i){this.mutation=t,this.state=i,this._id=45}encode(t){return t.uint(45)&&t.string(this.mutation)&&t.string(this.state)}});i.set(45,N);const R=t(class{constructor(t,i){this.type=t,this.payload=i,this._id=46}encode(t){return t.uint(46)&&t.string(this.type)&&t.string(this.payload)}});i.set(46,R);const O=t(class{constructor(t,i,s){this.action=t,this.state=i,this.duration=s,this._id=47}encode(t){return t.uint(47)&&t.string(this.action)&&t.string(this.state)&&t.uint(this.duration)}});i.set(47,O);const P=t(class{constructor(t,i,s,e){this.operationKind=t,this.operationName=i,this.variables=s,this.response=e,this._id=48}encode(t){return t.uint(48)&&t.string(this.operationKind)&&t.string(this.operationName)&&t.string(this.variables)&&t.string(this.response)}});i.set(48,P);const q=t(class{constructor(t,i,s,e){this.frames=t,this.ticks=i,this.totalJSHeapSize=s,this.usedJSHeapSize=e,this._id=49}encode(t){return t.uint(49)&&t.int(this.frames)&&t.int(this.ticks)&&t.uint(this.totalJSHeapSize)&&t.uint(this.usedJSHeapSize)}});i.set(49,q);const D=t(class{constructor(t,i,s,e,n,r,h,o){this.timestamp=t,this.duration=i,this.ttfb=s,this.headerSize=e,this.encodedBodySize=n,this.decodedBodySize=r,this.url=h,this.initiator=o,this._id=53}encode(t){return t.uint(53)&&t.uint(this.timestamp)&&t.uint(this.duration)&&t.uint(this.ttfb)&&t.uint(this.headerSize)&&t.uint(this.encodedBodySize)&&t.uint(this.decodedBodySize)&&t.string(this.url)&&t.string(this.initiator)}});i.set(53,D);const W=t(class{constructor(t,i){this.downlink=t,this.type=i,this._id=54}encode(t){return t.uint(54)&&t.uint(this.downlink)&&t.string(this.type)}});i.set(54,W);const H=t(class{constructor(t){this.hidden=t,this._id=55}encode(t){return t.uint(55)&&t.boolean(this.hidden)}});i.set(55,H);const J=t(class{constructor(t,i,s,e,n,r,h){this.timestamp=t,this.duration=i,this.context=s,this.containerType=e,this.containerSrc=n,this.containerId=r,this.containerName=h,this._id=59}encode(t){return t.uint(59)&&t.uint(this.timestamp)&&t.uint(this.duration)&&t.uint(this.context)&&t.uint(this.containerType)&&t.string(this.containerSrc)&&t.string(this.containerId)&&t.string(this.containerName)}});i.set(59,J);const F=t(class{constructor(t,i,s,e){this.id=t,this.name=i,this.value=s,this.baseURL=e,this._id=60}encode(t){return t.uint(60)&&t.uint(this.id)&&t.string(this.name)&&t.string(this.value)&&t.string(this.baseURL)}});i.set(60,F);const X=t(class{constructor(t,i,s){this.id=t,this.data=i,this.baseURL=s,this._id=61}encode(t){return t.uint(61)&&t.uint(this.id)&&t.string(this.data)&&t.string(this.baseURL)}});i.set(61,X);const G=t(class{constructor(t,i){this.type=t,this.value=i,this._id=63}encode(t){return t.uint(63)&&t.string(this.type)&&t.string(this.value)}});i.set(63,G);const K=t(class{constructor(t,i){this.name=t,this.payload=i,this._id=64}encode(t){return t.uint(64)&&t.string(this.name)&&t.string(this.payload)}});i.set(64,K);const j=t(class{constructor(){this._id=65}encode(t){return t.uint(65)}});i.set(65,j);const Q=t(class{constructor(t,i,s,e){this.id=t,this.rule=i,this.index=s,this.baseURL=e,this._id=67}encode(t){return t.uint(67)&&t.uint(this.id)&&t.string(this.rule)&&t.uint(this.index)&&t.string(this.baseURL)}});i.set(67,Q);const V=t(class{constructor(t,i,s,e){this.id=t,this.hesitationTime=i,this.label=s,this.selector=e,this._id=69}encode(t){return t.uint(69)&&t.uint(this.id)&&t.uint(this.hesitationTime)&&t.string(this.label)&&t.string(this.selector)}});i.set(69,V);const Y=t(class{constructor(t,i){this.frameID=t,this.id=i,this._id=70}encode(t){return t.uint(70)&&t.uint(this.frameID)&&t.uint(this.id)}});i.set(70,Y);class Z{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 tt="function"==typeof TextEncoder?new TextEncoder:{encode(t){const i=t.length,s=new Uint8Array(3*i);let e=-1;for(var 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))>=56320&&r<=57343)){s[e+=1]=239,s[e+=1]=191,s[e+=1]=189;continue}if(h+=1,(n=1024*(n-55296)+r-56320+65536)>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 it{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}checkpoint(){this.checkpointOffset=this.offset}isEmpty(){return 0===this.offset}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 i=tt.encode(t),s=i.byteLength;return!(!this.uint(s)||this.offset+s>this.size)&&(this.data.set(i,this.offset),this.offset+=s,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class st{constructor(t,i,s){this.pageNo=t,this.timestamp=i,this.onBatch=s,this.nextIndex=0,this.beaconSize=2e5,this.writer=new it(this.beaconSize),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepareBatchMeta()}prepareBatchMeta(){return new s(this.pageNo,this.nextIndex,this.timestamp).encode(this.writer)}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(t instanceof e&&(this.timestamp=t.timestamp),!t.encode(this.writer))for(this.isEmpty||(this.onBatch(this.writer.flush()),this.prepareBatchMeta());!t.encode(this.writer);){if(this.beaconSize===this.beaconSizeLimit)return console.warn("OpenReplay: beacon size overflow. Skipping large message."),this.writer.reset(),this.prepareBatchMeta(),void(this.isEmpty=!0);this.beaconSize=Math.min(2*this.beaconSize,this.beaconSizeLimit),this.writer=new it(this.beaconSize),this.prepareBatchMeta()}this.writer.checkpoint(),this.nextIndex++,this.isEmpty=!1}finaliseBatch(){this.isEmpty||(this.onBatch(this.writer.flush()),this.prepareBatchMeta(),this.isEmpty=!0)}clean(){this.writer.reset()}}let et=null,nt=null;function rt(){nt&&nt.finaliseBatch()}function ht(){null!==ct&&(clearInterval(ct),ct=null),nt&&(nt.clean(),nt=null)}let ot,ct=null;self.onmessage=({data:t})=>{if(null!=t){if("stop"===t)return rt(),void ht();if(Array.isArray(t)){if(!nt)throw new Error("WebWorker: writer not initialised.");const s=nt;t.forEach(t=>{const e=new(i.get(t._id));Object.assign(e,t),e instanceof H&&(e.hidden?ot=setTimeout(()=>self.postMessage("restart"),18e5):clearTimeout(ot)),s.writeMessage(e)})}else{if("start"===t.type)return et=new Z(t.ingestPoint,()=>{self.postMessage("restart")},()=>{et&&(et.clean(),et=null),ht(),self.postMessage("failed")},t.connAttemptCount,t.connAttemptGap),nt=new st(t.pageNo,t.timestamp,t=>et&&et.push(t)),void(null===ct&&(ct=setInterval(rt,1e4)));if("auth"===t.type){if(!et)throw new Error("WebWorker: sender not initialised. Recieved auth.");if(!nt)throw new Error("WebWorker: writer not initialised. Recieved auth.");return et.authorise(t.token),void(t.beaconSizeLimit&&nt.setBeaconSizeLimit(t.beaconSizeLimit))}}}else rt()};

return {
userUUID: localStorage.getItem(this.options.local_uuid_key),
userUUID: this.localStorage.getItem(this.options.local_uuid_key),
projectKey: this.projectKey,

@@ -185,3 +189,3 @@ revID: this.revID,

getSessionToken() {
const token = sessionStorage.getItem(this.options.session_token_key);
const token = this.sessionStorage.getItem(this.options.session_token_key);
if (token !== null) {

@@ -228,6 +232,6 @@ return token;

if (flag) {
sessionStorage.setItem(this.options.session_reset_key, 't');
this.sessionStorage.setItem(this.options.session_reset_key, 't');
}
else {
sessionStorage.removeItem(this.options.session_reset_key);
this.sessionStorage.removeItem(this.options.session_reset_key);
}

@@ -244,3 +248,3 @@ }

let pageNo = 0;
const pageNoStr = sessionStorage.getItem(this.options.session_pageno_key);
const pageNoStr = this.sessionStorage.getItem(this.options.session_pageno_key);
if (pageNoStr != null) {

@@ -250,3 +254,3 @@ pageNo = parseInt(pageNoStr);

}
sessionStorage.setItem(this.options.session_pageno_key, pageNo.toString());
this.sessionStorage.setItem(this.options.session_pageno_key, pageNo.toString());
const startInfo = this.getStartInfo();

@@ -262,4 +266,4 @@ const startWorkerMsg = {

this.worker.postMessage(startWorkerMsg); // brings delay of 10th ms?
const sReset = sessionStorage.getItem(this.options.session_reset_key);
sessionStorage.removeItem(this.options.session_reset_key);
const sReset = this.sessionStorage.getItem(this.options.session_reset_key);
this.sessionStorage.removeItem(this.options.session_reset_key);
return window.fetch(this.options.ingestPoint + '/v1/web/start', {

@@ -270,3 +274,3 @@ method: 'POST',

},
body: JSON.stringify(Object.assign(Object.assign({}, startInfo), { userID: startOpts.userID || this.session.getInfo().userID, token: sessionStorage.getItem(this.options.session_token_key), deviceMemory: performance_js_1.deviceMemory,
body: JSON.stringify(Object.assign(Object.assign({}, startInfo), { userID: startOpts.userID || this.session.getInfo().userID, token: this.sessionStorage.getItem(this.options.session_token_key), deviceMemory: performance_js_1.deviceMemory,
jsHeapSizeLimit: performance_js_1.jsHeapSizeLimit, reset: startOpts.forceNew || sReset !== null })),

@@ -294,4 +298,4 @@ })

}
sessionStorage.setItem(this.options.session_token_key, token);
localStorage.setItem(this.options.local_uuid_key, userUUID);
this.sessionStorage.setItem(this.options.session_token_key, token);
this.localStorage.setItem(this.options.local_uuid_key, userUUID);
this.session.update(Object.assign({ sessionID }, startOpts));

@@ -317,3 +321,3 @@ this.activityState = ActivityState.Active;

.catch(reason => {
sessionStorage.removeItem(this.options.session_token_key);
this.sessionStorage.removeItem(this.options.session_token_key);
this.stop();

@@ -320,0 +324,0 @@ if (reason === CANCELED) {

@@ -10,3 +10,3 @@ declare type NodeCallback = (node: Node) => void;

attachElementListener(type: string, node: Element, elementListener: EventListener): void;
registerNode(node: Node): [number, boolean];
registerNode(node: Node): [id: number, isNew: boolean];
unregisterNode(node: Node): number | undefined;

@@ -13,0 +13,0 @@ callNodeCallbacks(node: Node): void;

@@ -7,7 +7,7 @@ import App from "../index.js";

private readonly commited;
private readonly recents;
private readonly myNodes;
private readonly indexes;
private readonly attributesList;
private readonly textSet;
private readonly newSet;
private readonly affectedSet;
constructor(app: App, isTopContext?: boolean);

@@ -14,0 +14,0 @@ private clear;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const messages_js_1 = require("../../common/messages.js");
const context_js_1 = require("../context.js");
function isSVGElement(node) {
return node.namespaceURI === 'http://www.w3.org/2000/svg';
}
const guards_js_1 = require("../guards.js");
function isIgnored(node) {
if ((0, context_js_1.isInstance)(node, Text)) {
if ((0, guards_js_1.isTextNode)(node)) {
return false;
}
if (!(0, context_js_1.isInstance)(node, Element)) {
if (!(0, guards_js_1.isElementNode)(node)) {
return true;

@@ -27,7 +24,4 @@ }

}
function isRootNode(node) {
return (0, context_js_1.isInstance)(node, Document) || (0, context_js_1.isInstance)(node, ShadowRoot);
}
function isObservable(node) {
if (isRootNode(node)) {
if ((0, guards_js_1.isRootNode)(node)) {
return true;

@@ -42,7 +36,7 @@ }

this.commited = [];
this.recents = [];
this.myNodes = [];
this.indexes = [];
this.attributesList = [];
this.textSet = new Set();
this.newSet = new Set();
this.affectedSet = new Set();
this.observer = new MutationObserver(this.app.safe((mutations) => {

@@ -52,3 +46,3 @@ for (const mutation of mutations) {

const type = mutation.type;
if (!isObservable(target) || !(0, context_js_1.inDocument)(target)) {
if (!isObservable(target) /*|| !inDocument() */) {
continue;

@@ -58,2 +52,5 @@ }

for (let i = 0; i < mutation.removedNodes.length; i++) {
// TODO: handle node removal separately from binding.
// Node removals should go first in the commit.
// To check: MoveNode and other possible unbinding behaviours
this.bindTree(mutation.removedNodes[i]);

@@ -70,5 +67,2 @@ }

}
if (id >= this.recents.length) { // TODO: something more convinient
this.recents[id] = undefined;
}
if (type === 'attributes') {

@@ -84,2 +78,3 @@ const name = mutation.attributeName;

attr.add(name);
this.affectedSet.add(id);
continue;

@@ -89,2 +84,3 @@ }

this.textSet.add(id);
this.affectedSet.add(id);
continue;

@@ -98,9 +94,10 @@ }

this.commited.length = 0;
this.recents.length = 0;
this.indexes.length = 1;
this.attributesList.length = 0;
this.textSet.clear();
this.newSet.clear();
this.affectedSet.clear();
}
sendNodeAttribute(id, node, name, value) {
if (isSVGElement(node)) {
if ((0, guards_js_1.isSVGElement)(node)) {
if (name.substr(0, 6) === 'xlink:') {

@@ -132,3 +129,3 @@ name = name.substr(6);

if (name === 'value' &&
(0, context_js_1.isInstance)(node, HTMLInputElement) &&
(0, guards_js_1.hasTag)(node, "INPUT") &&
node.type !== 'button' &&

@@ -143,3 +140,3 @@ node.type !== 'reset' &&

}
if (name === 'style' || name === 'href' && (0, context_js_1.isInstance)(node, HTMLLinkElement)) {
if (name === 'style' || name === 'href' && (0, guards_js_1.hasTag)(node, "LINK")) {
this.app.send(new messages_js_1.SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));

@@ -154,3 +151,3 @@ return;

sendNodeData(id, parentElement, data) {
if ((0, context_js_1.isInstance)(parentElement, HTMLStyleElement) || (0, context_js_1.isInstance)(parentElement, SVGStyleElement)) {
if ((0, guards_js_1.hasTag)(parentElement, "STYLE")) {
this.app.send(new messages_js_1.SetCSSDataURLBased(id, data, this.app.getBaseHref()));

@@ -163,6 +160,7 @@ return;

bindNode(node) {
const r = this.app.nodes.registerNode(node);
const id = r[0];
this.recents[id] = r[1] || this.recents[id] || false;
this.myNodes[id] = true;
const [id, isNew] = this.app.nodes.registerNode(node);
if (isNew) {
this.newSet.add(id);
}
this.affectedSet.add(id);
}

@@ -187,3 +185,4 @@ bindTree(node) {

const id = this.app.nodes.unregisterNode(node);
if (id !== undefined && this.recents[id] === false) {
// if (id !== undefined && this.recents[id] === false) { // In the old version it === flase when bindNode() was called on node but it was not new
if (id !== undefined && !this.newSet.has(id) && this.affectedSet.has(id)) { // Unbinding logic should be simplified. Node removals should go first.
this.app.send(new messages_js_1.RemoveNode(id));

@@ -193,3 +192,3 @@ }

_commitNode(id, node) {
if (isRootNode(node)) {
if ((0, guards_js_1.isRootNode)(node)) {
return true;

@@ -202,3 +201,3 @@ }

// TODO: Clean the logic (though now it workd fine)
if (!(0, context_js_1.isInstance)(node, HTMLHtmlElement) || !this.isTopContext) {
if (!(0, guards_js_1.hasTag)(node, "HTML") || !this.isTopContext) {
if (parent === null) {

@@ -230,5 +229,5 @@ this.unbindNode(node);

if (sibling === null) {
this.indexes[id] = 0; //
this.indexes[id] = 0;
}
const isNew = this.recents[id];
const isNew = this.newSet.has(id);
const index = this.indexes[id];

@@ -239,5 +238,5 @@ if (index === undefined) {

if (isNew === true) {
if ((0, context_js_1.isInstance)(node, Element)) {
if ((0, guards_js_1.isElementNode)(node)) {
if (parentID !== undefined) {
this.app.send(new messages_js_1.CreateElementNode(id, parentID, index, node.tagName, isSVGElement(node)));
this.app.send(new messages_js_1.CreateElementNode(id, parentID, index, node.tagName, (0, guards_js_1.isSVGElement)(node)));
}

@@ -249,3 +248,3 @@ for (let i = 0; i < node.attributes.length; i++) {

}
else if ((0, context_js_1.isInstance)(node, Text)) {
else if ((0, guards_js_1.isTextNode)(node)) {
// for text node id != 0, hence parentID !== undefined and parent is Element

@@ -258,2 +257,3 @@ this.app.send(new messages_js_1.CreateTextNode(id, parentID, index));

if (isNew === false && parentID !== undefined) {
// does this happen a lot?
this.app.send(new messages_js_1.MoveNode(id, parentID, index));

@@ -263,3 +263,3 @@ }

if (attr !== undefined) {
if (!(0, context_js_1.isInstance)(node, Element)) {
if (!(0, guards_js_1.isElementNode)(node)) {
throw 'commitNode: node is not an element';

@@ -272,3 +272,3 @@ }

if (this.textSet.has(id)) {
if (!(0, context_js_1.isInstance)(node, Text)) {
if (!(0, guards_js_1.isTextNode)(node)) {
throw 'commitNode: node is not a text';

@@ -294,15 +294,8 @@ }

let node;
for (let id = 0; id < this.recents.length; id++) {
// TODO: make things/logic nice here.
// commit required in any case if recents[id] true or false (in case of unbinding) or undefined (in case of attr change).
// Possible solution: separate new node commit (recents) and new attribute/move node commit
// Otherwise commitNode is called on each node, which might be a lot
if (!this.myNodes[id]) {
continue;
}
this.affectedSet.forEach(id => {
this.commitNode(id);
if (this.recents[id] === true && (node = this.app.nodes.getNode(id))) {
if (this.newSet.has(id) && (node = this.app.nodes.getNode(id))) {
this.app.nodes.callNodeCallbacks(node);
}
}
});
this.clear();

@@ -327,5 +320,4 @@ }

this.clear();
this.myNodes.length = 0;
}
}
exports.default = Observer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const observer_js_1 = require("./observer.js");
const context_js_1 = require("../context.js");
const guards_js_1 = require("../guards.js");
const iframe_observer_js_1 = require("./iframe_observer.js");

@@ -20,3 +20,3 @@ const shadow_root_observer_js_1 = require("./shadow_root_observer.js");

this.app.nodes.attachNodeCallback(node => {
if ((0, context_js_1.isInstance)(node, HTMLIFrameElement) &&
if ((0, guards_js_1.hasTag)(node, "IFRAME") &&
((this.options.captureIFrames && !(0, utils_js_1.hasOpenreplayAttribute)(node, "obscured"))

@@ -29,3 +29,3 @@ || (0, utils_js_1.hasOpenreplayAttribute)(node, "capture"))) {

this.app.nodes.attachNodeCallback(node => {
if ((0, context_js_1.isInstance)(node, Element) && node.shadowRoot !== null) {
if ((0, guards_js_1.isElementNode)(node) && node.shadowRoot !== null) {
this.handleShadowRoot(node.shadowRoot);

@@ -32,0 +32,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_js_1 = require("../utils.js");
const context_js_1 = require("./context.js");
const guards_js_1 = require("./guards.js");
class Sanitizer {

@@ -16,3 +16,3 @@ constructor(app, options) {

if (this.masked.has(parentID) ||
((0, context_js_1.isInstance)(node, Element) && (0, utils_js_1.hasOpenreplayAttribute)(node, 'masked'))) {
((0, guards_js_1.isElementNode)(node) && (0, utils_js_1.hasOpenreplayAttribute)(node, 'masked'))) {
this.masked.add(id);

@@ -19,0 +19,0 @@ }

@@ -130,3 +130,3 @@ "use strict";

req.send(JSON.stringify({
trackerVersion: '3.5.12',
trackerVersion: '3.5.13-beta.0',
projectKey: options.projectKey,

@@ -133,0 +133,0 @@ doNotTrack,

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export interface Options {

@@ -3,0 +3,0 @@ consoleMethods: Array<string> | null;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const guards_js_1 = require("../app/guards.js");
const utils_js_1 = require("../utils.js");

@@ -118,3 +119,3 @@ const messages_js_1 = require("../common/messages.js");

app.nodes.attachNodeCallback(app.safe(node => {
if (node instanceof HTMLIFrameElement) {
if ((0, guards_js_1.hasTag)(node, "IFRAME")) { // TODO: newContextCallback
let context = node.contentWindow;

@@ -121,0 +122,0 @@ if (context) {

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App | null): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const messages_js_1 = require("../common/messages.js");
const guards_js_1 = require("../app/guards.js");
function default_1(app) {

@@ -35,8 +36,5 @@ if (app === null) {

app.nodes.attachNodeCallback((node) => {
if (!(node instanceof HTMLStyleElement)) {
if (!(0, guards_js_1.hasTag)(node, "STYLE") || !node.sheet) {
return;
}
if (!(node.sheet instanceof CSSStyleSheet)) {
return;
}
if (node.textContent !== null && node.textContent.trim().length > 0) {

@@ -43,0 +41,0 @@ return; // Only fully virtual sheets maintained so far

@@ -0,3 +1,3 @@

import type App from "../app/index.js";
import type Message from "../common/messages.js";
import App from "../app/index.js";
export interface Options {

@@ -4,0 +4,0 @@ captureExceptions: boolean;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -5,2 +5,3 @@ "use strict";

const messages_js_1 = require("../common/messages.js");
const guards_js_1 = require("../app/guards.js");
const PLACEHOLDER_SRC = "https://static.openreplay.com/tracker/placeholder.jpeg";

@@ -53,3 +54,3 @@ function default_1(app) {

app.nodes.attachNodeCallback((node) => {
if (!(node instanceof HTMLImageElement)) {
if (!(0, guards_js_1.hasTag)(node, "IMG")) {
return;

@@ -56,0 +57,0 @@ }

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
declare type TextEditableElement = HTMLInputElement | HTMLTextAreaElement;

@@ -3,0 +3,0 @@ export declare function getInputLabel(node: TextEditableElement): string;

@@ -5,8 +5,9 @@ "use strict";

const utils_js_1 = require("../utils.js");
const guards_js_1 = require("../app/guards.js");
const messages_js_1 = require("../common/messages.js");
function isTextEditable(node) {
if (node instanceof HTMLTextAreaElement) {
if ((0, guards_js_1.hasTag)(node, "TEXTAREA")) {
return true;
}
if (!(node instanceof HTMLInputElement)) {
if (!(0, guards_js_1.hasTag)(node, "INPUT")) {
return false;

@@ -23,3 +24,3 @@ }

function isCheckable(node) {
if (!(node instanceof HTMLInputElement)) {
if (!(0, guards_js_1.hasTag)(node, "INPUT")) {
return false;

@@ -34,3 +35,3 @@ }

while ((p = p.parentNode) !== null) {
if (p instanceof HTMLLabelElement) {
if ((0, guards_js_1.hasTag)(p, "LABEL")) {
return p;

@@ -47,3 +48,3 @@ }

while ((p = p.parentNode) !== null) {
if (p instanceof HTMLLabelElement) {
if ((0, guards_js_1.hasTag)(p, "LABEL")) {
return p;

@@ -78,3 +79,3 @@ }

obscureInputEmails: true,
defaultInputMode: 0 /* Plain */,
defaultInputMode: 0 /* InputMode.Plain */,
}, opts);

@@ -91,18 +92,18 @@ function sendInputTarget(id, node) {

if (node.type === 'password' || (0, utils_js_1.hasOpenreplayAttribute)(node, 'hidden')) {
inputMode = 2 /* Hidden */;
inputMode = 2 /* InputMode.Hidden */;
}
else if ((0, utils_js_1.hasOpenreplayAttribute)(node, 'obscured') ||
(inputMode === 0 /* Plain */ &&
(inputMode === 0 /* InputMode.Plain */ &&
((options.obscureInputNumbers && /\d\d\d\d/.test(value)) ||
(options.obscureInputEmails &&
(node.type === 'email' || !!~value.indexOf('@')))))) {
inputMode = 1 /* Obscured */;
inputMode = 1 /* InputMode.Obscured */;
}
let mask = 0;
switch (inputMode) {
case 2 /* Hidden */:
case 2 /* InputMode.Hidden */:
mask = -1;
value = '';
break;
case 1 /* Obscured */:
case 1 /* InputMode.Obscured */:
mask = value.length;

@@ -157,3 +158,3 @@ value = '';

// TODO: support multiple select (?): use selectedOptions; Need send target?
if (node instanceof HTMLSelectElement) {
if ((0, guards_js_1.hasTag)(node, "SELECT")) {
sendInputValue(id, node);

@@ -160,0 +161,0 @@ app.attachEventListener(node, "change", () => {

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const guards_js_1 = require("../app/guards.js");
const utils_js_1 = require("../utils.js");

@@ -52,3 +53,3 @@ const messages_js_1 = require("../common/messages.js");

}
if (target instanceof SVGElement) {
if ((0, guards_js_1.isSVGElement)(target)) {
let owner = target.ownerSVGElement;

@@ -83,3 +84,3 @@ while (owner !== null) {

}
if (target instanceof HTMLInputElement) {
if ((0, guards_js_1.hasTag)(target, "INPUT")) {
return (0, input_js_1.getInputLabel)(target);

@@ -86,0 +87,0 @@ }

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export declare const deviceMemory: number;

@@ -3,0 +3,0 @@ export declare const jsHeapSizeLimit: number;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -25,7 +25,7 @@ "use strict";

});
app.nodes.attachNodeCallback(node => {
if (node instanceof Element && node.scrollLeft + node.scrollTop > 0) {
nodeScroll.set(node, [node.scrollLeft, node.scrollTop]);
}
});
// app.nodes.attachNodeCallback(node => {
// if (isElementNode(node) && node.scrollLeft + node.scrollTop > 0) {
// nodeScroll.set(node, [node.scrollLeft, node.scrollTop]);
// }
// })
app.attachEventListener(window, 'scroll', (e) => {

@@ -32,0 +32,0 @@ const target = e.target;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export interface Options {

@@ -3,0 +3,0 @@ captureResourceTimings: boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const guards_js_1 = require("../app/guards.js");
const utils_js_1 = require("../utils.js");

@@ -12,3 +13,3 @@ const messages_js_1 = require("../common/messages.js");

let src = '';
if (element instanceof HTMLImageElement) {
if ((0, guards_js_1.hasTag)(element, "IMG")) {
src = element.currentSrc || element.src;

@@ -15,0 +16,0 @@ }

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -47,2 +47,4 @@ import type Message from "../common/messages.js";

__debug__?: LoggerOptions;
localStorage: Storage;
sessionStorage: Storage;
onStart?: StartCallback;

@@ -60,2 +62,4 @@ } & WebworkerOptions;

readonly session: Session;
readonly localStorage: Storage;
readonly sessionStorage: Storage;
private readonly messages;

@@ -62,0 +66,0 @@ private readonly observer;

@@ -32,3 +32,3 @@ import { Timestamp } from "../common/messages.js";

this.activityState = ActivityState.NotActive;
this.version = '3.5.12'; // TODO: version compatability check inside each plugin.
this.version = '3.5.13-beta.0'; // TODO: version compatability check inside each plugin.
this.projectKey = projectKey;

@@ -47,6 +47,5 @@ this.options = Object.assign({

__debug_report_edp: null,
localStorage: window.localStorage,
sessionStorage: window.sessionStorage,
}, options);
if (sessionToken != null) {
sessionStorage.setItem(this.options.session_token_key, sessionToken);
}
this.revID = this.options.revID;

@@ -61,2 +60,7 @@ this.sanitizer = new Sanitizer(this, options);

this.session = new Session(this);
this.localStorage = this.options.localStorage;
this.sessionStorage = this.options.sessionStorage;
if (sessionToken != null) {
this.sessionStorage.setItem(this.options.session_token_key, sessionToken);
}
try {

@@ -169,3 +173,3 @@ this.worker = new Worker(URL.createObjectURL(new Blob([`"use strict";function t(t){function i(...i){return new t(...i)}return i.prototype=t.prototype,i}const i=new Map;const s=t(class{constructor(t,i,s){this.pageNo=t,this.firstIndex=i,this.timestamp=s,this._id=80}encode(t){return t.uint(80)&&t.uint(this.pageNo)&&t.uint(this.firstIndex)&&t.int(this.timestamp)}});i.set(80,s);const e=t(class{constructor(t){this.timestamp=t,this._id=0}encode(t){return t.uint(0)&&t.uint(this.timestamp)}});i.set(0,e);const n=t(class{constructor(t,i,s){this.url=t,this.referrer=i,this.navigationStart=s,this._id=4}encode(t){return t.uint(4)&&t.string(this.url)&&t.string(this.referrer)&&t.uint(this.navigationStart)}});i.set(4,n);const r=t(class{constructor(t,i){this.width=t,this.height=i,this._id=5}encode(t){return t.uint(5)&&t.uint(this.width)&&t.uint(this.height)}});i.set(5,r);const h=t(class{constructor(t,i){this.x=t,this.y=i,this._id=6}encode(t){return t.uint(6)&&t.int(this.x)&&t.int(this.y)}});i.set(6,h);const o=t(class{constructor(){this._id=7}encode(t){return t.uint(7)}});i.set(7,o);const c=t(class{constructor(t,i,s,e,n){this.id=t,this.parentID=i,this.index=s,this.tag=e,this.svg=n,this._id=8}encode(t){return t.uint(8)&&t.uint(this.id)&&t.uint(this.parentID)&&t.uint(this.index)&&t.string(this.tag)&&t.boolean(this.svg)}});i.set(8,c);const a=t(class{constructor(t,i,s){this.id=t,this.parentID=i,this.index=s,this._id=9}encode(t){return t.uint(9)&&t.uint(this.id)&&t.uint(this.parentID)&&t.uint(this.index)}});i.set(9,a);const u=t(class{constructor(t,i,s){this.id=t,this.parentID=i,this.index=s,this._id=10}encode(t){return t.uint(10)&&t.uint(this.id)&&t.uint(this.parentID)&&t.uint(this.index)}});i.set(10,u);const d=t(class{constructor(t){this.id=t,this._id=11}encode(t){return t.uint(11)&&t.uint(this.id)}});i.set(11,d);const l=t(class{constructor(t,i,s){this.id=t,this.name=i,this.value=s,this._id=12}encode(t){return t.uint(12)&&t.uint(this.id)&&t.string(this.name)&&t.string(this.value)}});i.set(12,l);const p=t(class{constructor(t,i){this.id=t,this.name=i,this._id=13}encode(t){return t.uint(13)&&t.uint(this.id)&&t.string(this.name)}});i.set(13,p);const m=t(class{constructor(t,i){this.id=t,this.data=i,this._id=14}encode(t){return t.uint(14)&&t.uint(this.id)&&t.string(this.data)}});i.set(14,m);const g=t(class{constructor(t,i,s){this.id=t,this.x=i,this.y=s,this._id=16}encode(t){return t.uint(16)&&t.uint(this.id)&&t.int(this.x)&&t.int(this.y)}});i.set(16,g);const f=t(class{constructor(t,i){this.id=t,this.label=i,this._id=17}encode(t){return t.uint(17)&&t.uint(this.id)&&t.string(this.label)}});i.set(17,f);const y=t(class{constructor(t,i,s){this.id=t,this.value=i,this.mask=s,this._id=18}encode(t){return t.uint(18)&&t.uint(this.id)&&t.string(this.value)&&t.int(this.mask)}});i.set(18,y);const _=t(class{constructor(t,i){this.id=t,this.checked=i,this._id=19}encode(t){return t.uint(19)&&t.uint(this.id)&&t.boolean(this.checked)}});i.set(19,_);const v=t(class{constructor(t,i){this.x=t,this.y=i,this._id=20}encode(t){return t.uint(20)&&t.uint(this.x)&&t.uint(this.y)}});i.set(20,v);const b=t(class{constructor(t,i){this.level=t,this.value=i,this._id=22}encode(t){return t.uint(22)&&t.string(this.level)&&t.string(this.value)}});i.set(22,b);const S=t(class{constructor(t,i,s,e,n,r,h,o,c){this.requestStart=t,this.responseStart=i,this.responseEnd=s,this.domContentLoadedEventStart=e,this.domContentLoadedEventEnd=n,this.loadEventStart=r,this.loadEventEnd=h,this.firstPaint=o,this.firstContentfulPaint=c,this._id=23}encode(t){return t.uint(23)&&t.uint(this.requestStart)&&t.uint(this.responseStart)&&t.uint(this.responseEnd)&&t.uint(this.domContentLoadedEventStart)&&t.uint(this.domContentLoadedEventEnd)&&t.uint(this.loadEventStart)&&t.uint(this.loadEventEnd)&&t.uint(this.firstPaint)&&t.uint(this.firstContentfulPaint)}});i.set(23,S);const w=t(class{constructor(t,i,s){this.speedIndex=t,this.visuallyComplete=i,this.timeToInteractive=s,this._id=24}encode(t){return t.uint(24)&&t.uint(this.speedIndex)&&t.uint(this.visuallyComplete)&&t.uint(this.timeToInteractive)}});i.set(24,w);const E=t(class{constructor(t,i,s){this.name=t,this.message=i,this.payload=s,this._id=25}encode(t){return t.uint(25)&&t.string(this.name)&&t.string(this.message)&&t.string(this.payload)}});i.set(25,E);const x=t(class{constructor(t,i){this.name=t,this.payload=i,this._id=27}encode(t){return t.uint(27)&&t.string(this.name)&&t.string(this.payload)}});i.set(27,x);const T=t(class{constructor(t){this.id=t,this._id=28}encode(t){return t.uint(28)&&t.string(this.id)}});i.set(28,T);const z=t(class{constructor(t){this.id=t,this._id=29}encode(t){return t.uint(29)&&t.string(this.id)}});i.set(29,z);const k=t(class{constructor(t,i){this.key=t,this.value=i,this._id=30}encode(t){return t.uint(30)&&t.string(this.key)&&t.string(this.value)}});i.set(30,k);const I=t(class{constructor(t,i,s){this.id=t,this.rule=i,this.index=s,this._id=37}encode(t){return t.uint(37)&&t.uint(this.id)&&t.string(this.rule)&&t.uint(this.index)}});i.set(37,I);const M=t(class{constructor(t,i){this.id=t,this.index=i,this._id=38}encode(t){return t.uint(38)&&t.uint(this.id)&&t.uint(this.index)}});i.set(38,M);const B=t(class{constructor(t,i,s,e,n,r,h){this.method=t,this.url=i,this.request=s,this.response=e,this.status=n,this.timestamp=r,this.duration=h,this._id=39}encode(t){return t.uint(39)&&t.string(this.method)&&t.string(this.url)&&t.string(this.request)&&t.string(this.response)&&t.uint(this.status)&&t.uint(this.timestamp)&&t.uint(this.duration)}});i.set(39,B);const L=t(class{constructor(t,i,s,e){this.name=t,this.duration=i,this.args=s,this.result=e,this._id=40}encode(t){return t.uint(40)&&t.string(this.name)&&t.uint(this.duration)&&t.string(this.args)&&t.string(this.result)}});i.set(40,L);const C=t(class{constructor(t,i){this.key=t,this.value=i,this._id=41}encode(t){return t.uint(41)&&t.string(this.key)&&t.string(this.value)}});i.set(41,C);const A=t(class{constructor(t){this.type=t,this._id=42}encode(t){return t.uint(42)&&t.string(this.type)}});i.set(42,A);const U=t(class{constructor(t,i,s){this.action=t,this.state=i,this.duration=s,this._id=44}encode(t){return t.uint(44)&&t.string(this.action)&&t.string(this.state)&&t.uint(this.duration)}});i.set(44,U);const N=t(class{constructor(t,i){this.mutation=t,this.state=i,this._id=45}encode(t){return t.uint(45)&&t.string(this.mutation)&&t.string(this.state)}});i.set(45,N);const R=t(class{constructor(t,i){this.type=t,this.payload=i,this._id=46}encode(t){return t.uint(46)&&t.string(this.type)&&t.string(this.payload)}});i.set(46,R);const O=t(class{constructor(t,i,s){this.action=t,this.state=i,this.duration=s,this._id=47}encode(t){return t.uint(47)&&t.string(this.action)&&t.string(this.state)&&t.uint(this.duration)}});i.set(47,O);const P=t(class{constructor(t,i,s,e){this.operationKind=t,this.operationName=i,this.variables=s,this.response=e,this._id=48}encode(t){return t.uint(48)&&t.string(this.operationKind)&&t.string(this.operationName)&&t.string(this.variables)&&t.string(this.response)}});i.set(48,P);const q=t(class{constructor(t,i,s,e){this.frames=t,this.ticks=i,this.totalJSHeapSize=s,this.usedJSHeapSize=e,this._id=49}encode(t){return t.uint(49)&&t.int(this.frames)&&t.int(this.ticks)&&t.uint(this.totalJSHeapSize)&&t.uint(this.usedJSHeapSize)}});i.set(49,q);const D=t(class{constructor(t,i,s,e,n,r,h,o){this.timestamp=t,this.duration=i,this.ttfb=s,this.headerSize=e,this.encodedBodySize=n,this.decodedBodySize=r,this.url=h,this.initiator=o,this._id=53}encode(t){return t.uint(53)&&t.uint(this.timestamp)&&t.uint(this.duration)&&t.uint(this.ttfb)&&t.uint(this.headerSize)&&t.uint(this.encodedBodySize)&&t.uint(this.decodedBodySize)&&t.string(this.url)&&t.string(this.initiator)}});i.set(53,D);const W=t(class{constructor(t,i){this.downlink=t,this.type=i,this._id=54}encode(t){return t.uint(54)&&t.uint(this.downlink)&&t.string(this.type)}});i.set(54,W);const H=t(class{constructor(t){this.hidden=t,this._id=55}encode(t){return t.uint(55)&&t.boolean(this.hidden)}});i.set(55,H);const J=t(class{constructor(t,i,s,e,n,r,h){this.timestamp=t,this.duration=i,this.context=s,this.containerType=e,this.containerSrc=n,this.containerId=r,this.containerName=h,this._id=59}encode(t){return t.uint(59)&&t.uint(this.timestamp)&&t.uint(this.duration)&&t.uint(this.context)&&t.uint(this.containerType)&&t.string(this.containerSrc)&&t.string(this.containerId)&&t.string(this.containerName)}});i.set(59,J);const F=t(class{constructor(t,i,s,e){this.id=t,this.name=i,this.value=s,this.baseURL=e,this._id=60}encode(t){return t.uint(60)&&t.uint(this.id)&&t.string(this.name)&&t.string(this.value)&&t.string(this.baseURL)}});i.set(60,F);const X=t(class{constructor(t,i,s){this.id=t,this.data=i,this.baseURL=s,this._id=61}encode(t){return t.uint(61)&&t.uint(this.id)&&t.string(this.data)&&t.string(this.baseURL)}});i.set(61,X);const G=t(class{constructor(t,i){this.type=t,this.value=i,this._id=63}encode(t){return t.uint(63)&&t.string(this.type)&&t.string(this.value)}});i.set(63,G);const K=t(class{constructor(t,i){this.name=t,this.payload=i,this._id=64}encode(t){return t.uint(64)&&t.string(this.name)&&t.string(this.payload)}});i.set(64,K);const j=t(class{constructor(){this._id=65}encode(t){return t.uint(65)}});i.set(65,j);const Q=t(class{constructor(t,i,s,e){this.id=t,this.rule=i,this.index=s,this.baseURL=e,this._id=67}encode(t){return t.uint(67)&&t.uint(this.id)&&t.string(this.rule)&&t.uint(this.index)&&t.string(this.baseURL)}});i.set(67,Q);const V=t(class{constructor(t,i,s,e){this.id=t,this.hesitationTime=i,this.label=s,this.selector=e,this._id=69}encode(t){return t.uint(69)&&t.uint(this.id)&&t.uint(this.hesitationTime)&&t.string(this.label)&&t.string(this.selector)}});i.set(69,V);const Y=t(class{constructor(t,i){this.frameID=t,this.id=i,this._id=70}encode(t){return t.uint(70)&&t.uint(this.frameID)&&t.uint(this.id)}});i.set(70,Y);class Z{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 tt="function"==typeof TextEncoder?new TextEncoder:{encode(t){const i=t.length,s=new Uint8Array(3*i);let e=-1;for(var 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))>=56320&&r<=57343)){s[e+=1]=239,s[e+=1]=191,s[e+=1]=189;continue}if(h+=1,(n=1024*(n-55296)+r-56320+65536)>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 it{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}checkpoint(){this.checkpointOffset=this.offset}isEmpty(){return 0===this.offset}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 i=tt.encode(t),s=i.byteLength;return!(!this.uint(s)||this.offset+s>this.size)&&(this.data.set(i,this.offset),this.offset+=s,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class st{constructor(t,i,s){this.pageNo=t,this.timestamp=i,this.onBatch=s,this.nextIndex=0,this.beaconSize=2e5,this.writer=new it(this.beaconSize),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepareBatchMeta()}prepareBatchMeta(){return new s(this.pageNo,this.nextIndex,this.timestamp).encode(this.writer)}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(t instanceof e&&(this.timestamp=t.timestamp),!t.encode(this.writer))for(this.isEmpty||(this.onBatch(this.writer.flush()),this.prepareBatchMeta());!t.encode(this.writer);){if(this.beaconSize===this.beaconSizeLimit)return console.warn("OpenReplay: beacon size overflow. Skipping large message."),this.writer.reset(),this.prepareBatchMeta(),void(this.isEmpty=!0);this.beaconSize=Math.min(2*this.beaconSize,this.beaconSizeLimit),this.writer=new it(this.beaconSize),this.prepareBatchMeta()}this.writer.checkpoint(),this.nextIndex++,this.isEmpty=!1}finaliseBatch(){this.isEmpty||(this.onBatch(this.writer.flush()),this.prepareBatchMeta(),this.isEmpty=!0)}clean(){this.writer.reset()}}let et=null,nt=null;function rt(){nt&&nt.finaliseBatch()}function ht(){null!==ct&&(clearInterval(ct),ct=null),nt&&(nt.clean(),nt=null)}let ot,ct=null;self.onmessage=({data:t})=>{if(null!=t){if("stop"===t)return rt(),void ht();if(Array.isArray(t)){if(!nt)throw new Error("WebWorker: writer not initialised.");const s=nt;t.forEach(t=>{const e=new(i.get(t._id));Object.assign(e,t),e instanceof H&&(e.hidden?ot=setTimeout(()=>self.postMessage("restart"),18e5):clearTimeout(ot)),s.writeMessage(e)})}else{if("start"===t.type)return et=new Z(t.ingestPoint,()=>{self.postMessage("restart")},()=>{et&&(et.clean(),et=null),ht(),self.postMessage("failed")},t.connAttemptCount,t.connAttemptGap),nt=new st(t.pageNo,t.timestamp,t=>et&&et.push(t)),void(null===ct&&(ct=setInterval(rt,1e4)));if("auth"===t.type){if(!et)throw new Error("WebWorker: sender not initialised. Recieved auth.");if(!nt)throw new Error("WebWorker: writer not initialised. Recieved auth.");return et.authorise(t.token),void(t.beaconSizeLimit&&nt.setBeaconSizeLimit(t.beaconSizeLimit))}}}else rt()};

return {
userUUID: localStorage.getItem(this.options.local_uuid_key),
userUUID: this.localStorage.getItem(this.options.local_uuid_key),
projectKey: this.projectKey,

@@ -182,3 +186,3 @@ revID: this.revID,

getSessionToken() {
const token = sessionStorage.getItem(this.options.session_token_key);
const token = this.sessionStorage.getItem(this.options.session_token_key);
if (token !== null) {

@@ -225,6 +229,6 @@ return token;

if (flag) {
sessionStorage.setItem(this.options.session_reset_key, 't');
this.sessionStorage.setItem(this.options.session_reset_key, 't');
}
else {
sessionStorage.removeItem(this.options.session_reset_key);
this.sessionStorage.removeItem(this.options.session_reset_key);
}

@@ -241,3 +245,3 @@ }

let pageNo = 0;
const pageNoStr = sessionStorage.getItem(this.options.session_pageno_key);
const pageNoStr = this.sessionStorage.getItem(this.options.session_pageno_key);
if (pageNoStr != null) {

@@ -247,3 +251,3 @@ pageNo = parseInt(pageNoStr);

}
sessionStorage.setItem(this.options.session_pageno_key, pageNo.toString());
this.sessionStorage.setItem(this.options.session_pageno_key, pageNo.toString());
const startInfo = this.getStartInfo();

@@ -259,4 +263,4 @@ const startWorkerMsg = {

this.worker.postMessage(startWorkerMsg); // brings delay of 10th ms?
const sReset = sessionStorage.getItem(this.options.session_reset_key);
sessionStorage.removeItem(this.options.session_reset_key);
const sReset = this.sessionStorage.getItem(this.options.session_reset_key);
this.sessionStorage.removeItem(this.options.session_reset_key);
return window.fetch(this.options.ingestPoint + '/v1/web/start', {

@@ -267,3 +271,3 @@ method: 'POST',

},
body: JSON.stringify(Object.assign(Object.assign({}, startInfo), { userID: startOpts.userID || this.session.getInfo().userID, token: sessionStorage.getItem(this.options.session_token_key), deviceMemory,
body: JSON.stringify(Object.assign(Object.assign({}, startInfo), { userID: startOpts.userID || this.session.getInfo().userID, token: this.sessionStorage.getItem(this.options.session_token_key), deviceMemory,
jsHeapSizeLimit, reset: startOpts.forceNew || sReset !== null })),

@@ -291,4 +295,4 @@ })

}
sessionStorage.setItem(this.options.session_token_key, token);
localStorage.setItem(this.options.local_uuid_key, userUUID);
this.sessionStorage.setItem(this.options.session_token_key, token);
this.localStorage.setItem(this.options.local_uuid_key, userUUID);
this.session.update(Object.assign({ sessionID }, startOpts));

@@ -314,3 +318,3 @@ this.activityState = ActivityState.Active;

.catch(reason => {
sessionStorage.removeItem(this.options.session_token_key);
this.sessionStorage.removeItem(this.options.session_token_key);
this.stop();

@@ -317,0 +321,0 @@ if (reason === CANCELED) {

@@ -10,3 +10,3 @@ declare type NodeCallback = (node: Node) => void;

attachElementListener(type: string, node: Element, elementListener: EventListener): void;
registerNode(node: Node): [number, boolean];
registerNode(node: Node): [id: number, isNew: boolean];
unregisterNode(node: Node): number | undefined;

@@ -13,0 +13,0 @@ callNodeCallbacks(node: Node): void;

@@ -7,7 +7,7 @@ import App from "../index.js";

private readonly commited;
private readonly recents;
private readonly myNodes;
private readonly indexes;
private readonly attributesList;
private readonly textSet;
private readonly newSet;
private readonly affectedSet;
constructor(app: App, isTopContext?: boolean);

@@ -14,0 +14,0 @@ private clear;

import { RemoveNodeAttribute, SetNodeAttribute, SetNodeAttributeURLBased, SetCSSDataURLBased, SetNodeData, CreateTextNode, CreateElementNode, MoveNode, RemoveNode, } from "../../common/messages.js";
import { isInstance, inDocument } from "../context.js";
function isSVGElement(node) {
return node.namespaceURI === 'http://www.w3.org/2000/svg';
}
import { isRootNode, isTextNode, isElementNode, isSVGElement, hasTag, } from "../guards.js";
function isIgnored(node) {
if (isInstance(node, Text)) {
if (isTextNode(node)) {
return false;
}
if (!isInstance(node, Element)) {
if (!isElementNode(node)) {
return true;

@@ -25,5 +22,2 @@ }

}
function isRootNode(node) {
return isInstance(node, Document) || isInstance(node, ShadowRoot);
}
function isObservable(node) {

@@ -40,7 +34,7 @@ if (isRootNode(node)) {

this.commited = [];
this.recents = [];
this.myNodes = [];
this.indexes = [];
this.attributesList = [];
this.textSet = new Set();
this.newSet = new Set();
this.affectedSet = new Set();
this.observer = new MutationObserver(this.app.safe((mutations) => {

@@ -50,3 +44,3 @@ for (const mutation of mutations) {

const type = mutation.type;
if (!isObservable(target) || !inDocument(target)) {
if (!isObservable(target) /*|| !inDocument() */) {
continue;

@@ -56,2 +50,5 @@ }

for (let i = 0; i < mutation.removedNodes.length; i++) {
// TODO: handle node removal separately from binding.
// Node removals should go first in the commit.
// To check: MoveNode and other possible unbinding behaviours
this.bindTree(mutation.removedNodes[i]);

@@ -68,5 +65,2 @@ }

}
if (id >= this.recents.length) { // TODO: something more convinient
this.recents[id] = undefined;
}
if (type === 'attributes') {

@@ -82,2 +76,3 @@ const name = mutation.attributeName;

attr.add(name);
this.affectedSet.add(id);
continue;

@@ -87,2 +82,3 @@ }

this.textSet.add(id);
this.affectedSet.add(id);
continue;

@@ -96,6 +92,7 @@ }

this.commited.length = 0;
this.recents.length = 0;
this.indexes.length = 1;
this.attributesList.length = 0;
this.textSet.clear();
this.newSet.clear();
this.affectedSet.clear();
}

@@ -130,3 +127,3 @@ sendNodeAttribute(id, node, name, value) {

if (name === 'value' &&
isInstance(node, HTMLInputElement) &&
hasTag(node, "INPUT") &&
node.type !== 'button' &&

@@ -141,3 +138,3 @@ node.type !== 'reset' &&

}
if (name === 'style' || name === 'href' && isInstance(node, HTMLLinkElement)) {
if (name === 'style' || name === 'href' && hasTag(node, "LINK")) {
this.app.send(new SetNodeAttributeURLBased(id, name, value, this.app.getBaseHref()));

@@ -152,3 +149,3 @@ return;

sendNodeData(id, parentElement, data) {
if (isInstance(parentElement, HTMLStyleElement) || isInstance(parentElement, SVGStyleElement)) {
if (hasTag(parentElement, "STYLE")) {
this.app.send(new SetCSSDataURLBased(id, data, this.app.getBaseHref()));

@@ -161,6 +158,7 @@ return;

bindNode(node) {
const r = this.app.nodes.registerNode(node);
const id = r[0];
this.recents[id] = r[1] || this.recents[id] || false;
this.myNodes[id] = true;
const [id, isNew] = this.app.nodes.registerNode(node);
if (isNew) {
this.newSet.add(id);
}
this.affectedSet.add(id);
}

@@ -185,3 +183,4 @@ bindTree(node) {

const id = this.app.nodes.unregisterNode(node);
if (id !== undefined && this.recents[id] === false) {
// if (id !== undefined && this.recents[id] === false) { // In the old version it === flase when bindNode() was called on node but it was not new
if (id !== undefined && !this.newSet.has(id) && this.affectedSet.has(id)) { // Unbinding logic should be simplified. Node removals should go first.
this.app.send(new RemoveNode(id));

@@ -199,3 +198,3 @@ }

// TODO: Clean the logic (though now it workd fine)
if (!isInstance(node, HTMLHtmlElement) || !this.isTopContext) {
if (!hasTag(node, "HTML") || !this.isTopContext) {
if (parent === null) {

@@ -227,5 +226,5 @@ this.unbindNode(node);

if (sibling === null) {
this.indexes[id] = 0; //
this.indexes[id] = 0;
}
const isNew = this.recents[id];
const isNew = this.newSet.has(id);
const index = this.indexes[id];

@@ -236,3 +235,3 @@ if (index === undefined) {

if (isNew === true) {
if (isInstance(node, Element)) {
if (isElementNode(node)) {
if (parentID !== undefined) {

@@ -246,3 +245,3 @@ this.app.send(new CreateElementNode(id, parentID, index, node.tagName, isSVGElement(node)));

}
else if (isInstance(node, Text)) {
else if (isTextNode(node)) {
// for text node id != 0, hence parentID !== undefined and parent is Element

@@ -255,2 +254,3 @@ this.app.send(new CreateTextNode(id, parentID, index));

if (isNew === false && parentID !== undefined) {
// does this happen a lot?
this.app.send(new MoveNode(id, parentID, index));

@@ -260,3 +260,3 @@ }

if (attr !== undefined) {
if (!isInstance(node, Element)) {
if (!isElementNode(node)) {
throw 'commitNode: node is not an element';

@@ -269,3 +269,3 @@ }

if (this.textSet.has(id)) {
if (!isInstance(node, Text)) {
if (!isTextNode(node)) {
throw 'commitNode: node is not a text';

@@ -291,15 +291,8 @@ }

let node;
for (let id = 0; id < this.recents.length; id++) {
// TODO: make things/logic nice here.
// commit required in any case if recents[id] true or false (in case of unbinding) or undefined (in case of attr change).
// Possible solution: separate new node commit (recents) and new attribute/move node commit
// Otherwise commitNode is called on each node, which might be a lot
if (!this.myNodes[id]) {
continue;
}
this.affectedSet.forEach(id => {
this.commitNode(id);
if (this.recents[id] === true && (node = this.app.nodes.getNode(id))) {
if (this.newSet.has(id) && (node = this.app.nodes.getNode(id))) {
this.app.nodes.callNodeCallbacks(node);
}
}
});
this.clear();

@@ -324,4 +317,3 @@ }

this.clear();
this.myNodes.length = 0;
}
}
import Observer from "./observer.js";
import { isInstance } from "../context.js";
import { isElementNode, hasTag, } from "../guards.js";
import IFrameObserver from "./iframe_observer.js";

@@ -18,3 +18,3 @@ import ShadowRootObserver from "./shadow_root_observer.js";

this.app.nodes.attachNodeCallback(node => {
if (isInstance(node, HTMLIFrameElement) &&
if (hasTag(node, "IFRAME") &&
((this.options.captureIFrames && !hasOpenreplayAttribute(node, "obscured"))

@@ -27,3 +27,3 @@ || hasOpenreplayAttribute(node, "capture"))) {

this.app.nodes.attachNodeCallback(node => {
if (isInstance(node, Element) && node.shadowRoot !== null) {
if (isElementNode(node) && node.shadowRoot !== null) {
this.handleShadowRoot(node.shadowRoot);

@@ -30,0 +30,0 @@ }

import { stars, hasOpenreplayAttribute } from "../utils.js";
import { isInstance } from "./context.js";
import { isElementNode } from "./guards.js";
export default class Sanitizer {

@@ -14,3 +14,3 @@ constructor(app, options) {

if (this.masked.has(parentID) ||
(isInstance(node, Element) && hasOpenreplayAttribute(node, 'masked'))) {
(isElementNode(node) && hasOpenreplayAttribute(node, 'masked'))) {
this.masked.add(id);

@@ -17,0 +17,0 @@ }

@@ -126,3 +126,3 @@ import App, { DEFAULT_INGEST_POINT } from "./app/index.js";

req.send(JSON.stringify({
trackerVersion: '3.5.12',
trackerVersion: '3.5.13-beta.0',
projectKey: options.projectKey,

@@ -129,0 +129,0 @@ doNotTrack,

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export interface Options {

@@ -3,0 +3,0 @@ consoleMethods: Array<string> | null;

@@ -0,1 +1,2 @@

import { hasTag } from "../app/guards.js";
import { IN_BROWSER } from "../utils.js";

@@ -116,3 +117,3 @@ import { ConsoleLog } from "../common/messages.js";

app.nodes.attachNodeCallback(app.safe(node => {
if (node instanceof HTMLIFrameElement) {
if (hasTag(node, "IFRAME")) { // TODO: newContextCallback
let context = node.contentWindow;

@@ -119,0 +120,0 @@ if (context) {

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App | null): void;
import { CSSInsertRuleURLBased, CSSDeleteRule, TechnicalInfo } from "../common/messages.js";
import { hasTag } from "../app/guards.js";
export default function (app) {

@@ -33,8 +34,5 @@ if (app === null) {

app.nodes.attachNodeCallback((node) => {
if (!(node instanceof HTMLStyleElement)) {
if (!hasTag(node, "STYLE") || !node.sheet) {
return;
}
if (!(node.sheet instanceof CSSStyleSheet)) {
return;
}
if (node.textContent !== null && node.textContent.trim().length > 0) {

@@ -41,0 +39,0 @@ return; // Only fully virtual sheets maintained so far

@@ -0,3 +1,3 @@

import type App from "../app/index.js";
import type Message from "../common/messages.js";
import App from "../app/index.js";
export interface Options {

@@ -4,0 +4,0 @@ captureExceptions: boolean;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;
import { timestamp, isURL } from "../utils.js";
import { ResourceTiming, SetNodeAttributeURLBased, SetNodeAttribute } from "../common/messages.js";
import { hasTag } from "../app/guards.js";
const PLACEHOLDER_SRC = "https://static.openreplay.com/tracker/placeholder.jpeg";

@@ -50,3 +51,3 @@ export default function (app) {

app.nodes.attachNodeCallback((node) => {
if (!(node instanceof HTMLImageElement)) {
if (!hasTag(node, "IMG")) {
return;

@@ -53,0 +54,0 @@ }

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
declare type TextEditableElement = HTMLInputElement | HTMLTextAreaElement;

@@ -3,0 +3,0 @@ export declare function getInputLabel(node: TextEditableElement): string;

import { normSpaces, IN_BROWSER, getLabelAttribute, hasOpenreplayAttribute, } from "../utils.js";
import { hasTag } from "../app/guards.js";
import { SetInputTarget, SetInputValue, SetInputChecked } from "../common/messages.js";
function isTextEditable(node) {
if (node instanceof HTMLTextAreaElement) {
if (hasTag(node, "TEXTAREA")) {
return true;
}
if (!(node instanceof HTMLInputElement)) {
if (!hasTag(node, "INPUT")) {
return false;

@@ -19,3 +20,3 @@ }

function isCheckable(node) {
if (!(node instanceof HTMLInputElement)) {
if (!hasTag(node, "INPUT")) {
return false;

@@ -30,3 +31,3 @@ }

while ((p = p.parentNode) !== null) {
if (p instanceof HTMLLabelElement) {
if (hasTag(p, "LABEL")) {
return p;

@@ -43,3 +44,3 @@ }

while ((p = p.parentNode) !== null) {
if (p instanceof HTMLLabelElement) {
if (hasTag(p, "LABEL")) {
return p;

@@ -73,3 +74,3 @@ }

obscureInputEmails: true,
defaultInputMode: 0 /* Plain */,
defaultInputMode: 0 /* InputMode.Plain */,
}, opts);

@@ -86,18 +87,18 @@ function sendInputTarget(id, node) {

if (node.type === 'password' || hasOpenreplayAttribute(node, 'hidden')) {
inputMode = 2 /* Hidden */;
inputMode = 2 /* InputMode.Hidden */;
}
else if (hasOpenreplayAttribute(node, 'obscured') ||
(inputMode === 0 /* Plain */ &&
(inputMode === 0 /* InputMode.Plain */ &&
((options.obscureInputNumbers && /\d\d\d\d/.test(value)) ||
(options.obscureInputEmails &&
(node.type === 'email' || !!~value.indexOf('@')))))) {
inputMode = 1 /* Obscured */;
inputMode = 1 /* InputMode.Obscured */;
}
let mask = 0;
switch (inputMode) {
case 2 /* Hidden */:
case 2 /* InputMode.Hidden */:
mask = -1;
value = '';
break;
case 1 /* Obscured */:
case 1 /* InputMode.Obscured */:
mask = value.length;

@@ -152,3 +153,3 @@ value = '';

// TODO: support multiple select (?): use selectedOptions; Need send target?
if (node instanceof HTMLSelectElement) {
if (hasTag(node, "SELECT")) {
sendInputValue(id, node);

@@ -155,0 +156,0 @@ app.attachEventListener(node, "change", () => {

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -0,1 +1,2 @@

import { hasTag, isSVGElement } from "../app/guards.js";
import { normSpaces, hasOpenreplayAttribute, getLabelAttribute, } from "../utils.js";

@@ -50,3 +51,3 @@ import { MouseMove, MouseClick } from "../common/messages.js";

}
if (target instanceof SVGElement) {
if (isSVGElement(target)) {
let owner = target.ownerSVGElement;

@@ -81,3 +82,3 @@ while (owner !== null) {

}
if (target instanceof HTMLInputElement) {
if (hasTag(target, "INPUT")) {
return getInputLabel(target);

@@ -84,0 +85,0 @@ }

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export declare const deviceMemory: number;

@@ -3,0 +3,0 @@ export declare const jsHeapSizeLimit: number;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;

@@ -23,7 +23,7 @@ import { SetViewportScroll, SetNodeScroll } from "../common/messages.js";

});
app.nodes.attachNodeCallback(node => {
if (node instanceof Element && node.scrollLeft + node.scrollTop > 0) {
nodeScroll.set(node, [node.scrollLeft, node.scrollTop]);
}
});
// app.nodes.attachNodeCallback(node => {
// if (isElementNode(node) && node.scrollLeft + node.scrollTop > 0) {
// nodeScroll.set(node, [node.scrollLeft, node.scrollTop]);
// }
// })
app.attachEventListener(window, 'scroll', (e) => {

@@ -30,0 +30,0 @@ const target = e.target;

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export interface Options {

@@ -3,0 +3,0 @@ captureResourceTimings: boolean;

@@ -0,1 +1,2 @@

import { hasTag } from "../app/guards.js";
import { isURL } from "../utils.js";

@@ -10,3 +11,3 @@ import { ResourceTiming, PageLoadTiming, PageRenderTiming } from "../common/messages.js";

let src = '';
if (element instanceof HTMLImageElement) {
if (hasTag(element, "IMG")) {
src = element.currentSrc || element.src;

@@ -13,0 +14,0 @@ }

@@ -1,2 +0,2 @@

import App from "../app/index.js";
import type App from "../app/index.js";
export default function (app: App): void;
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "3.5.12",
"version": "3.5.13-beta.0",
"keywords": [

@@ -6,0 +6,0 @@ "logging",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc