@openreplay/tracker 18.0.13-beta.0 → 18.0.14-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
@@ -3029,8 +3029,7 @@ class Observer {
3029
3029
  }
3030
3030
  }
3031
3031
  catch (mutationErr) {
3032
- const t = mutation.target;
3033
- this.orDebug(`mutation processing threw type=${mutation.type} target=<${t.tagName ?? t.nodeName ?? 'unknown'}>: ${mutationErr?.message ?? String(mutationErr)}`);
3032
+ mutation.target;
3034
3033
  }
3035
3034
  }
3036
3035
  this.commitNodes();
@@ -3252,27 +3251,15 @@ class Observer {
3252
3251
  // TODO: Clean the logic (though now it workd fine)
3253
3252
  if (!hasTag(node, 'html') || !this.isTopContext) {
3254
3253
  if (parent === null) {
3255
- // Sometimes one observation contains attribute mutations for the removimg node, which gets ignored here.
3256
- // That shouldn't affect the visual rendering ( should it? maybe when transition applied? )
3257
- // THEORY: an element silently dropped at commit time (no message emitted).
3258
- if (isElementNode(node)) {
3259
- this.orDebug(`commit drop <${node.tagName}> reason=no-parent`);
3260
- }
3261
3254
  this.unbindTree(node);
3262
3255
  return false;
3263
3256
  }
3264
3257
  parentID = this.app.nodes.getID(parent);
3265
3258
  if (parentID === undefined) {
3266
- if (isElementNode(node)) {
3267
- this.orDebug(`commit drop <${node.tagName}> reason=parent-unbound parent=<${parent.tagName ?? parent.nodeName}>`);
3268
- }
3269
3259
  this.unbindTree(node);
3270
3260
  return false;
3271
3261
  }
3272
3262
  if (!this.commitNode(parentID)) {
3273
- if (isElementNode(node)) {
3274
- this.orDebug(`commit drop <${node.tagName}> reason=parent-commit-failed`);
3275
- }
3276
3263
  this.unbindTree(node);
3277
3264
  return false;
3278
3265
  }
@@ -3416,19 +3403,6 @@ class Observer {
3416
3403
  beforeCommit(this.app.nodes.getID(node));
3417
3404
  this.commitNodes(true);
3418
3405
  }
3419
- /**
3420
- * [OPENREPLAYDEBUG] Emits a diagnostic line INTO the recorded session's
3421
- * console (searchable in replay by "[OPENREPLAYDEBUG]"), NOT the local
3422
- * devtools console — used to test capture-loss theories against real traffic.
3423
- */
3424
- orDebug(message) {
3425
- try {
3426
- this.app.send(ConsoleLog('warn', `[OPENREPLAYDEBUG] ${message}`));
3427
- }
3428
- catch (_) {
3429
- /* diagnostics must never break recording */
3430
- }
3431
- }
3432
3406
  disconnect() {
3433
3407
  // THEORY S3: a disconnect may discard MutationRecords still queued by the
3434
3408
  // browser. takeRecords() drains them — they would be discarded by
@@ -3439,21 +3413,16 @@ class Observer {
3439
3413
  // most reliable for mid-session re-observes (cold-start cycle / iframe).
3440
3414
  const pending = this.observer.takeRecords();
3441
3415
  if (pending.length) {
3442
- let addedEls = 0;
3443
3416
  const tags = [];
3444
3417
  for (const m of pending) {
3445
3418
  for (let i = 0; i < m.addedNodes.length; i++) {
3446
3419
  const n = m.addedNodes[i];
3447
3420
  if (n.tagName) {
3448
- addedEls++;
3449
3421
  if (tags.length < 10)
3450
3422
  tags.push(n.tagName);
3451
3423
  }
3452
3424
  }
3453
3425
  }
3454
- if (addedEls > 0) {
3455
- this.orDebug(`disconnect stranded ${pending.length} pending record(s), ${addedEls} added element(s): ${tags.join(',')}`);
3456
- }
3457
3426
  }
3458
3427
  this.observer.disconnect();
3459
3428
  this.clear();
@@ -3750,6 +3719,19 @@ class TopObserver extends Observer {
3750
3719
  // it has no node_id here
3751
3720
  this.app.nodes.callNodeCallbacks(document, true);
3752
3721
  }, window.document.documentElement);
3722
+ // DEBUG orload
3723
+ const markCandidates = [
3724
+ document.head,
3725
+ document.body,
3726
+ document.body ? document.body.querySelector('div') : null,
3727
+ ];
3728
+ for (const candidate of markCandidates) {
3729
+ const markId = candidate ? this.app.nodes.getID(candidate) : undefined;
3730
+ if (markId !== undefined) {
3731
+ this.app.send(SetNodeAttribute(markId, 'orloaded', 'true'));
3732
+ break;
3733
+ }
3734
+ }
3753
3735
  }
3754
3736
  crossdomainObserve(rootNodeId, frameOder, frameLevel) {
3755
3737
  const observer = this;
@@ -4130,7 +4112,7 @@ class App {
4130
4112
  this.stopCallbacks = [];
4131
4113
  this.commitCallbacks = [];
4132
4114
  this.activityState = ActivityState.NotActive;
4133
- this.version = '18.0.13-beta.0'; // TODO: version compatability check inside each plugin.
4115
+ this.version = '18.0.14-beta.0'; // TODO: version compatability check inside each plugin.
4134
4116
  this.socketMode = false;
4135
4117
  this.compressionThreshold = 24 * 1000;
4136
4118
  this.bc = null;
@@ -5054,16 +5036,6 @@ class App {
5054
5036
  }
5055
5037
  else if (data === 'not_init') {
5056
5038
  this.debug.warn('OR WebWorker: writer not initialised. Restarting tracker');
5057
- // [OPENREPLAYDEBUG] THEORY: a message batch reached the worker before the
5058
- // writer was initialised (start handshake not finished) and was DISCARDED.
5059
- // Surface it into the session (searchable in replay) to test whether
5060
- // startup batches — which can carry the initial DOM snapshot — are lost.
5061
- try {
5062
- this.send(ConsoleLog('warn', '[OPENREPLAYDEBUG] worker not_init: a pre-start message batch was discarded'));
5063
- }
5064
- catch (_) {
5065
- /* diagnostics must never break recording */
5066
- }
5067
5039
  }
5068
5040
  else if (data.type === 'failure') {
5069
5041
  this.stop(false);
@@ -7846,7 +7818,7 @@ class NetworkMessage {
7846
7818
  return null;
7847
7819
  const gqlHeader = "application/graphql-response";
7848
7820
  const isGraphql = messageInfo.url.includes("/graphql")
7849
- || Object.values(messageInfo.request.headers).some(v => v.includes(gqlHeader));
7821
+ || Object.values(messageInfo.request.headers).some(v => v && typeof v === 'string' && v.includes(gqlHeader));
7850
7822
  if (isGraphql && messageInfo.response.body && typeof messageInfo.response.body === 'string') {
7851
7823
  const isError = messageInfo.response.body.includes("errors");
7852
7824
  messageInfo.status = isError ? 400 : 200;
@@ -7950,6 +7922,7 @@ const genStringBody = (body) => {
7950
7922
  }
7951
7923
  else if (body instanceof Blob ||
7952
7924
  body instanceof ReadableStream ||
7925
+ ArrayBuffer.isView(body) ||
7953
7926
  body instanceof ArrayBuffer) {
7954
7927
  result = 'byte data';
7955
7928
  }
@@ -9438,7 +9411,7 @@ class ConstantProperties {
9438
9411
  user_id: this.user_id,
9439
9412
  distinct_id: this.deviceId,
9440
9413
  sdk_edition: 'web',
9441
- sdk_version: '18.0.13-beta.0',
9414
+ sdk_version: '18.0.14-beta.0',
9442
9415
  timezone: getUTCOffsetString(),
9443
9416
  search_engine: this.searchEngine,
9444
9417
  };
@@ -10140,7 +10113,7 @@ class API {
10140
10113
  this.signalStartIssue = (reason, missingApi) => {
10141
10114
  const doNotTrack = this.checkDoNotTrack();
10142
10115
  console.log("Tracker couldn't start due to:", JSON.stringify({
10143
- trackerVersion: '18.0.13-beta.0',
10116
+ trackerVersion: '18.0.14-beta.0',
10144
10117
  projectKey: this.options.projectKey,
10145
10118
  doNotTrack,
10146
10119
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,