@openreplay/tracker 16.3.0-beta.2 → 17.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1716,6 +1716,33 @@ function SetNodeAttributeDictGlobal(id, name, value) {
1716
1716
  value,
1717
1717
  ];
1718
1718
  }
1719
+ function CSSInsertRule(id, rule, index) {
1720
+ return [
1721
+ 37 /* Messages.Type.CSSInsertRule */,
1722
+ id,
1723
+ rule,
1724
+ index,
1725
+ ];
1726
+ }
1727
+ function CSSDeleteRule(id, index) {
1728
+ return [
1729
+ 38 /* Messages.Type.CSSDeleteRule */,
1730
+ id,
1731
+ index,
1732
+ ];
1733
+ }
1734
+ function Fetch(method, url, request, response, status, timestamp, duration) {
1735
+ return [
1736
+ 39 /* Messages.Type.Fetch */,
1737
+ method,
1738
+ url,
1739
+ request,
1740
+ response,
1741
+ status,
1742
+ timestamp,
1743
+ duration,
1744
+ ];
1745
+ }
1719
1746
  function Profiler(name, duration, args, result) {
1720
1747
  return [
1721
1748
  40 /* Messages.Type.Profiler */,
@@ -1817,9 +1844,9 @@ function SetNodeAttributeDict(id, name, value) {
1817
1844
  value,
1818
1845
  ];
1819
1846
  }
1820
- function ResourceTimingDeprecated(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator) {
1847
+ function ResourceTimingDeprecatedDeprecated(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator) {
1821
1848
  return [
1822
- 53 /* Messages.Type.ResourceTimingDeprecated */,
1849
+ 53 /* Messages.Type.ResourceTimingDeprecatedDeprecated */,
1823
1850
  timestamp,
1824
1851
  duration,
1825
1852
  ttfb,
@@ -1858,6 +1885,18 @@ function SetNodeFocus(id) {
1858
1885
  id,
1859
1886
  ];
1860
1887
  }
1888
+ function LongTask(timestamp, duration, context, containerType, containerSrc, containerId, containerName) {
1889
+ return [
1890
+ 59 /* Messages.Type.LongTask */,
1891
+ timestamp,
1892
+ duration,
1893
+ context,
1894
+ containerType,
1895
+ containerSrc,
1896
+ containerId,
1897
+ containerName,
1898
+ ];
1899
+ }
1861
1900
  function SetNodeAttributeURLBased(id, name, value, baseURL) {
1862
1901
  return [
1863
1902
  60 /* Messages.Type.SetNodeAttributeURLBased */,
@@ -1889,6 +1928,15 @@ function CustomIssue(name, payload) {
1889
1928
  payload,
1890
1929
  ];
1891
1930
  }
1931
+ function CSSInsertRuleURLBased(id, rule, index, baseURL) {
1932
+ return [
1933
+ 67 /* Messages.Type.CSSInsertRuleURLBased */,
1934
+ id,
1935
+ rule,
1936
+ index,
1937
+ baseURL,
1938
+ ];
1939
+ }
1892
1940
  function MouseClick(id, hesitationTime, label, selector, normalizedX, normalizedY) {
1893
1941
  return [
1894
1942
  68 /* Messages.Type.MouseClick */,
@@ -2012,6 +2060,47 @@ function WSChannel(chType, channelName, data, timestamp, dir, messageType) {
2012
2060
  messageType,
2013
2061
  ];
2014
2062
  }
2063
+ function ResourceTiming(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator, transferredSize, cached, queueing, dnsLookup, initialConnection, ssl, contentDownload, total, stalled) {
2064
+ return [
2065
+ 85 /* Messages.Type.ResourceTiming */,
2066
+ timestamp,
2067
+ duration,
2068
+ ttfb,
2069
+ headerSize,
2070
+ encodedBodySize,
2071
+ decodedBodySize,
2072
+ url,
2073
+ initiator,
2074
+ transferredSize,
2075
+ cached,
2076
+ queueing,
2077
+ dnsLookup,
2078
+ initialConnection,
2079
+ ssl,
2080
+ contentDownload,
2081
+ total,
2082
+ stalled,
2083
+ ];
2084
+ }
2085
+ function Incident(label, startTime, endTime) {
2086
+ return [
2087
+ 87 /* Messages.Type.Incident */,
2088
+ label,
2089
+ startTime,
2090
+ endTime,
2091
+ ];
2092
+ }
2093
+ function LongAnimationTask$1(name, duration, blockingDuration, firstUIEventTimestamp, startTime, scripts) {
2094
+ return [
2095
+ 89 /* Messages.Type.LongAnimationTask */,
2096
+ name,
2097
+ duration,
2098
+ blockingDuration,
2099
+ firstUIEventTimestamp,
2100
+ startTime,
2101
+ scripts,
2102
+ ];
2103
+ }
2015
2104
  function InputChange(id, value, valueMasked, label, hesitationTime, inputDuration) {
2016
2105
  return [
2017
2106
  112 /* Messages.Type.InputChange */,
@@ -2043,9 +2132,9 @@ function UnbindNodes(totalRemovedPercent) {
2043
2132
  totalRemovedPercent,
2044
2133
  ];
2045
2134
  }
2046
- function ResourceTiming(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator, transferredSize, cached) {
2135
+ function ResourceTimingDeprecated(timestamp, duration, ttfb, headerSize, encodedBodySize, decodedBodySize, url, initiator, transferredSize, cached) {
2047
2136
  return [
2048
- 116 /* Messages.Type.ResourceTiming */,
2137
+ 116 /* Messages.Type.ResourceTimingDeprecated */,
2049
2138
  timestamp,
2050
2139
  duration,
2051
2140
  ttfb,
@@ -2127,6 +2216,9 @@ var _Messages = /*#__PURE__*/Object.freeze({
2127
2216
  AdoptedSSRemoveOwner: AdoptedSSRemoveOwner,
2128
2217
  AdoptedSSReplaceURLBased: AdoptedSSReplaceURLBased,
2129
2218
  BatchMetadata: BatchMetadata,
2219
+ CSSDeleteRule: CSSDeleteRule,
2220
+ CSSInsertRule: CSSInsertRule,
2221
+ CSSInsertRuleURLBased: CSSInsertRuleURLBased,
2130
2222
  CanvasNode: CanvasNode,
2131
2223
  ConnectionInformation: ConnectionInformation,
2132
2224
  ConsoleLog: ConsoleLog,
@@ -2136,11 +2228,15 @@ var _Messages = /*#__PURE__*/Object.freeze({
2136
2228
  CreateTextNode: CreateTextNode,
2137
2229
  CustomEvent: CustomEvent,
2138
2230
  CustomIssue: CustomIssue,
2231
+ Fetch: Fetch,
2139
2232
  GraphQL: GraphQL,
2140
2233
  GraphQLDeprecated: GraphQLDeprecated,
2234
+ Incident: Incident,
2141
2235
  InputChange: InputChange,
2142
2236
  JSException: JSException,
2143
2237
  LoadFontFace: LoadFontFace,
2238
+ LongAnimationTask: LongAnimationTask$1,
2239
+ LongTask: LongTask,
2144
2240
  Metadata: Metadata,
2145
2241
  MobX: MobX,
2146
2242
  MouseClick: MouseClick,
@@ -2163,6 +2259,7 @@ var _Messages = /*#__PURE__*/Object.freeze({
2163
2259
  RemoveNodeAttribute: RemoveNodeAttribute,
2164
2260
  ResourceTiming: ResourceTiming,
2165
2261
  ResourceTimingDeprecated: ResourceTimingDeprecated,
2262
+ ResourceTimingDeprecatedDeprecated: ResourceTimingDeprecatedDeprecated,
2166
2263
  SelectionChange: SelectionChange,
2167
2264
  SetCSSDataURLBased: SetCSSDataURLBased,
2168
2265
  SetInputChecked: SetInputChecked,
@@ -2250,7 +2347,7 @@ function Performance (app, opts) {
2250
2347
  const WATCHED_TAGS_KEY = '__or__watched_tags__';
2251
2348
  class TagWatcher {
2252
2349
  constructor(params) {
2253
- this.intervals = {};
2350
+ this.interval = null;
2254
2351
  this.tags = [];
2255
2352
  this.sessionStorage = params.sessionStorage;
2256
2353
  this.errLog = params.errLog;
@@ -2292,9 +2389,12 @@ class TagWatcher {
2292
2389
  }
2293
2390
  setTags(tags) {
2294
2391
  this.tags = tags;
2295
- this.intervals = {};
2296
- tags.forEach((tag) => {
2297
- this.intervals[tag.id] = setInterval(() => {
2392
+ if (this.interval) {
2393
+ clearInterval(this.interval);
2394
+ this.interval = null;
2395
+ }
2396
+ this.interval = setInterval(() => {
2397
+ this.tags.forEach((tag) => {
2298
2398
  const possibleEls = document.querySelectorAll(tag.selector);
2299
2399
  if (possibleEls.length > 0) {
2300
2400
  const el = possibleEls[0];
@@ -2302,21 +2402,21 @@ class TagWatcher {
2302
2402
  el.__or_watcher_tagname = tag.id;
2303
2403
  this.observer.observe(el);
2304
2404
  }
2305
- }, 500);
2306
- });
2405
+ });
2406
+ }, 500);
2307
2407
  }
2308
2408
  onTagRendered(tagId) {
2309
- if (this.intervals[tagId]) {
2310
- clearInterval(this.intervals[tagId]);
2409
+ if (this.tags.findIndex(t => t.id === tagId)) {
2410
+ this.tags = this.tags.filter((tag) => tag.id !== tagId);
2311
2411
  }
2312
2412
  this.onTag(tagId);
2313
2413
  }
2314
2414
  clear() {
2315
- this.tags.forEach((tag) => {
2316
- clearInterval(this.intervals[tag.id]);
2317
- });
2318
2415
  this.tags = [];
2319
- this.intervals = {};
2416
+ if (this.interval) {
2417
+ clearInterval(this.interval);
2418
+ this.interval = null;
2419
+ }
2320
2420
  this.observer.disconnect();
2321
2421
  }
2322
2422
  }
@@ -5191,7 +5291,7 @@ class Ticker {
5191
5291
  * this value is injected during build time via rollup
5192
5292
  * */
5193
5293
  // @ts-ignore
5194
- const workerBodyFn = "!function(){\"use strict\";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+\"/v1/web/i\",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,\"$1_$2_$3\");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h[\"Content-Encoding\"]=\"gzip\"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:\"noPageNum\"}_${null!=n?n:\"noBatchNum\"}`,{body:t,method:\"POST\",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn(\"OpenReplay:\",e),this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:\"noBatchNum\"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s=\"function\"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{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}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}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=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,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}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 70:case 75:case 76:case 77:case 82: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:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 50:case 54: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 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 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124: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 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);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 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116: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])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(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,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[0,this.timestamp],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn(\"OpenReplay: max message size overflow.\"),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(\"q_end\"===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn(\"OpenReplay: beacon size overflow. Skipping large message.\",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var h;!function(t){t[t.NotActive=0]=\"NotActive\",t[t.Starting=1]=\"Starting\",t[t.Stopping=2]=\"Stopping\",t[t.Active=3]=\"Active\",t[t.Stopped=4]=\"Stopped\"}(h||(h={}));let r=null,a=null,u=h.NotActive;function o(){a&&a.finaliseBatch()}function c(){return new Promise((t=>{u=h.Stopping,null!==p&&(clearInterval(p),p=null),a&&(a.clean(),a=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{u=h.NotActive,t(null)}),100)}))}function l(){[h.Stopped,h.Stopping].includes(u)||(postMessage(\"a_stop\"),c().then((()=>{postMessage(\"a_start\")})))}let g,p=null;self.onmessage=({data:s})=>{if(null!=s){if(\"stop\"===s)return o(),void c().then((()=>{u=h.Stopped}));if(\"forceFlushBatch\"!==s){if(!Array.isArray(s)){if(\"compressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Compressed batch.\"),void l();s.batch&&r.sendCompressed(s.batch)}if(\"uncompressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Uncompressed batch.\"),void l();s.batch&&r.sendUncompressed(s.batch)}return\"start\"===s.type?(u=h.Starting,r=new t(s.ingestPoint,(()=>{l()}),(t=>{!function(t){postMessage({type:\"failure\",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:\"compress\",batch:t},[t.buffer])}),s.pageNo),a=new n(s.pageNo,s.timestamp,s.url,(t=>{r&&r.push(t)}),s.tabId,(()=>postMessage({type:\"queue_empty\"}))),null===p&&(p=setInterval(o,1e4)),u=h.Active):\"auth\"===s.type?r?a?(r.authorise(s.token),void(s.beaconSizeLimit&&a.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug(\"OR WebWorker: writer not initialised. Received auth.\"),void l()):(console.debug(\"OR WebWorker: sender not initialised. Received auth.\"),void l()):void 0}if(a){const t=a;s.forEach((s=>{55===s[0]&&(s[1]?g=setTimeout((()=>l()),18e5):clearTimeout(g)),t.writeMessage(s)}))}else postMessage(\"not_init\"),l()}else o()}else o()}}();\n";
5294
+ const workerBodyFn = "!function(){\"use strict\";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+\"/v1/web/i\",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,\"$1_$2_$3\");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h[\"Content-Encoding\"]=\"gzip\"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:\"noPageNum\"}_${null!=n?n:\"noBatchNum\"}`,{body:t,method:\"POST\",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn(\"OpenReplay:\",e),this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:\"noBatchNum\"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s=\"function\"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{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}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}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=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,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}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 38:case 70:case 75:case 76:case 77:case 82: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:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 50:case 54: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 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 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124: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 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 37:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3]);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 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);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 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 59:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6])&&this.string(t[7]);case 67:case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 85: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])&&this.uint(t[9])&&this.boolean(t[10])&&this.uint(t[11])&&this.uint(t[12])&&this.uint(t[13])&&this.uint(t[14])&&this.uint(t[15])&&this.uint(t[16])&&this.uint(t[17]);case 87:return this.string(t[1])&&this.int(t[2])&&this.int(t[3]);case 89:return this.string(t[1])&&this.int(t[2])&&this.int(t[3])&&this.int(t[4])&&this.int(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116: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])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(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,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[0,this.timestamp],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn(\"OpenReplay: max message size overflow.\"),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(\"q_end\"===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn(\"OpenReplay: beacon size overflow. Skipping large message.\",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var h;!function(t){t[t.NotActive=0]=\"NotActive\",t[t.Starting=1]=\"Starting\",t[t.Stopping=2]=\"Stopping\",t[t.Active=3]=\"Active\",t[t.Stopped=4]=\"Stopped\"}(h||(h={}));let r=null,u=null,a=h.NotActive;function o(){u&&u.finaliseBatch()}function c(){return new Promise((t=>{a=h.Stopping,null!==p&&(clearInterval(p),p=null),u&&(u.clean(),u=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{a=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(a)||(postMessage(\"a_stop\"),c().then((()=>{postMessage(\"a_start\")})))}let l,p=null;self.onmessage=({data:s})=>{if(null!=s){if(\"stop\"===s)return o(),void c().then((()=>{a=h.Stopped}));if(\"forceFlushBatch\"!==s){if(!Array.isArray(s)){if(\"compressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Compressed batch.\"),void g();s.batch&&r.sendCompressed(s.batch)}if(\"uncompressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Uncompressed batch.\"),void g();s.batch&&r.sendUncompressed(s.batch)}return\"start\"===s.type?(a=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:\"failure\",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:\"compress\",batch:t},[t.buffer])}),s.pageNo),u=new n(s.pageNo,s.timestamp,s.url,(t=>{r&&r.push(t)}),s.tabId,(()=>postMessage({type:\"queue_empty\"}))),null===p&&(p=setInterval(o,1e4)),a=h.Active):\"auth\"===s.type?r?u?(r.authorise(s.token),void(s.beaconSizeLimit&&u.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug(\"OR WebWorker: writer not initialised. Received auth.\"),void g()):(console.debug(\"OR WebWorker: sender not initialised. Received auth.\"),void g()):void 0}if(u){const t=u;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage(\"not_init\"),g()}else o()}else o()}}();\n";
5195
5295
  const CANCELED = 'canceled';
5196
5296
  const uxtStorageKey = 'or_uxt_active';
5197
5297
  const bufferStorageKey = 'or_buffer_1';
@@ -5245,7 +5345,7 @@ class App {
5245
5345
  this.stopCallbacks = [];
5246
5346
  this.commitCallbacks = [];
5247
5347
  this.activityState = ActivityState.NotActive;
5248
- this.version = '16.3.0-beta.2'; // TODO: version compatability check inside each plugin.
5348
+ this.version = '17.0.0-beta.0'; // TODO: version compatability check inside each plugin.
5249
5349
  this.socketMode = false;
5250
5350
  this.compressionThreshold = 24 * 1000;
5251
5351
  this.bc = null;
@@ -7033,7 +7133,7 @@ function Img (app) {
7033
7133
  const sendImgError = app.safe(function (img) {
7034
7134
  const resolvedSrc = resolveURL(img.src || ''); // Src type is null sometimes. - is it true?
7035
7135
  if (isURL(resolvedSrc)) {
7036
- app.send(ResourceTiming(app.timestamp(), 0, 0, 0, 0, 0, resolvedSrc, 'img', 0, false));
7136
+ app.send(ResourceTiming(app.timestamp(), 0, 0, 0, 0, 0, resolvedSrc, 'img', 0, false, 0, 0, 0, 0, 0, 0, 0));
7037
7137
  }
7038
7138
  });
7039
7139
  const sendImgAttrs = app.safe(function (img) {
@@ -7852,14 +7952,38 @@ function Timing (app, opts) {
7852
7952
  if (shouldSkip) {
7853
7953
  return;
7854
7954
  }
7855
- const failed = entry.responseEnd === 0
7856
- || (entry.transferSize === 0 && entry.decodedBodySize === 0);
7955
+ const failed = entry.initiatorType !== 'fetch'
7956
+ ? entry.responseEnd === 0
7957
+ || (entry.transferSize === 0 && entry.decodedBodySize === 0)
7958
+ || (entry.responseStatus && entry.responseStatus >= 400)
7959
+ : entry.responseStatus && entry.responseStatus >= 400;
7960
+ // will probably require custom header added to responses for tracked fetch/xhr requests:
7961
+ // Timing-Allow-Origin: *
7962
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Timing-Allow-Origin
7963
+ let stalled = 0;
7964
+ if (entry.connectEnd && entry.connectEnd > entry.domainLookupEnd) {
7965
+ // Usual case stalled is time between connection establishment and request start
7966
+ stalled = Math.max(0, entry.requestStart - entry.connectEnd);
7967
+ }
7968
+ else {
7969
+ // Connection reuse case - stalled is time between domain lookup and request start
7970
+ stalled = Math.max(0, entry.requestStart - entry.domainLookupEnd);
7971
+ }
7972
+ const timings = {
7973
+ queueing: entry.requestStart - entry.fetchStart,
7974
+ dnsLookup: entry.domainLookupEnd - entry.domainLookupStart,
7975
+ initialConnection: entry.connectEnd - entry.connectStart,
7976
+ ssl: entry.secureConnectionStart > 0
7977
+ ? entry.connectEnd - entry.secureConnectionStart : 0,
7978
+ ttfb: entry.responseStart - entry.requestStart,
7979
+ contentDownload: entry.responseEnd - entry.responseStart,
7980
+ total: entry.duration ?? (entry.responseEnd - entry.startTime),
7981
+ stalled,
7982
+ };
7857
7983
  if (failed) {
7858
- app.send(ResourceTiming(entry.startTime + getTimeOrigin(), 0, 0, 0, 0, 0, entry.name, entry.initiatorType, 0, true));
7984
+ app.send(ResourceTiming(entry.startTime + getTimeOrigin(), 0, timings.ttfb, 0, 0, 0, entry.name, entry.initiatorType, 0, false, timings.queueing, timings.dnsLookup, timings.initialConnection, timings.ssl, timings.contentDownload, timings.total, timings.stalled));
7859
7985
  }
7860
- app.send(ResourceTiming(entry.startTime + getTimeOrigin(), entry.duration, entry.responseStart && entry.startTime ? entry.responseStart - entry.startTime : 0, entry.transferSize > entry.encodedBodySize ? entry.transferSize - entry.encodedBodySize : 0, entry.encodedBodySize || 0, entry.decodedBodySize || 0, app.sanitizer.privateMode ? entry.name.replaceAll(/./g, '*') : entry.name, entry.initiatorType, entry.transferSize,
7861
- // @ts-ignore
7862
- (entry.responseStatus && entry.responseStatus === 304) || entry.transferSize === 0));
7986
+ app.send(ResourceTiming(entry.startTime + getTimeOrigin(), entry.duration, timings.ttfb, entry.transferSize > entry.encodedBodySize ? entry.transferSize - entry.encodedBodySize : 0, entry.encodedBodySize || 0, entry.decodedBodySize || 0, app.sanitizer.privateMode ? entry.name.replaceAll(/./g, '*') : entry.name, entry.initiatorType, entry.transferSize, (entry.responseStatus && entry.responseStatus === 304) || entry.transferSize === 0, timings.queueing, timings.dnsLookup, timings.initialConnection, timings.ssl, timings.contentDownload, timings.total, timings.stalled));
7863
7987
  }
7864
7988
  const observer = new PerformanceObserver((list) => list.getEntries().forEach(resourceTiming));
7865
7989
  function onVitalsSignal(msg) {
@@ -8477,6 +8601,152 @@ function isObject(thing) {
8477
8601
  return thing !== null && typeof thing === 'object';
8478
8602
  }
8479
8603
 
8604
+ const sensitiveParams = new Set([
8605
+ "password",
8606
+ "pass",
8607
+ "pwd",
8608
+ "mdp",
8609
+ "token",
8610
+ "bearer",
8611
+ "jwt",
8612
+ "api_key",
8613
+ "api-key",
8614
+ "apiKey",
8615
+ "secret",
8616
+ "ssn",
8617
+ "zip",
8618
+ "zipcode",
8619
+ "x-api-key",
8620
+ "www-authenticate",
8621
+ "x-csrf-token",
8622
+ "x-requested-with",
8623
+ "x-forwarded-for",
8624
+ "x-real-ip",
8625
+ "cookie",
8626
+ "authorization",
8627
+ "auth",
8628
+ "proxy-authorization",
8629
+ "set-cookie",
8630
+ "account_key",
8631
+ ]);
8632
+ function numDigits(x) {
8633
+ return (Math.log10((x ^ (x >> 31)) - (x >> 31)) | 0) + 1;
8634
+ }
8635
+ function obscure(value) {
8636
+ if (typeof value === "number") {
8637
+ const digits = numDigits(value);
8638
+ return "9".repeat(digits);
8639
+ }
8640
+ if (typeof value === "string") {
8641
+ return value.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g, '*');
8642
+ }
8643
+ return value;
8644
+ }
8645
+ function filterHeaders(headers) {
8646
+ const filteredHeaders = {};
8647
+ if (Array.isArray(headers)) {
8648
+ headers.forEach(({ name, value }) => {
8649
+ if (sensitiveParams.has(name.toLowerCase())) {
8650
+ filteredHeaders[name] = obscure(value);
8651
+ }
8652
+ else {
8653
+ filteredHeaders[name] = value;
8654
+ }
8655
+ });
8656
+ }
8657
+ else {
8658
+ for (const [key, value] of Object.entries(headers)) {
8659
+ if (sensitiveParams.has(key.toLowerCase())) {
8660
+ filteredHeaders[key] = obscure(value);
8661
+ }
8662
+ else {
8663
+ filteredHeaders[key] = value;
8664
+ }
8665
+ }
8666
+ }
8667
+ return filteredHeaders;
8668
+ }
8669
+ function filterBody(body) {
8670
+ if (!body) {
8671
+ return body;
8672
+ }
8673
+ let parsedBody;
8674
+ let isJSON = false;
8675
+ try {
8676
+ parsedBody = JSON.parse(body);
8677
+ isJSON = true;
8678
+ }
8679
+ catch (e) {
8680
+ // not json
8681
+ }
8682
+ if (isJSON) {
8683
+ obscureSensitiveData(parsedBody);
8684
+ return JSON.stringify(parsedBody);
8685
+ }
8686
+ else {
8687
+ const isUrlSearch = typeof body === "string" && body.includes("?") && body.includes("=");
8688
+ if (isUrlSearch) {
8689
+ try {
8690
+ const params = new URLSearchParams(body);
8691
+ for (const key of params.keys()) {
8692
+ if (sensitiveParams.has(key.toLowerCase())) {
8693
+ const value = obscure(params.get(key));
8694
+ params.set(key, value);
8695
+ }
8696
+ }
8697
+ return params.toString();
8698
+ }
8699
+ catch (e) {
8700
+ // not url query ?
8701
+ return body;
8702
+ }
8703
+ }
8704
+ else {
8705
+ // not json or url query
8706
+ return body;
8707
+ }
8708
+ }
8709
+ }
8710
+ function sanitizeObject(obj) {
8711
+ obscureSensitiveData(obj);
8712
+ return obj;
8713
+ }
8714
+ function obscureSensitiveData(obj) {
8715
+ if (Array.isArray(obj)) {
8716
+ obj.forEach(obscureSensitiveData);
8717
+ }
8718
+ else if (obj && typeof obj === "object") {
8719
+ for (const key in obj) {
8720
+ if (Object.hasOwn(obj, key)) {
8721
+ if (sensitiveParams.has(key.toLowerCase())) {
8722
+ obj[key] = obscure(obj[key]);
8723
+ }
8724
+ else if (obj[key] !== null && typeof obj[key] === "object") {
8725
+ obscureSensitiveData(obj[key]);
8726
+ }
8727
+ }
8728
+ }
8729
+ }
8730
+ }
8731
+ function tryFilterUrl(url) {
8732
+ if (!url)
8733
+ return "";
8734
+ try {
8735
+ const urlObj = new URL(url);
8736
+ if (urlObj.searchParams) {
8737
+ for (const key of urlObj.searchParams.keys()) {
8738
+ if (sensitiveParams.has(key.toLowerCase())) {
8739
+ urlObj.searchParams.set(key, "******");
8740
+ }
8741
+ }
8742
+ }
8743
+ return urlObj.toString();
8744
+ }
8745
+ catch (e) {
8746
+ return url;
8747
+ }
8748
+ }
8749
+
8480
8750
  /**
8481
8751
  * I know we're not using most of the information from this class
8482
8752
  * but it can be useful in the future if we will decide to display more stuff in our ui
@@ -8508,13 +8778,18 @@ class NetworkMessage {
8508
8778
  }
8509
8779
  getMessage() {
8510
8780
  const { reqHs, resHs } = this.writeHeaders();
8781
+ const reqBody = this.method === 'GET'
8782
+ ? JSON.stringify(sanitizeObject(this.getData)) : filterBody(this.requestData);
8511
8783
  const request = {
8512
- headers: reqHs,
8513
- body: this.method === 'GET' ? JSON.stringify(this.getData) : this.requestData,
8784
+ headers: filterHeaders(reqHs),
8785
+ body: reqBody,
8786
+ };
8787
+ const response = {
8788
+ headers: filterHeaders(resHs),
8789
+ body: filterBody(this.response)
8514
8790
  };
8515
- const response = { headers: resHs, body: this.response };
8516
8791
  const messageInfo = this.sanitize({
8517
- url: this.url,
8792
+ url: tryFilterUrl(this.url),
8518
8793
  method: this.method,
8519
8794
  status: this.status,
8520
8795
  request,
@@ -8830,9 +9105,10 @@ class ResponseProxyHandler {
8830
9105
  if (typeof this.resp.body.getReader !== 'function') {
8831
9106
  return;
8832
9107
  }
8833
- const _getReader = this.resp.body.getReader;
9108
+ const clonedResp = this.resp.clone();
9109
+ const _getReader = clonedResp.body.getReader;
8834
9110
  // @ts-ignore
8835
- this.resp.body.getReader = () => {
9111
+ clonedResp.body.getReader = () => {
8836
9112
  const reader = _getReader.apply(this.resp.body);
8837
9113
  // when readyState is already 4,
8838
9114
  // it's not a chunked stream, or it had already been read.
@@ -9623,6 +9899,33 @@ function Tabs (app) {
9623
9899
  app.attachEventListener(window, 'focus', changeTab, false, false);
9624
9900
  }
9625
9901
 
9902
+ function LongAnimationTask (app, opts) {
9903
+ if (!opts.longTasks || !('PerformanceObserver' in window)) {
9904
+ return;
9905
+ }
9906
+ const onEntry = (entry) => {
9907
+ app.send(LongAnimationTask$1(entry.name, entry.duration, entry.blockingDuration, entry.firstUIEventTimestamp, entry.startTime, JSON.stringify(entry.scripts ?? [])));
9908
+ };
9909
+ const observer = new PerformanceObserver((entryList) => {
9910
+ entryList.getEntries().forEach((entry) => {
9911
+ if (entry.entryType === 'long-animation-frame') {
9912
+ onEntry(entry);
9913
+ }
9914
+ });
9915
+ });
9916
+ app.attachStartCallback(() => {
9917
+ performance.getEntriesByType('long-animation-frame').forEach((lat) => {
9918
+ onEntry(lat);
9919
+ });
9920
+ observer.observe({
9921
+ entryTypes: ['long-animation-frame'],
9922
+ });
9923
+ });
9924
+ app.attachStopCallback(() => {
9925
+ observer.disconnect();
9926
+ });
9927
+ }
9928
+
9626
9929
  const Messages = _Messages;
9627
9930
  const DOCS_SETUP = '/en/sdk';
9628
9931
  function processOptions(obj) {
@@ -9674,7 +9977,7 @@ class API {
9674
9977
  this.signalStartIssue = (reason, missingApi) => {
9675
9978
  const doNotTrack = this.checkDoNotTrack();
9676
9979
  console.log("Tracker couldn't start due to:", JSON.stringify({
9677
- trackerVersion: '16.3.0-beta.2',
9980
+ trackerVersion: '17.0.0-beta.0',
9678
9981
  projectKey: this.options.projectKey,
9679
9982
  doNotTrack,
9680
9983
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
@@ -9702,6 +10005,12 @@ class API {
9702
10005
  }
9703
10006
  }
9704
10007
  };
10008
+ this.incident = (options) => {
10009
+ if (this.app === null) {
10010
+ return;
10011
+ }
10012
+ this.app.send(Incident(options.label ?? '', options.startTime, options.endTime ?? options.startTime));
10013
+ };
9705
10014
  this.crossdomainMode = Boolean(inIframe() && options.crossdomain?.enabled);
9706
10015
  if (!IN_BROWSER || !processOptions(options)) {
9707
10016
  return;
@@ -9780,6 +10089,7 @@ class API {
9780
10089
  Img(app);
9781
10090
  Input(app, options);
9782
10091
  Timing(app, options);
10092
+ LongAnimationTask(app, options);
9783
10093
  Focus(app);
9784
10094
  Fonts(app);
9785
10095
  const skipNetwork = options.network?.disabled;