@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/lib/index.js CHANGED
@@ -3025,8 +3025,7 @@ class Observer {
3025
3025
  }
3026
3026
  }
3027
3027
  catch (mutationErr) {
3028
- const t = mutation.target;
3029
- this.orDebug(`mutation processing threw type=${mutation.type} target=<${t.tagName ?? t.nodeName ?? 'unknown'}>: ${mutationErr?.message ?? String(mutationErr)}`);
3028
+ mutation.target;
3030
3029
  }
3031
3030
  }
3032
3031
  this.commitNodes();
@@ -3248,27 +3247,15 @@ class Observer {
3248
3247
  // TODO: Clean the logic (though now it workd fine)
3249
3248
  if (!hasTag(node, 'html') || !this.isTopContext) {
3250
3249
  if (parent === null) {
3251
- // Sometimes one observation contains attribute mutations for the removimg node, which gets ignored here.
3252
- // That shouldn't affect the visual rendering ( should it? maybe when transition applied? )
3253
- // THEORY: an element silently dropped at commit time (no message emitted).
3254
- if (isElementNode(node)) {
3255
- this.orDebug(`commit drop <${node.tagName}> reason=no-parent`);
3256
- }
3257
3250
  this.unbindTree(node);
3258
3251
  return false;
3259
3252
  }
3260
3253
  parentID = this.app.nodes.getID(parent);
3261
3254
  if (parentID === undefined) {
3262
- if (isElementNode(node)) {
3263
- this.orDebug(`commit drop <${node.tagName}> reason=parent-unbound parent=<${parent.tagName ?? parent.nodeName}>`);
3264
- }
3265
3255
  this.unbindTree(node);
3266
3256
  return false;
3267
3257
  }
3268
3258
  if (!this.commitNode(parentID)) {
3269
- if (isElementNode(node)) {
3270
- this.orDebug(`commit drop <${node.tagName}> reason=parent-commit-failed`);
3271
- }
3272
3259
  this.unbindTree(node);
3273
3260
  return false;
3274
3261
  }
@@ -3412,19 +3399,6 @@ class Observer {
3412
3399
  beforeCommit(this.app.nodes.getID(node));
3413
3400
  this.commitNodes(true);
3414
3401
  }
3415
- /**
3416
- * [OPENREPLAYDEBUG] Emits a diagnostic line INTO the recorded session's
3417
- * console (searchable in replay by "[OPENREPLAYDEBUG]"), NOT the local
3418
- * devtools console — used to test capture-loss theories against real traffic.
3419
- */
3420
- orDebug(message) {
3421
- try {
3422
- this.app.send(ConsoleLog('warn', `[OPENREPLAYDEBUG] ${message}`));
3423
- }
3424
- catch (_) {
3425
- /* diagnostics must never break recording */
3426
- }
3427
- }
3428
3402
  disconnect() {
3429
3403
  // THEORY S3: a disconnect may discard MutationRecords still queued by the
3430
3404
  // browser. takeRecords() drains them — they would be discarded by
@@ -3435,21 +3409,16 @@ class Observer {
3435
3409
  // most reliable for mid-session re-observes (cold-start cycle / iframe).
3436
3410
  const pending = this.observer.takeRecords();
3437
3411
  if (pending.length) {
3438
- let addedEls = 0;
3439
3412
  const tags = [];
3440
3413
  for (const m of pending) {
3441
3414
  for (let i = 0; i < m.addedNodes.length; i++) {
3442
3415
  const n = m.addedNodes[i];
3443
3416
  if (n.tagName) {
3444
- addedEls++;
3445
3417
  if (tags.length < 10)
3446
3418
  tags.push(n.tagName);
3447
3419
  }
3448
3420
  }
3449
3421
  }
3450
- if (addedEls > 0) {
3451
- this.orDebug(`disconnect stranded ${pending.length} pending record(s), ${addedEls} added element(s): ${tags.join(',')}`);
3452
- }
3453
3422
  }
3454
3423
  this.observer.disconnect();
3455
3424
  this.clear();
@@ -3746,6 +3715,19 @@ class TopObserver extends Observer {
3746
3715
  // it has no node_id here
3747
3716
  this.app.nodes.callNodeCallbacks(document, true);
3748
3717
  }, window.document.documentElement);
3718
+ // DEBUG orload
3719
+ const markCandidates = [
3720
+ document.head,
3721
+ document.body,
3722
+ document.body ? document.body.querySelector('div') : null,
3723
+ ];
3724
+ for (const candidate of markCandidates) {
3725
+ const markId = candidate ? this.app.nodes.getID(candidate) : undefined;
3726
+ if (markId !== undefined) {
3727
+ this.app.send(SetNodeAttribute(markId, 'orloaded', 'true'));
3728
+ break;
3729
+ }
3730
+ }
3749
3731
  }
3750
3732
  crossdomainObserve(rootNodeId, frameOder, frameLevel) {
3751
3733
  const observer = this;
@@ -4126,7 +4108,7 @@ class App {
4126
4108
  this.stopCallbacks = [];
4127
4109
  this.commitCallbacks = [];
4128
4110
  this.activityState = ActivityState.NotActive;
4129
- this.version = '18.0.13-beta.0'; // TODO: version compatability check inside each plugin.
4111
+ this.version = '18.0.14-beta.0'; // TODO: version compatability check inside each plugin.
4130
4112
  this.socketMode = false;
4131
4113
  this.compressionThreshold = 24 * 1000;
4132
4114
  this.bc = null;
@@ -5050,16 +5032,6 @@ class App {
5050
5032
  }
5051
5033
  else if (data === 'not_init') {
5052
5034
  this.debug.warn('OR WebWorker: writer not initialised. Restarting tracker');
5053
- // [OPENREPLAYDEBUG] THEORY: a message batch reached the worker before the
5054
- // writer was initialised (start handshake not finished) and was DISCARDED.
5055
- // Surface it into the session (searchable in replay) to test whether
5056
- // startup batches — which can carry the initial DOM snapshot — are lost.
5057
- try {
5058
- this.send(ConsoleLog('warn', '[OPENREPLAYDEBUG] worker not_init: a pre-start message batch was discarded'));
5059
- }
5060
- catch (_) {
5061
- /* diagnostics must never break recording */
5062
- }
5063
5035
  }
5064
5036
  else if (data.type === 'failure') {
5065
5037
  this.stop(false);
@@ -7842,7 +7814,7 @@ class NetworkMessage {
7842
7814
  return null;
7843
7815
  const gqlHeader = "application/graphql-response";
7844
7816
  const isGraphql = messageInfo.url.includes("/graphql")
7845
- || Object.values(messageInfo.request.headers).some(v => v.includes(gqlHeader));
7817
+ || Object.values(messageInfo.request.headers).some(v => v && typeof v === 'string' && v.includes(gqlHeader));
7846
7818
  if (isGraphql && messageInfo.response.body && typeof messageInfo.response.body === 'string') {
7847
7819
  const isError = messageInfo.response.body.includes("errors");
7848
7820
  messageInfo.status = isError ? 400 : 200;
@@ -7946,6 +7918,7 @@ const genStringBody = (body) => {
7946
7918
  }
7947
7919
  else if (body instanceof Blob ||
7948
7920
  body instanceof ReadableStream ||
7921
+ ArrayBuffer.isView(body) ||
7949
7922
  body instanceof ArrayBuffer) {
7950
7923
  result = 'byte data';
7951
7924
  }
@@ -9434,7 +9407,7 @@ class ConstantProperties {
9434
9407
  user_id: this.user_id,
9435
9408
  distinct_id: this.deviceId,
9436
9409
  sdk_edition: 'web',
9437
- sdk_version: '18.0.13-beta.0',
9410
+ sdk_version: '18.0.14-beta.0',
9438
9411
  timezone: getUTCOffsetString(),
9439
9412
  search_engine: this.searchEngine,
9440
9413
  };
@@ -10136,7 +10109,7 @@ class API {
10136
10109
  this.signalStartIssue = (reason, missingApi) => {
10137
10110
  const doNotTrack = this.checkDoNotTrack();
10138
10111
  console.log("Tracker couldn't start due to:", JSON.stringify({
10139
- trackerVersion: '18.0.13-beta.0',
10112
+ trackerVersion: '18.0.14-beta.0',
10140
10113
  projectKey: this.options.projectKey,
10141
10114
  doNotTrack,
10142
10115
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,