@openreplay/tracker 16.0.2 → 16.0.3-beta-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.
package/dist/lib/index.js CHANGED
@@ -3707,9 +3707,26 @@ async function parseUseEl(useElement, mode, domParser) {
3707
3707
  console.debug('Openreplay: xlink:href or href not found on <use>.');
3708
3708
  return;
3709
3709
  }
3710
- const [url, symbolId] = href.split('#');
3711
- if (!url || !symbolId) {
3712
- console.debug('Openreplay: Invalid xlink:href or href found on <use>.');
3710
+ let [url, symbolId] = href.split('#');
3711
+ // happens if svg spritemap is local, fastest case for us
3712
+ if (!url && symbolId) {
3713
+ const symbol = document.querySelector(href);
3714
+ if (symbol) {
3715
+ const inlineSvg = `
3716
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="${symbol.getAttribute('viewBox') || '0 0 24 24'}">
3717
+ ${symbol.innerHTML}
3718
+ </svg>
3719
+ `.trim();
3720
+ iconCache[symbolId] = inlineSvg;
3721
+ return inlineSvg;
3722
+ }
3723
+ else {
3724
+ console.warn('Openreplay: Sprite symbol not found in the document.');
3725
+ return;
3726
+ }
3727
+ }
3728
+ if (!url && !symbolId) {
3729
+ console.warn('Openreplay: Invalid xlink:href or href found on <use>.');
3713
3730
  return;
3714
3731
  }
3715
3732
  if (iconCache[symbolId]) {
@@ -4708,7 +4725,7 @@ class App {
4708
4725
  this.stopCallbacks = [];
4709
4726
  this.commitCallbacks = [];
4710
4727
  this.activityState = ActivityState.NotActive;
4711
- this.version = '16.0.2'; // TODO: version compatability check inside each plugin.
4728
+ this.version = '16.0.3-beta-1'; // TODO: version compatability check inside each plugin.
4712
4729
  this.socketMode = false;
4713
4730
  this.compressionThreshold = 24 * 1000;
4714
4731
  this.bc = null;
@@ -5321,8 +5338,7 @@ class App {
5321
5338
  * */
5322
5339
  _nCommit() {
5323
5340
  if (this.socketMode) {
5324
- this.messages.unshift(TabData(this.session.getTabId()));
5325
- this.messages.unshift(Timestamp(this.timestamp()));
5341
+ this.messages.unshift(Timestamp(this.timestamp()), TabData(this.session.getTabId()));
5326
5342
  this.commitCallbacks.forEach((cb) => cb(this.messages));
5327
5343
  this.messages.length = 0;
5328
5344
  return;
@@ -5341,8 +5357,7 @@ class App {
5341
5357
  }
5342
5358
  try {
5343
5359
  requestIdleCb(() => {
5344
- this.messages.unshift(TabData(this.session.getTabId()));
5345
- this.messages.unshift(Timestamp(this.timestamp()));
5360
+ this.messages.unshift(Timestamp(this.timestamp()), TabData(this.session.getTabId()));
5346
5361
  this.worker?.postMessage(this.messages);
5347
5362
  this.commitCallbacks.forEach((cb) => cb(this.messages));
5348
5363
  this.messages.length = 0;
@@ -5365,10 +5380,9 @@ class App {
5365
5380
  _cStartCommit() {
5366
5381
  this.coldStartCommitN += 1;
5367
5382
  if (this.coldStartCommitN === 2) {
5368
- this.bufferedMessages1.push(Timestamp(this.timestamp()));
5369
- this.bufferedMessages1.push(TabData(this.session.getTabId()));
5370
- this.bufferedMessages2.push(Timestamp(this.timestamp()));
5371
- this.bufferedMessages2.push(TabData(this.session.getTabId()));
5383
+ const payload = [Timestamp(this.timestamp()), TabData(this.session.getTabId())];
5384
+ this.bufferedMessages1.push(...payload);
5385
+ this.bufferedMessages2.push(...payload);
5372
5386
  this.coldStartCommitN = 0;
5373
5387
  }
5374
5388
  }
@@ -9171,7 +9185,7 @@ class API {
9171
9185
  this.signalStartIssue = (reason, missingApi) => {
9172
9186
  const doNotTrack = this.checkDoNotTrack();
9173
9187
  console.log("Tracker couldn't start due to:", JSON.stringify({
9174
- trackerVersion: '16.0.2',
9188
+ trackerVersion: '16.0.3-beta-1',
9175
9189
  projectKey: this.options.projectKey,
9176
9190
  doNotTrack,
9177
9191
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,