@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/cjs/entry.js CHANGED
@@ -3711,9 +3711,26 @@ async function parseUseEl(useElement, mode, domParser) {
3711
3711
  console.debug('Openreplay: xlink:href or href not found on <use>.');
3712
3712
  return;
3713
3713
  }
3714
- const [url, symbolId] = href.split('#');
3715
- if (!url || !symbolId) {
3716
- console.debug('Openreplay: Invalid xlink:href or href found on <use>.');
3714
+ let [url, symbolId] = href.split('#');
3715
+ // happens if svg spritemap is local, fastest case for us
3716
+ if (!url && symbolId) {
3717
+ const symbol = document.querySelector(href);
3718
+ if (symbol) {
3719
+ const inlineSvg = `
3720
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="${symbol.getAttribute('viewBox') || '0 0 24 24'}">
3721
+ ${symbol.innerHTML}
3722
+ </svg>
3723
+ `.trim();
3724
+ iconCache[symbolId] = inlineSvg;
3725
+ return inlineSvg;
3726
+ }
3727
+ else {
3728
+ console.warn('Openreplay: Sprite symbol not found in the document.');
3729
+ return;
3730
+ }
3731
+ }
3732
+ if (!url && !symbolId) {
3733
+ console.warn('Openreplay: Invalid xlink:href or href found on <use>.');
3717
3734
  return;
3718
3735
  }
3719
3736
  if (iconCache[symbolId]) {
@@ -4712,7 +4729,7 @@ class App {
4712
4729
  this.stopCallbacks = [];
4713
4730
  this.commitCallbacks = [];
4714
4731
  this.activityState = ActivityState.NotActive;
4715
- this.version = '16.0.2'; // TODO: version compatability check inside each plugin.
4732
+ this.version = '16.0.3-beta-1'; // TODO: version compatability check inside each plugin.
4716
4733
  this.socketMode = false;
4717
4734
  this.compressionThreshold = 24 * 1000;
4718
4735
  this.bc = null;
@@ -5325,8 +5342,7 @@ class App {
5325
5342
  * */
5326
5343
  _nCommit() {
5327
5344
  if (this.socketMode) {
5328
- this.messages.unshift(TabData(this.session.getTabId()));
5329
- this.messages.unshift(Timestamp(this.timestamp()));
5345
+ this.messages.unshift(Timestamp(this.timestamp()), TabData(this.session.getTabId()));
5330
5346
  this.commitCallbacks.forEach((cb) => cb(this.messages));
5331
5347
  this.messages.length = 0;
5332
5348
  return;
@@ -5345,8 +5361,7 @@ class App {
5345
5361
  }
5346
5362
  try {
5347
5363
  requestIdleCb(() => {
5348
- this.messages.unshift(TabData(this.session.getTabId()));
5349
- this.messages.unshift(Timestamp(this.timestamp()));
5364
+ this.messages.unshift(Timestamp(this.timestamp()), TabData(this.session.getTabId()));
5350
5365
  this.worker?.postMessage(this.messages);
5351
5366
  this.commitCallbacks.forEach((cb) => cb(this.messages));
5352
5367
  this.messages.length = 0;
@@ -5369,10 +5384,9 @@ class App {
5369
5384
  _cStartCommit() {
5370
5385
  this.coldStartCommitN += 1;
5371
5386
  if (this.coldStartCommitN === 2) {
5372
- this.bufferedMessages1.push(Timestamp(this.timestamp()));
5373
- this.bufferedMessages1.push(TabData(this.session.getTabId()));
5374
- this.bufferedMessages2.push(Timestamp(this.timestamp()));
5375
- this.bufferedMessages2.push(TabData(this.session.getTabId()));
5387
+ const payload = [Timestamp(this.timestamp()), TabData(this.session.getTabId())];
5388
+ this.bufferedMessages1.push(...payload);
5389
+ this.bufferedMessages2.push(...payload);
5376
5390
  this.coldStartCommitN = 0;
5377
5391
  }
5378
5392
  }
@@ -9175,7 +9189,7 @@ class API {
9175
9189
  this.signalStartIssue = (reason, missingApi) => {
9176
9190
  const doNotTrack = this.checkDoNotTrack();
9177
9191
  console.log("Tracker couldn't start due to:", JSON.stringify({
9178
- trackerVersion: '16.0.2',
9192
+ trackerVersion: '16.0.3-beta-1',
9179
9193
  projectKey: this.options.projectKey,
9180
9194
  doNotTrack,
9181
9195
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,