@openreplay/tracker 12.1.0-beta.99 → 13.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 13.0.0
2
+
3
+ - `assistOnly` flag for tracker options (EE only feature)
4
+
1
5
  # 12.0.12
2
6
 
3
7
  - fix for potential redux plugin issues after .11 ...
package/bun.lockb CHANGED
Binary file
@@ -11,12 +11,13 @@ import type { Options as ObserverOptions } from './observer/top_observer.js';
11
11
  import type { Options as SanitizerOptions } from './sanitizer.js';
12
12
  import type { Options as SessOptions } from './session.js';
13
13
  import type { Options as NetworkOptions } from '../modules/network.js';
14
- import type { Options as WebworkerOptions, FromWorkerData } from '../common/interaction.js';
14
+ import type { Options as WebworkerOptions } from '../common/interaction.js';
15
15
  export interface StartOptions {
16
16
  userID?: string;
17
17
  metadata?: Record<string, string>;
18
18
  forceNew?: boolean;
19
19
  sessionHash?: string;
20
+ assistOnly?: boolean;
20
21
  }
21
22
  interface OnStartInfo {
22
23
  sessionID: string;
@@ -90,20 +91,20 @@ export default class App {
90
91
  private readonly revID;
91
92
  private activityState;
92
93
  private readonly version;
93
- private readonly workerManager?;
94
+ private readonly worker?;
95
+ attributeSender: AttributeSender;
96
+ featureFlags: FeatureFlags;
97
+ socketMode: boolean;
94
98
  private compressionThreshold;
95
99
  private restartAttempts;
96
100
  private readonly bc;
97
101
  private readonly contextId;
98
- attributeSender: AttributeSender;
99
102
  private canvasRecorder;
100
103
  private uxtManager;
101
104
  private conditionsManager;
102
- featureFlags: FeatureFlags;
103
105
  private readonly tagWatcher;
104
106
  constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void);
105
- handleWorkerMsg(data: FromWorkerData): void;
106
- private readonly _debug;
107
+ private _debug;
107
108
  private _usingOldFetchPlugin;
108
109
  send(message: Message, urgent?: boolean): void;
109
110
  /**
@@ -161,7 +162,7 @@ export default class App {
161
162
  private checkSessionToken;
162
163
  /**
163
164
  * start buffering messages without starting the actual session, which gives
164
- * user 30 seconds to "activate" and record session by calling `start()` on conditional trigger,
165
+ * user 30 seconds to "activate" and record session by calling `start()` on conditional trigger
165
166
  * and we will then send buffered batch, so it won't get lost
166
167
  * */
167
168
  coldStart(startOpts?: StartOptions, conditional?: boolean): Promise<void>;
@@ -179,7 +180,7 @@ export default class App {
179
180
  /**
180
181
  * Saves the captured messages in localStorage (or whatever is used in its place)
181
182
  *
182
- * Then, when this.offlineRecording is called, it will preload this messages and clear the storage item
183
+ * Then when this.offlineRecording is called, it will preload this messages and clear the storage item
183
184
  *
184
185
  * Keeping the size of local storage reasonable is up to the end users of this library
185
186
  * */
package/cjs/app/index.js CHANGED
@@ -44,7 +44,6 @@ const attributeSender_js_1 = __importDefault(require("../modules/attributeSender
44
44
  const canvas_js_1 = __importDefault(require("./canvas.js"));
45
45
  const index_js_1 = __importDefault(require("../modules/userTesting/index.js"));
46
46
  const tagWatcher_js_1 = __importDefault(require("../modules/tagWatcher.js"));
47
- const index_js_2 = __importDefault(require("./workerManager/index.js"));
48
47
  const CANCELED = 'canceled';
49
48
  const uxtStorageKey = 'or_uxt_active';
50
49
  const bufferStorageKey = 'or_buffer_1';
@@ -81,26 +80,13 @@ class App {
81
80
  this.stopCallbacks = [];
82
81
  this.commitCallbacks = [];
83
82
  this.activityState = ActivityState.NotActive;
84
- this.version = '12.1.0-beta.99'; // TODO: version compatability check inside each plugin.
83
+ this.version = '13.0.0'; // TODO: version compatability check inside each plugin.
84
+ this.socketMode = false;
85
85
  this.compressionThreshold = 24 * 1000;
86
86
  this.restartAttempts = 0;
87
87
  this.bc = null;
88
88
  this.canvasRecorder = null;
89
89
  this.conditionsManager = null;
90
- this._debug = (context, e) => {
91
- if (this.options.__debug_report_edp !== null) {
92
- void fetch(this.options.__debug_report_edp, {
93
- method: 'POST',
94
- headers: { 'Content-Type': 'application/json' },
95
- body: JSON.stringify({
96
- context,
97
- // @ts-ignore
98
- error: `${e}`,
99
- }),
100
- });
101
- }
102
- this.debug.error('OpenReplay error: ', context, e);
103
- };
104
90
  this._usingOldFetchPlugin = false;
105
91
  this.coldStartCommitN = 0;
106
92
  this.delay = 0;
@@ -156,6 +142,7 @@ class App {
156
142
  assistSocketHost: '',
157
143
  fixedCanvasScaling: false,
158
144
  disableCanvas: false,
145
+ assistOnly: false,
159
146
  }, options);
160
147
  if (!this.options.forceSingleTab && globalThis && 'BroadcastChannel' in globalThis) {
161
148
  const host = location.hostname.split('.').slice(-2).join('_');
@@ -190,11 +177,51 @@ class App {
190
177
  this.session.applySessionHash(sessionToken);
191
178
  }
192
179
  try {
193
- const webworker = new Worker(URL.createObjectURL(new Blob(['"use strict";const t="function"==typeof TextEncoder?new TextEncoder:{encode(t){const i=t.length,s=new Uint8Array(3*i);let e=-1;for(let n=0,r=0,h=0;h!==i;){if(n=t.charCodeAt(h),h+=1,n>=55296&&n<=56319){if(h===i){s[e+=1]=239,s[e+=1]=191,s[e+=1]=189;break}if(r=t.charCodeAt(h),!(r>=56320&&r<=57343)){s[e+=1]=239,s[e+=1]=191,s[e+=1]=189;continue}if(n=1024*(n-55296)+r-56320+65536,h+=1,n>65535){s[e+=1]=240|n>>>18,s[e+=1]=128|n>>>12&63,s[e+=1]=128|n>>>6&63,s[e+=1]=128|63&n;continue}}n<=127?s[e+=1]=0|n:n<=2047?(s[e+=1]=192|n>>>6,s[e+=1]=128|63&n):(s[e+=1]=224|n>>>12,s[e+=1]=128|n>>>6&63,s[e+=1]=128|63&n)}return s.subarray(0,e+1)}};class 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,i){this.data.set(t,i)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(i){const s=t.encode(i),e=s.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(s,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class s 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 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17: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 63:case 64:case 79: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:case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 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 69:return this.uint(t[1])&&this.uint(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])}}}class e{constructor(t,i,e,n,r,h){this.pageNo=t,this.timestamp=i,this.url=e,this.onBatch=n,this.tabId=r,this.onOfflineEnd=h,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new s(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,i){for(let i=0;i<3;i++)this.sizeBuffer[i]=t>>8*i;this.encoder.set(this.sizeBuffer,i)}prepare(){if(!this.encoder.isEmpty)return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const i=this.encoder;if(!this.writeType(t)||!i.skip(3))return!1;const s=i.getCurrentOffset(),e=this.writeFields(t);if(e){const e=i.getCurrentOffset()-s;if(e>16777215)return console.warn("OpenReplay: max message size overflow."),!1;this.writeSizeAt(e,s-3),i.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if("q_end"===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),4===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new s(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn("OpenReplay: beacon size overflow. Skipping large message.",t,this),this.encoder=new s(this.beaconSize),this.prepare()))}finaliseBatch(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var n;!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active",t[t.Stopped=4]="Stopped"}(n||(n={}));let r=null,h=n.NotActive;function a(t){postMessage({type:"status",data:t}),h=t}function u(){r&&r.finaliseBatch()}function c(){a(n.Stopping),null!==f&&(clearInterval(f),f=null),r&&(r.clean(),r=null),setTimeout((()=>{a(n.NotActive)}),100)}function o(){h!==n.Stopped&&(postMessage({type:"restart"}),c())}let f=null;self.onmessage=({data:t})=>{if(null!=t){if("writer_finalize"===t.type)return u(),h=n.Stopped;if("reset_writer"!==t.type){if("forceFlushBatch"!==t.type){if("to_writer"===t.type){let i=!1;t.data.forEach((t=>{r?r.writeMessage(t):i||(i=!0,postMessage({type:"not_init"}),o())}))}return"start"===t.type?(h=n.Starting,r=new e(t.pageNo,t.timestamp,t.url,(t=>{postMessage({type:"batch_ready",data:t},[t.buffer])}),t.tabId,(()=>postMessage({type:"queue_empty"}))),null===f&&(f=setInterval(u,1e4)),h=n.Active):"beacon_size_limit"===t.type?r?void(t.beaconSizeLimit&&r.setBeaconSizeLimit(t.beaconSizeLimit)):(console.debug("OR WebWorker: writer not initialised. Received auth."),void o()):void("restart"===t.type&&o())}u()}else c()}else u()};'], { type: 'text/javascript' })));
194
- this.workerManager = new index_js_2.default(this, webworker, this._debug);
180
+ this.worker = new Worker(URL.createObjectURL(new Blob(['"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){const e=i?.toString().replace(/^([^_]+)_([^_]+).*/,"$1_$2_$3");this.busy=!0;const n={Authorization:`Bearer ${this.token}`};s&&(n["Content-Encoding"]="gzip"),null!==this.token?fetch(`${this.ingestURL}?batch=${this.pageNo??"noPageNum"}_${e??"noBatchNum"}`,{body:t,method:"POST",headers:n,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${i??"noBatchNum"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn("OpenReplay:",e),this.retry(t,s,`${i??"noBatchNum"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${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 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17: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 63:case 64:case 79: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:case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 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 69:return this.uint(t[1])&&this.uint(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])}}}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=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),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]),4===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!==l&&(clearInterval(l),l=null),a&&(a.clean(),a=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{u=h.NotActive,t(null)}),100)}))}function p(){u!==h.Stopped&&(postMessage("a_stop"),c().then((()=>{postMessage("a_start")})))}let g,l=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 p();s.batch&&r.sendCompressed(s.batch)}if("uncompressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void p();s.batch&&r.sendUncompressed(s.batch)}return"start"===s.type?(u=h.Starting,r=new t(s.ingestPoint,(()=>{p()}),(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===l&&(l=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 p()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void p()):void 0}if(a){const t=a;s.forEach((s=>{55===s[0]&&(s[1]?g=setTimeout((()=>p()),18e5):clearTimeout(g)),t.writeMessage(s)}))}else postMessage("not_init"),p()}else o()}else o()};'], { type: 'text/javascript' })));
181
+ this.worker.onerror = (e) => {
182
+ this._debug('webworker_error', e);
183
+ };
184
+ this.worker.onmessage = ({ data }) => {
185
+ // handling 401 auth restart (new token assignment)
186
+ if (data === 'a_stop') {
187
+ this.stop(false);
188
+ }
189
+ else if (data === 'a_start') {
190
+ void this.start({}, true);
191
+ }
192
+ else if (data === 'not_init') {
193
+ this.debug.warn('OR WebWorker: writer not initialised. Restarting tracker');
194
+ }
195
+ else if (data.type === 'failure') {
196
+ this.stop(false);
197
+ this.debug.error('worker_failed', data.reason);
198
+ this._debug('worker_failed', data.reason);
199
+ }
200
+ else if (data.type === 'compress') {
201
+ const batch = data.batch;
202
+ const batchSize = batch.byteLength;
203
+ if (batchSize > this.compressionThreshold) {
204
+ (0, fflate_1.gzip)(data.batch, { mtime: 0 }, (err, result) => {
205
+ if (err) {
206
+ this.debug.error('Openreplay compression error:', err);
207
+ this.worker?.postMessage({ type: 'uncompressed', batch: batch });
208
+ }
209
+ else {
210
+ this.worker?.postMessage({ type: 'compressed', batch: result });
211
+ }
212
+ });
213
+ }
214
+ else {
215
+ this.worker?.postMessage({ type: 'uncompressed', batch: batch });
216
+ }
217
+ }
218
+ else if (data.type === 'queue_empty') {
219
+ this.onSessionSent();
220
+ }
221
+ };
195
222
  const alertWorker = () => {
196
- if (this.workerManager) {
197
- this.workerManager.processMessage(null);
223
+ if (this.worker) {
224
+ this.worker.postMessage(null);
198
225
  }
199
226
  };
200
227
  // keep better tactics, discard others?
@@ -213,7 +240,7 @@ class App {
213
240
  // yes, there are someone out there
214
241
  resp: 'never-gonna-let-you-down',
215
242
  // you stole someone's identity
216
- regen: 'never-gonna-run-around-and-desert-you',
243
+ reg: 'never-gonna-run-around-and-desert-you',
217
244
  };
218
245
  if (this.bc) {
219
246
  this.bc.postMessage({
@@ -231,7 +258,7 @@ class App {
231
258
  const sessionToken = ev.data.token;
232
259
  this.session.setSessionToken(sessionToken);
233
260
  }
234
- if (ev.data.line === proto.regen) {
261
+ if (ev.data.line === proto.reg) {
235
262
  const sessionToken = ev.data.token;
236
263
  this.session.regenerateTabId();
237
264
  this.session.setSessionToken(sessionToken);
@@ -240,7 +267,7 @@ class App {
240
267
  const token = this.session.getSessionToken();
241
268
  if (token && this.bc) {
242
269
  this.bc.postMessage({
243
- line: ev.data.source === thisTab ? proto.regen : proto.resp,
270
+ line: ev.data.source === thisTab ? proto.reg : proto.resp,
244
271
  token,
245
272
  source: thisTab,
246
273
  context: this.contextId,
@@ -250,44 +277,19 @@ class App {
250
277
  };
251
278
  }
252
279
  }
253
- handleWorkerMsg(data) {
254
- if (data.type === 'restart') {
255
- this.stop(false);
256
- void this.start({}, true);
257
- }
258
- else if (data.type === 'not_init') {
259
- this.debug.warn('OR WebWorker: writer not initialised; restarting worker');
260
- }
261
- else if (data.type === 'failure') {
262
- this.stop(false);
263
- this.debug.error('worker_failed', data.reason);
264
- this._debug('worker_failed', data.reason);
265
- }
266
- else if (data.type === 'compress') {
267
- const batch = data.batch;
268
- const batchSize = batch.byteLength;
269
- if (batchSize > this.compressionThreshold) {
270
- (0, fflate_1.gzip)(data.batch, { mtime: 0 }, (err, result) => {
271
- if (err) {
272
- this.debug.error('Openreplay compression error:', err);
273
- this.stop(false);
274
- if (this.restartAttempts < 3) {
275
- this.restartAttempts += 1;
276
- void this.start({}, true);
277
- }
278
- }
279
- else {
280
- this.workerManager?.sendCompressedBatch(result);
281
- }
282
- });
283
- }
284
- else {
285
- this.workerManager?.sendUncompressedBatch(batch);
286
- }
287
- }
288
- else if (data.type === 'queue_empty') {
289
- this.onSessionSent();
280
+ _debug(context, e) {
281
+ if (this.options.__debug_report_edp !== null) {
282
+ void fetch(this.options.__debug_report_edp, {
283
+ method: 'POST',
284
+ headers: { 'Content-Type': 'application/json' },
285
+ body: JSON.stringify({
286
+ context,
287
+ // @ts-ignore
288
+ error: `${e}`,
289
+ }),
290
+ });
290
291
  }
292
+ this.debug.error('OpenReplay error: ', context, e);
291
293
  }
292
294
  send(message, urgent = false) {
293
295
  if (this.activityState === ActivityState.NotActive) {
@@ -327,15 +329,31 @@ class App {
327
329
  * every ~30ms
328
330
  * */
329
331
  _nCommit() {
330
- if (this.workerManager !== undefined && this.messages.length) {
331
- (0, utils_js_1.requestIdleCb)(() => {
332
- this.messages.unshift((0, messages_gen_js_2.TabData)(this.session.getTabId()));
333
- this.messages.unshift((0, messages_gen_js_2.Timestamp)(this.timestamp()));
334
- // why I need to add opt chaining?
335
- this.workerManager?.processMessage({ type: 'batch', data: this.messages });
336
- this.commitCallbacks.forEach((cb) => cb(this.messages));
337
- this.messages.length = 0;
338
- });
332
+ if (this.socketMode) {
333
+ this.messages.unshift((0, messages_gen_js_2.TabData)(this.session.getTabId()));
334
+ this.messages.unshift((0, messages_gen_js_2.Timestamp)(this.timestamp()));
335
+ this.commitCallbacks.forEach((cb) => cb(this.messages));
336
+ this.messages.length = 0;
337
+ return;
338
+ }
339
+ if (this.worker !== undefined && this.messages.length) {
340
+ try {
341
+ (0, utils_js_1.requestIdleCb)(() => {
342
+ this.messages.unshift((0, messages_gen_js_2.TabData)(this.session.getTabId()));
343
+ this.messages.unshift((0, messages_gen_js_2.Timestamp)(this.timestamp()));
344
+ // why I need to add opt chaining?
345
+ this.worker?.postMessage(this.messages);
346
+ this.commitCallbacks.forEach((cb) => cb(this.messages));
347
+ this.messages.length = 0;
348
+ });
349
+ }
350
+ catch (e) {
351
+ this._debug('worker_commit', e);
352
+ this.stop(true);
353
+ setTimeout(() => {
354
+ void this.start();
355
+ }, 500);
356
+ }
339
357
  }
340
358
  }
341
359
  /**
@@ -363,7 +381,7 @@ class App {
363
381
  }
364
382
  }
365
383
  postToWorker(messages) {
366
- this.workerManager?.processMessage({ type: 'batch', data: messages });
384
+ this.worker?.postMessage(messages);
367
385
  this.commitCallbacks.forEach((cb) => cb(messages));
368
386
  messages.length = 0;
369
387
  }
@@ -510,7 +528,7 @@ class App {
510
528
  }
511
529
  /**
512
530
  * start buffering messages without starting the actual session, which gives
513
- * user 30 seconds to "activate" and record session by calling `start()` on conditional trigger,
531
+ * user 30 seconds to "activate" and record session by calling `start()` on conditional trigger
514
532
  * and we will then send buffered batch, so it won't get lost
515
533
  * */
516
534
  async coldStart(startOpts = {}, conditional) {
@@ -646,7 +664,7 @@ class App {
646
664
  /**
647
665
  * Saves the captured messages in localStorage (or whatever is used in its place)
648
666
  *
649
- * Then, when this.offlineRecording is called, it will preload this messages and clear the storage item
667
+ * Then when this.offlineRecording is called, it will preload this messages and clear the storage item
650
668
  *
651
669
  * Keeping the size of local storage reasonable is up to the end users of this library
652
670
  * */
@@ -675,7 +693,7 @@ class App {
675
693
  async uploadOfflineRecording() {
676
694
  this.stop(false);
677
695
  const timestamp = (0, utils_js_1.now)();
678
- this.workerManager?.processMessage({
696
+ this.worker?.postMessage({
679
697
  type: 'start',
680
698
  pageNo: this.session.incPageNo(),
681
699
  ingestPoint: this.options.ingestPoint,
@@ -703,7 +721,8 @@ class App {
703
721
  }),
704
722
  });
705
723
  const { token, userBrowser, userCity, userCountry, userDevice, userOS, userState, beaconSizeLimit, projectID, } = await r.json();
706
- this.workerManager?.authorizeWorker({
724
+ this.worker?.postMessage({
725
+ type: 'auth',
707
726
  token,
708
727
  beaconSizeLimit,
709
728
  });
@@ -727,7 +746,7 @@ class App {
727
746
  if (isColdStart && this.coldInterval) {
728
747
  clearInterval(this.coldInterval);
729
748
  }
730
- if (!this.workerManager) {
749
+ if (!this.worker) {
731
750
  const reason = 'No worker found: perhaps, CSP is not set.';
732
751
  this.signalError(reason, []);
733
752
  return Promise.resolve(UnsuccessfulStart(reason));
@@ -754,7 +773,7 @@ class App {
754
773
  metadata: startOpts.metadata,
755
774
  });
756
775
  const timestamp = (0, utils_js_1.now)();
757
- this.workerManager?.startWorker({
776
+ this.worker.postMessage({
758
777
  type: 'start',
759
778
  pageNo: this.session.incPageNo(),
760
779
  ingestPoint: this.options.ingestPoint,
@@ -785,6 +804,7 @@ class App {
785
804
  jsHeapSizeLimit: performance_js_1.jsHeapSizeLimit,
786
805
  timezone: getTimezone(),
787
806
  condition: conditionName,
807
+ assistOnly: startOpts.assistOnly ?? this.socketMode,
788
808
  }),
789
809
  })
790
810
  .then((r) => {
@@ -800,7 +820,7 @@ class App {
800
820
  }
801
821
  })
802
822
  .then(async (r) => {
803
- if (!this.workerManager) {
823
+ if (!this.worker) {
804
824
  const reason = 'no worker found after start request (this might not happen)';
805
825
  this.signalError(reason, []);
806
826
  return Promise.reject(reason);
@@ -814,7 +834,7 @@ class App {
814
834
  delay, // derived from token
815
835
  sessionID, // derived from token
816
836
  startTimestamp, // real startTS (server time), derived from sessionID
817
- userBrowser, userCity, userCountry, userDevice, userOS, userState, canvasEnabled, canvasQuality, canvasFPS, } = r;
837
+ userBrowser, userCity, userCountry, userDevice, userOS, userState, canvasEnabled, canvasQuality, canvasFPS, assistOnly: socketOnly, } = r;
818
838
  if (typeof token !== 'string' ||
819
839
  typeof userUUID !== 'string' ||
820
840
  (typeof startTimestamp !== 'number' && typeof startTimestamp !== 'undefined') ||
@@ -840,10 +860,17 @@ class App {
840
860
  timestamp: startTimestamp || timestamp,
841
861
  projectID,
842
862
  });
843
- this.workerManager?.authorizeWorker({
844
- token,
845
- beaconSizeLimit,
846
- });
863
+ if (socketOnly) {
864
+ this.socketMode = true;
865
+ this.worker.postMessage('stop');
866
+ }
867
+ else {
868
+ this.worker.postMessage({
869
+ type: 'auth',
870
+ token,
871
+ beaconSizeLimit,
872
+ });
873
+ }
847
874
  if (!isNewSession && token === sessionToken) {
848
875
  this.debug.log('continuing session on new tab', this.session.getTabId());
849
876
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
@@ -975,7 +1002,7 @@ class App {
975
1002
  }
976
1003
  }
977
1004
  forceFlushBatch() {
978
- this.workerManager?.processMessage({ type: 'forceFlushBatch' });
1005
+ this.worker?.postMessage('forceFlushBatch');
979
1006
  }
980
1007
  getTabId() {
981
1008
  return this.session.getTabId();
@@ -1012,8 +1039,8 @@ class App {
1012
1039
  this.stopCallbacks.forEach((cb) => cb());
1013
1040
  this.debug.log('OpenReplay tracking stopped.');
1014
1041
  this.tagWatcher.clear();
1015
- if (this.workerManager && stopWorker) {
1016
- this.workerManager?.stopWorker();
1042
+ if (this.worker && stopWorker) {
1043
+ this.worker.postMessage('stop');
1017
1044
  }
1018
1045
  this.canvasRecorder?.clear();
1019
1046
  }
@@ -31,7 +31,7 @@ export declare function Fetch(method: string, url: string, request: string, resp
31
31
  export declare function Profiler(name: string, duration: number, args: string, result: string): Messages.Profiler;
32
32
  export declare function OTable(key: string, value: string): Messages.OTable;
33
33
  export declare function StateAction(type: string): Messages.StateAction;
34
- export declare function Redux(action: string, state: string, duration: number): Messages.Redux;
34
+ export declare function ReduxDeprecated(action: string, state: string, duration: number): Messages.ReduxDeprecated;
35
35
  export declare function Vuex(mutation: string, state: string): Messages.Vuex;
36
36
  export declare function MobX(type: string, payload: string): Messages.MobX;
37
37
  export declare function NgRx(action: string, state: string, duration: number): Messages.NgRx;
@@ -72,4 +72,4 @@ export declare function TabChange(tabId: string): Messages.TabChange;
72
72
  export declare function TabData(tabId: string): Messages.TabData;
73
73
  export declare function CanvasNode(nodeId: string, timestamp: number): Messages.CanvasNode;
74
74
  export declare function TagTrigger(tagId: number): Messages.TagTrigger;
75
- export declare function ReduxNew(action: string, state: string, duration: number, actionTime: number): Messages.ReduxNew;
75
+ export declare function Redux(action: string, state: string, duration: number, actionTime: number): Messages.Redux;
@@ -2,8 +2,8 @@
2
2
  // Auto-generated, do not edit
3
3
  /* eslint-disable */
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.CSSInsertRuleURLBased = exports.CustomIssue = exports.TechnicalInfo = exports.SetCSSDataURLBased = exports.SetNodeAttributeURLBased = exports.LongTask = exports.SetNodeFocus = exports.LoadFontFace = exports.SetPageVisibility = exports.ConnectionInformation = exports.ResourceTimingDeprecated = exports.SetNodeAttributeDict = exports.StringDict = exports.PerformanceTrack = exports.GraphQL = exports.NgRx = exports.MobX = exports.Vuex = exports.Redux = exports.StateAction = exports.OTable = exports.Profiler = exports.Fetch = exports.CSSDeleteRule = exports.CSSInsertRule = exports.Metadata = exports.UserAnonymousID = exports.UserID = exports.CustomEvent = exports.PageRenderTiming = exports.PageLoadTiming = exports.ConsoleLog = exports.NetworkRequestDeprecated = exports.MouseMove = exports.SetInputChecked = exports.SetInputValue = exports.SetInputTarget = exports.SetNodeScroll = exports.SetNodeData = exports.RemoveNodeAttribute = exports.SetNodeAttribute = exports.RemoveNode = exports.MoveNode = exports.CreateTextNode = exports.CreateElementNode = exports.CreateDocument = exports.SetViewportScroll = exports.SetViewportSize = exports.SetPageLocation = exports.Timestamp = void 0;
6
- exports.ReduxNew = exports.TagTrigger = exports.CanvasNode = exports.TabData = exports.TabChange = exports.ResourceTiming = exports.UnbindNodes = exports.MouseThrashing = exports.SelectionChange = exports.InputChange = exports.WSChannel = exports.NetworkRequest = exports.PartitionedMessage = exports.BatchMetadata = exports.Zustand = exports.JSException = exports.AdoptedSSRemoveOwner = exports.AdoptedSSAddOwner = exports.AdoptedSSDeleteRule = exports.AdoptedSSInsertRuleURLBased = exports.AdoptedSSReplaceURLBased = exports.CreateIFrameDocument = exports.MouseClick = void 0;
5
+ exports.CSSInsertRuleURLBased = exports.CustomIssue = exports.TechnicalInfo = exports.SetCSSDataURLBased = exports.SetNodeAttributeURLBased = exports.LongTask = exports.SetNodeFocus = exports.LoadFontFace = exports.SetPageVisibility = exports.ConnectionInformation = exports.ResourceTimingDeprecated = exports.SetNodeAttributeDict = exports.StringDict = exports.PerformanceTrack = exports.GraphQL = exports.NgRx = exports.MobX = exports.Vuex = exports.ReduxDeprecated = exports.StateAction = exports.OTable = exports.Profiler = exports.Fetch = exports.CSSDeleteRule = exports.CSSInsertRule = exports.Metadata = exports.UserAnonymousID = exports.UserID = exports.CustomEvent = exports.PageRenderTiming = exports.PageLoadTiming = exports.ConsoleLog = exports.NetworkRequestDeprecated = exports.MouseMove = exports.SetInputChecked = exports.SetInputValue = exports.SetInputTarget = exports.SetNodeScroll = exports.SetNodeData = exports.RemoveNodeAttribute = exports.SetNodeAttribute = exports.RemoveNode = exports.MoveNode = exports.CreateTextNode = exports.CreateElementNode = exports.CreateDocument = exports.SetViewportScroll = exports.SetViewportSize = exports.SetPageLocation = exports.Timestamp = void 0;
6
+ exports.Redux = exports.TagTrigger = exports.CanvasNode = exports.TabData = exports.TabChange = exports.ResourceTiming = exports.UnbindNodes = exports.MouseThrashing = exports.SelectionChange = exports.InputChange = exports.WSChannel = exports.NetworkRequest = exports.PartitionedMessage = exports.BatchMetadata = exports.Zustand = exports.JSException = exports.AdoptedSSRemoveOwner = exports.AdoptedSSAddOwner = exports.AdoptedSSDeleteRule = exports.AdoptedSSInsertRuleURLBased = exports.AdoptedSSReplaceURLBased = exports.CreateIFrameDocument = exports.MouseClick = void 0;
7
7
  function Timestamp(timestamp) {
8
8
  return [
9
9
  0 /* Messages.Type.Timestamp */,
@@ -276,15 +276,15 @@ function StateAction(type) {
276
276
  ];
277
277
  }
278
278
  exports.StateAction = StateAction;
279
- function Redux(action, state, duration) {
279
+ function ReduxDeprecated(action, state, duration) {
280
280
  return [
281
- 44 /* Messages.Type.Redux */,
281
+ 44 /* Messages.Type.ReduxDeprecated */,
282
282
  action,
283
283
  state,
284
284
  duration,
285
285
  ];
286
286
  }
287
- exports.Redux = Redux;
287
+ exports.ReduxDeprecated = ReduxDeprecated;
288
288
  function Vuex(mutation, state) {
289
289
  return [
290
290
  45 /* Messages.Type.Vuex */,
@@ -656,13 +656,13 @@ function TagTrigger(tagId) {
656
656
  ];
657
657
  }
658
658
  exports.TagTrigger = TagTrigger;
659
- function ReduxNew(action, state, duration, actionTime) {
659
+ function Redux(action, state, duration, actionTime) {
660
660
  return [
661
- 121 /* Messages.Type.ReduxNew */,
661
+ 121 /* Messages.Type.Redux */,
662
662
  action,
663
663
  state,
664
664
  duration,
665
665
  actionTime,
666
666
  ];
667
667
  }
668
- exports.ReduxNew = ReduxNew;
668
+ exports.Redux = Redux;
@@ -3,61 +3,7 @@ export interface Options {
3
3
  connAttemptCount?: number;
4
4
  connAttemptGap?: number;
5
5
  }
6
- export type ToWorkerData = null | Stop | Batch | WorkerStart | BeaconSizeLimit | ToWriterData | ForceFlushBatch | CheckQueue | ResetWriter | WriterFinalize;
7
- export type FromWorkerData = Restart | Failure | NotInit | Compress | QEmpty | Status | BatchReady;
8
- type BatchReady = {
9
- type: 'batch_ready';
10
- data: Uint8Array;
11
- };
12
- type Status = {
13
- type: 'status';
14
- data: number;
15
- };
16
- type Compress = {
17
- type: 'compress';
18
- batch: Uint8Array;
19
- };
20
- type Restart = {
21
- type: 'restart';
22
- };
23
- type NotInit = {
24
- type: 'not_init';
25
- };
26
- type Stop = {
27
- type: 'stop';
28
- };
29
- type Batch = {
30
- type: 'batch';
31
- data: Array<Message>;
32
- };
33
- type ForceFlushBatch = {
34
- type: 'forceFlushBatch';
35
- };
36
- type CheckQueue = {
37
- type: 'check_queue';
38
- };
39
- type WriterFinalize = {
40
- type: 'writer_finalize';
41
- };
42
- type ResetWriter = {
43
- type: 'reset_writer';
44
- };
45
- type BeaconSizeLimit = {
46
- type: 'beacon_size_limit';
47
- data: number;
48
- };
49
- type ToWriterData = {
50
- type: 'to_writer';
51
- data: Array<Message>;
52
- };
53
- type Failure = {
54
- type: 'failure';
55
- reason: string;
56
- };
57
- type QEmpty = {
58
- type: 'queue_empty';
59
- };
60
- export type WorkerStart = {
6
+ type Start = {
61
7
  type: 'start';
62
8
  ingestPoint: string;
63
9
  pageNo: number;
@@ -65,8 +11,27 @@ export type WorkerStart = {
65
11
  url: string;
66
12
  tabId: string;
67
13
  } & Options;
68
- export type WorkerAuth = {
14
+ type Auth = {
15
+ type: 'auth';
69
16
  token: string;
70
17
  beaconSizeLimit?: number;
71
18
  };
19
+ export type ToWorkerData = null | 'stop' | Start | Auth | Array<Message> | {
20
+ type: 'compressed';
21
+ batch: Uint8Array;
22
+ } | {
23
+ type: 'uncompressed';
24
+ batch: Uint8Array;
25
+ } | 'forceFlushBatch' | 'check_queue';
26
+ type Failure = {
27
+ type: 'failure';
28
+ reason: string;
29
+ };
30
+ type QEmpty = {
31
+ type: 'queue_empty';
32
+ };
33
+ export type FromWorkerData = 'a_stop' | 'a_start' | Failure | 'not_init' | {
34
+ type: 'compress';
35
+ batch: Uint8Array;
36
+ } | QEmpty;
72
37
  export {};