@openreplay/tracker 17.0.0 → 17.0.1

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.
@@ -45,6 +45,7 @@ export default class Session {
45
45
  getPageNumber: () => number | undefined;
46
46
  incPageNo: () => number;
47
47
  getSessionToken: (projectKey?: string) => string | undefined;
48
+ getRawTokenWithProject: () => string | null;
48
49
  setSessionToken: (token: string, projectKey: string) => void;
49
50
  applySessionHash(hash: string): void;
50
51
  getSessionHash(): string | undefined;
package/dist/lib/entry.js CHANGED
@@ -3515,8 +3515,7 @@ class Observer {
3515
3515
  sl.assignedNodes({ flatten: true }).forEach((n) => {
3516
3516
  const nid = this.app.nodes.getID(n);
3517
3517
  if (nid !== undefined) {
3518
- this.recents.set(nid, RecentsType.Removed);
3519
- this.commitNode(nid);
3518
+ this.recents.set(nid, RecentsType.Changed);
3520
3519
  }
3521
3520
  });
3522
3521
  });
@@ -3583,13 +3582,6 @@ class Observer {
3583
3582
  return true;
3584
3583
  }
3585
3584
  let slot = node.assignedSlot;
3586
- let isLightDom = false;
3587
- if (slot) {
3588
- // Check if the node is in light DOM (not in shadow DOM)
3589
- // This is a workaround for the issue with shadow DOM and slots
3590
- // where the slot is not assigned to the node in shadow DOM.
3591
- isLightDom = node.getRootNode() instanceof ShadowRoot;
3592
- }
3593
3585
  const parent = node.parentNode;
3594
3586
  let parentID;
3595
3587
  // Disable parent check for the upper context HTMLHtmlElement, because it is root there... (before)
@@ -3602,15 +3594,7 @@ class Observer {
3602
3594
  this.unbindTree(node);
3603
3595
  return false;
3604
3596
  }
3605
- if (isLightDom && slot) {
3606
- parentID = this.app.nodes.getID(slot);
3607
- // in light dom, we don't "slot" the node,
3608
- // but rather use the slot as a parent
3609
- slot = null;
3610
- }
3611
- else {
3612
- parentID = this.app.nodes.getID(parent);
3613
- }
3597
+ parentID = this.app.nodes.getID(parent);
3614
3598
  if (parentID === undefined) {
3615
3599
  this.unbindTree(node);
3616
3600
  return false;
@@ -4159,6 +4143,7 @@ class Sanitizer {
4159
4143
  }
4160
4144
  }
4161
4145
 
4146
+ const tokenSeparator = '_$_';
4162
4147
  class Session {
4163
4148
  constructor(params) {
4164
4149
  this.metadata = {};
@@ -4186,19 +4171,22 @@ class Session {
4186
4171
  this.getSessionToken = (projectKey) => {
4187
4172
  const tokenWithProject = this.token || this.app.sessionStorage.getItem(this.options.session_token_key);
4188
4173
  if (projectKey && tokenWithProject) {
4189
- const savedProject = tokenWithProject.split('_&_')[1];
4174
+ const savedProject = tokenWithProject.split(tokenSeparator)[1];
4190
4175
  if (!savedProject || savedProject !== projectKey) {
4191
4176
  this.app.sessionStorage.removeItem(this.options.session_token_key);
4192
4177
  this.token = undefined;
4193
4178
  return undefined;
4194
4179
  }
4195
4180
  }
4196
- const token = tokenWithProject ? tokenWithProject.split('_&_')[0] : null;
4181
+ const token = tokenWithProject ? tokenWithProject.split(tokenSeparator)[0] : null;
4197
4182
  return token || undefined;
4198
4183
  };
4184
+ this.getRawTokenWithProject = () => {
4185
+ return this.token || this.app.sessionStorage.getItem(this.options.session_token_key);
4186
+ };
4199
4187
  this.setSessionToken = (token, projectKey) => {
4200
- this.token = `${token}_&_${projectKey}`;
4201
- this.app.sessionStorage.setItem(this.options.session_token_key, `${token}_&_${projectKey}`);
4188
+ this.token = `${token}${tokenSeparator}${projectKey}`;
4189
+ this.app.sessionStorage.setItem(this.options.session_token_key, `${token}${tokenSeparator}${projectKey}`);
4202
4190
  };
4203
4191
  this.app = params.app;
4204
4192
  this.options = params.options;
@@ -4261,7 +4249,7 @@ class Session {
4261
4249
  }
4262
4250
  getSessionHash() {
4263
4251
  const pageNo = this.getPageNumber();
4264
- const token = this.getSessionToken();
4252
+ const token = this.getRawTokenWithProject();
4265
4253
  if (pageNo === undefined || token === undefined) {
4266
4254
  return;
4267
4255
  }
@@ -4407,7 +4395,7 @@ class App {
4407
4395
  this.stopCallbacks = [];
4408
4396
  this.commitCallbacks = [];
4409
4397
  this.activityState = ActivityState.NotActive;
4410
- this.version = '17.0.0'; // TODO: version compatability check inside each plugin.
4398
+ this.version = '17.0.1'; // TODO: version compatability check inside each plugin.
4411
4399
  this.socketMode = false;
4412
4400
  this.compressionThreshold = 24 * 1000;
4413
4401
  this.bc = null;
@@ -8875,7 +8863,7 @@ class API {
8875
8863
  this.signalStartIssue = (reason, missingApi) => {
8876
8864
  const doNotTrack = this.checkDoNotTrack();
8877
8865
  console.log("Tracker couldn't start due to:", JSON.stringify({
8878
- trackerVersion: '17.0.0',
8866
+ trackerVersion: '17.0.1',
8879
8867
  projectKey: this.options.projectKey,
8880
8868
  doNotTrack,
8881
8869
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,