@openreplay/tracker 18.0.6 → 18.0.7

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/entry.js CHANGED
@@ -3347,6 +3347,9 @@ class Observer {
3347
3347
  this.throttledSetNodeData.clear();
3348
3348
  this.generation++;
3349
3349
  }
3350
+ resetThrottledSetNodeData() {
3351
+ this.throttledSetNodeData.clear();
3352
+ }
3350
3353
  }
3351
3354
 
3352
3355
  class IFrameObserver extends Observer {
@@ -3621,6 +3624,7 @@ class TopObserver extends Observer {
3621
3624
  observer.handleShadowRoot(shadow);
3622
3625
  return shadow;
3623
3626
  };
3627
+ this.resetThrottledSetNodeData();
3624
3628
  this.app.nodes.clear();
3625
3629
  // Can observe documentElement (<html>) here, because it is not supposed to be changing.
3626
3630
  // However, it is possible in some exotic cases and may cause an ignorance of the newly created <html>
@@ -4009,7 +4013,7 @@ class App {
4009
4013
  this.stopCallbacks = [];
4010
4014
  this.commitCallbacks = [];
4011
4015
  this.activityState = ActivityState.NotActive;
4012
- this.version = '18.0.6'; // TODO: version compatability check inside each plugin.
4016
+ this.version = '18.0.7'; // TODO: version compatability check inside each plugin.
4013
4017
  this.socketMode = false;
4014
4018
  this.compressionThreshold = 24 * 1000;
4015
4019
  this.bc = null;
@@ -6073,9 +6077,11 @@ function Input (app, opts) {
6073
6077
  }
6074
6078
  const inputValues = new Map();
6075
6079
  const checkboxValues = new Map();
6080
+ const selectValues = new Map();
6076
6081
  app.attachStopCallback(() => {
6077
6082
  inputValues.clear();
6078
6083
  checkboxValues.clear();
6084
+ selectValues.clear();
6079
6085
  tagSelectorMap.clear();
6080
6086
  });
6081
6087
  function trackInputValue(id, node) {
@@ -6092,6 +6098,13 @@ function Input (app, opts) {
6092
6098
  checkboxValues.set(id, value);
6093
6099
  app.send(SetInputChecked(id, value));
6094
6100
  }
6101
+ function trackSelectValue(id, node) {
6102
+ if (selectValues.get(id) === node.value) {
6103
+ return;
6104
+ }
6105
+ selectValues.set(id, node.value);
6106
+ sendInputValue(id, node);
6107
+ }
6095
6108
  // The only way (to our knowledge) to track all kinds of input changes, including those made by JS
6096
6109
  app.ticker.attach(() => {
6097
6110
  inputValues.forEach((value, id) => {
@@ -6106,6 +6119,12 @@ function Input (app, opts) {
6106
6119
  return checkboxValues.delete(id);
6107
6120
  trackCheckboxValue(id, node.checked);
6108
6121
  });
6122
+ selectValues.forEach((_, id) => {
6123
+ const node = app.nodes.getNode(id);
6124
+ if (!node)
6125
+ return selectValues.delete(id);
6126
+ trackSelectValue(id, node);
6127
+ });
6109
6128
  }, 3);
6110
6129
  function sendInputChange(id, node, hesitationTime, inputTime) {
6111
6130
  const { value, mask } = getInputValue(id, node);
@@ -6122,8 +6141,8 @@ function Input (app, opts) {
6122
6141
  }
6123
6142
  // TODO: support multiple select (?): use selectedOptions;
6124
6143
  if (hasTag(node, 'select')) {
6125
- sendInputValue(id, node);
6126
- app.nodes.attachNodeListener(node, 'change', () => sendInputValue(id, node));
6144
+ trackSelectValue(id, node);
6145
+ app.nodes.attachNodeListener(node, 'change', () => trackSelectValue(id, node));
6127
6146
  }
6128
6147
  if (isTextFieldElement(node)) {
6129
6148
  trackInputValue(id, node);
@@ -7399,7 +7418,7 @@ class NetworkMessage {
7399
7418
  return null;
7400
7419
  const gqlHeader = "application/graphql-response";
7401
7420
  const isGraphql = messageInfo.url.includes("/graphql")
7402
- || Object.values(messageInfo.request.headers).some(v => v && v.includes(gqlHeader));
7421
+ || Object.values(messageInfo.request.headers).some(v => v.includes(gqlHeader));
7403
7422
  if (isGraphql && messageInfo.response.body && typeof messageInfo.response.body === 'string') {
7404
7423
  const isError = messageInfo.response.body.includes("errors");
7405
7424
  messageInfo.status = isError ? 400 : 200;
@@ -7503,7 +7522,6 @@ const genStringBody = (body) => {
7503
7522
  }
7504
7523
  else if (body instanceof Blob ||
7505
7524
  body instanceof ReadableStream ||
7506
- ArrayBuffer.isView(body) ||
7507
7525
  body instanceof ArrayBuffer) {
7508
7526
  result = 'byte data';
7509
7527
  }
@@ -8992,7 +9010,7 @@ class ConstantProperties {
8992
9010
  user_id: this.user_id,
8993
9011
  distinct_id: this.deviceId,
8994
9012
  sdk_edition: 'web',
8995
- sdk_version: '18.0.6',
9013
+ sdk_version: '18.0.7',
8996
9014
  timezone: getUTCOffsetString(),
8997
9015
  search_engine: this.searchEngine,
8998
9016
  };
@@ -9694,7 +9712,7 @@ class API {
9694
9712
  this.signalStartIssue = (reason, missingApi) => {
9695
9713
  const doNotTrack = this.checkDoNotTrack();
9696
9714
  console.log("Tracker couldn't start due to:", JSON.stringify({
9697
- trackerVersion: '18.0.6',
9715
+ trackerVersion: '18.0.7',
9698
9716
  projectKey: this.options.projectKey,
9699
9717
  doNotTrack,
9700
9718
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,