@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.
@@ -54,5 +54,6 @@ export default abstract class Observer {
54
54
  private commitNodes;
55
55
  protected observeRoot(node: Node, beforeCommit: (id?: number) => unknown, nodeToBind?: Node): void;
56
56
  disconnect(): void;
57
+ protected resetThrottledSetNodeData(): void;
57
58
  }
58
59
  export {};
package/dist/lib/entry.js CHANGED
@@ -3343,6 +3343,9 @@ class Observer {
3343
3343
  this.throttledSetNodeData.clear();
3344
3344
  this.generation++;
3345
3345
  }
3346
+ resetThrottledSetNodeData() {
3347
+ this.throttledSetNodeData.clear();
3348
+ }
3346
3349
  }
3347
3350
 
3348
3351
  class IFrameObserver extends Observer {
@@ -3617,6 +3620,7 @@ class TopObserver extends Observer {
3617
3620
  observer.handleShadowRoot(shadow);
3618
3621
  return shadow;
3619
3622
  };
3623
+ this.resetThrottledSetNodeData();
3620
3624
  this.app.nodes.clear();
3621
3625
  // Can observe documentElement (<html>) here, because it is not supposed to be changing.
3622
3626
  // However, it is possible in some exotic cases and may cause an ignorance of the newly created <html>
@@ -4005,7 +4009,7 @@ class App {
4005
4009
  this.stopCallbacks = [];
4006
4010
  this.commitCallbacks = [];
4007
4011
  this.activityState = ActivityState.NotActive;
4008
- this.version = '18.0.6'; // TODO: version compatability check inside each plugin.
4012
+ this.version = '18.0.7'; // TODO: version compatability check inside each plugin.
4009
4013
  this.socketMode = false;
4010
4014
  this.compressionThreshold = 24 * 1000;
4011
4015
  this.bc = null;
@@ -6069,9 +6073,11 @@ function Input (app, opts) {
6069
6073
  }
6070
6074
  const inputValues = new Map();
6071
6075
  const checkboxValues = new Map();
6076
+ const selectValues = new Map();
6072
6077
  app.attachStopCallback(() => {
6073
6078
  inputValues.clear();
6074
6079
  checkboxValues.clear();
6080
+ selectValues.clear();
6075
6081
  tagSelectorMap.clear();
6076
6082
  });
6077
6083
  function trackInputValue(id, node) {
@@ -6088,6 +6094,13 @@ function Input (app, opts) {
6088
6094
  checkboxValues.set(id, value);
6089
6095
  app.send(SetInputChecked(id, value));
6090
6096
  }
6097
+ function trackSelectValue(id, node) {
6098
+ if (selectValues.get(id) === node.value) {
6099
+ return;
6100
+ }
6101
+ selectValues.set(id, node.value);
6102
+ sendInputValue(id, node);
6103
+ }
6091
6104
  // The only way (to our knowledge) to track all kinds of input changes, including those made by JS
6092
6105
  app.ticker.attach(() => {
6093
6106
  inputValues.forEach((value, id) => {
@@ -6102,6 +6115,12 @@ function Input (app, opts) {
6102
6115
  return checkboxValues.delete(id);
6103
6116
  trackCheckboxValue(id, node.checked);
6104
6117
  });
6118
+ selectValues.forEach((_, id) => {
6119
+ const node = app.nodes.getNode(id);
6120
+ if (!node)
6121
+ return selectValues.delete(id);
6122
+ trackSelectValue(id, node);
6123
+ });
6105
6124
  }, 3);
6106
6125
  function sendInputChange(id, node, hesitationTime, inputTime) {
6107
6126
  const { value, mask } = getInputValue(id, node);
@@ -6118,8 +6137,8 @@ function Input (app, opts) {
6118
6137
  }
6119
6138
  // TODO: support multiple select (?): use selectedOptions;
6120
6139
  if (hasTag(node, 'select')) {
6121
- sendInputValue(id, node);
6122
- app.nodes.attachNodeListener(node, 'change', () => sendInputValue(id, node));
6140
+ trackSelectValue(id, node);
6141
+ app.nodes.attachNodeListener(node, 'change', () => trackSelectValue(id, node));
6123
6142
  }
6124
6143
  if (isTextFieldElement(node)) {
6125
6144
  trackInputValue(id, node);
@@ -7395,7 +7414,7 @@ class NetworkMessage {
7395
7414
  return null;
7396
7415
  const gqlHeader = "application/graphql-response";
7397
7416
  const isGraphql = messageInfo.url.includes("/graphql")
7398
- || Object.values(messageInfo.request.headers).some(v => v && v.includes(gqlHeader));
7417
+ || Object.values(messageInfo.request.headers).some(v => v.includes(gqlHeader));
7399
7418
  if (isGraphql && messageInfo.response.body && typeof messageInfo.response.body === 'string') {
7400
7419
  const isError = messageInfo.response.body.includes("errors");
7401
7420
  messageInfo.status = isError ? 400 : 200;
@@ -7499,7 +7518,6 @@ const genStringBody = (body) => {
7499
7518
  }
7500
7519
  else if (body instanceof Blob ||
7501
7520
  body instanceof ReadableStream ||
7502
- ArrayBuffer.isView(body) ||
7503
7521
  body instanceof ArrayBuffer) {
7504
7522
  result = 'byte data';
7505
7523
  }
@@ -8988,7 +9006,7 @@ class ConstantProperties {
8988
9006
  user_id: this.user_id,
8989
9007
  distinct_id: this.deviceId,
8990
9008
  sdk_edition: 'web',
8991
- sdk_version: '18.0.6',
9009
+ sdk_version: '18.0.7',
8992
9010
  timezone: getUTCOffsetString(),
8993
9011
  search_engine: this.searchEngine,
8994
9012
  };
@@ -9690,7 +9708,7 @@ class API {
9690
9708
  this.signalStartIssue = (reason, missingApi) => {
9691
9709
  const doNotTrack = this.checkDoNotTrack();
9692
9710
  console.log("Tracker couldn't start due to:", JSON.stringify({
9693
- trackerVersion: '18.0.6',
9711
+ trackerVersion: '18.0.7',
9694
9712
  projectKey: this.options.projectKey,
9695
9713
  doNotTrack,
9696
9714
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,