@glimt/record 0.0.53 → 0.0.54

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/record.cjs CHANGED
@@ -430,6 +430,9 @@ const index = {
430
430
  const shouldTryAnonymousFetchingOnCorsError$1 = () => {
431
431
  return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
432
432
  };
433
+ const isDebug$1 = () => {
434
+ return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
435
+ };
433
436
  function isElement(n2) {
434
437
  return n2.nodeType === n2.ELEMENT_NODE;
435
438
  }
@@ -1532,9 +1535,10 @@ function serializeElementNode(n2, options) {
1532
1535
  return;
1533
1536
  }
1534
1537
  } else {
1535
- console.warn(
1536
- `Cannot inline img src=${imageSrc}! Error: ${err}`
1537
- );
1538
+ if (isDebug$1())
1539
+ console.warn(
1540
+ `Cannot inline img src=${imageSrc}! Error: ${err}`
1541
+ );
1538
1542
  }
1539
1543
  }
1540
1544
  inlineImageCleanup();
@@ -1690,7 +1694,7 @@ function serializeNodeWithId(n2, options) {
1690
1694
  cssCaptured
1691
1695
  });
1692
1696
  if (!_serializedNode) {
1693
- console.warn(n2, "not serialized");
1697
+ if (isDebug$1()) console.warn(n2, "not serialized");
1694
1698
  return null;
1695
1699
  }
1696
1700
  let id;
@@ -12672,6 +12676,9 @@ class StylesheetManager {
12672
12676
  trackStylesheetInLinkElement(_linkEl) {
12673
12677
  }
12674
12678
  }
12679
+ const isDebug = () => {
12680
+ return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
12681
+ };
12675
12682
  let wrappedEmit;
12676
12683
  let takeFullSnapshot$1;
12677
12684
  let canvasManager;
@@ -12684,7 +12691,7 @@ try {
12684
12691
  document.body.removeChild(cleanFrame);
12685
12692
  }
12686
12693
  } catch (err) {
12687
- console.debug("Unable to override Array.from", err);
12694
+ if (isDebug()) console.debug("Unable to override Array.from", err);
12688
12695
  }
12689
12696
  const mirror = createMirror$2();
12690
12697
  function record(options = {}) {
@@ -12963,7 +12970,8 @@ function record(options = {}) {
12963
12970
  keepIframeSrcFn
12964
12971
  });
12965
12972
  if (!node2) {
12966
- return console.warn("Failed to snapshot the document");
12973
+ if (isDebug()) console.warn("Failed to snapshot the document");
12974
+ return;
12967
12975
  }
12968
12976
  wrappedEmit(
12969
12977
  {
@@ -13111,7 +13119,10 @@ function record(options = {}) {
13111
13119
  try {
13112
13120
  handlers.push(observe(iframeEl.contentDocument));
13113
13121
  } catch (error) {
13114
- console.warn(error);
13122
+ if (isDebug()) {
13123
+ console.warn("internal error");
13124
+ console.warn(error);
13125
+ }
13115
13126
  }
13116
13127
  });
13117
13128
  let initedAt = null;
@@ -13170,7 +13181,10 @@ function record(options = {}) {
13170
13181
  unregisterErrorHandler();
13171
13182
  };
13172
13183
  } catch (error) {
13173
- console.warn(error);
13184
+ if (isDebug()) {
13185
+ console.warn("internal error1");
13186
+ console.warn(error);
13187
+ }
13174
13188
  }
13175
13189
  }
13176
13190
  record.addCustomEvent = (tag, payload) => {