@glimt/record 0.0.52 → 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
@@ -428,16 +428,11 @@ const index = {
428
428
  patch
429
429
  };
430
430
  const shouldTryAnonymousFetchingOnCorsError$1 = () => {
431
- try {
432
- console.log(
433
- "window._rrweb_skip_re_fetching_to_suppress_cors_errors",
434
- //@ts-expect-error
435
- window._rrweb_skip_re_fetching_to_suppress_cors_errors
436
- );
437
- } catch (err) {
438
- }
439
431
  return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
440
432
  };
433
+ const isDebug$1 = () => {
434
+ return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
435
+ };
441
436
  function isElement(n2) {
442
437
  return n2.nodeType === n2.ELEMENT_NODE;
443
438
  }
@@ -1506,9 +1501,7 @@ function serializeElementNode(n2, options) {
1506
1501
  const imageSrc = (image.currentSrc || image.getAttribute("src") || "<unknown-src>") + "";
1507
1502
  const imageHeight = image.naturalHeight;
1508
1503
  const imageWidth = image.naturalWidth;
1509
- console.log("handling inline image", image, imageSrc);
1510
1504
  const inlineImageCleanup = () => {
1511
- console.log("cleaning up", imageSrc);
1512
1505
  overrideImage = null;
1513
1506
  };
1514
1507
  const recordInlineImage = () => {
@@ -1522,11 +1515,8 @@ function serializeElementNode(n2, options) {
1522
1515
  dataURLOptions.quality
1523
1516
  );
1524
1517
  } catch (err) {
1525
- console.log("detected inline image error", err, imageSrc);
1526
1518
  if (image.crossOrigin !== "anonymous") {
1527
- console.log("crossOrigin is not anonymous", imageSrc);
1528
1519
  if (shouldTryAnonymousFetchingOnCorsError$1()) {
1529
- console.log("overriding image", imageSrc);
1530
1520
  overrideImage = new Image();
1531
1521
  overrideImage.src = imageSrc;
1532
1522
  overrideImage.crossOrigin = "anonymous";
@@ -1545,9 +1535,10 @@ function serializeElementNode(n2, options) {
1545
1535
  return;
1546
1536
  }
1547
1537
  } else {
1548
- console.warn(
1549
- `Cannot inline img src=${imageSrc}! Error: ${err}`
1550
- );
1538
+ if (isDebug$1())
1539
+ console.warn(
1540
+ `Cannot inline img src=${imageSrc}! Error: ${err}`
1541
+ );
1551
1542
  }
1552
1543
  }
1553
1544
  inlineImageCleanup();
@@ -1703,7 +1694,7 @@ function serializeNodeWithId(n2, options) {
1703
1694
  cssCaptured
1704
1695
  });
1705
1696
  if (!_serializedNode) {
1706
- console.warn(n2, "not serialized");
1697
+ if (isDebug$1()) console.warn(n2, "not serialized");
1707
1698
  return null;
1708
1699
  }
1709
1700
  let id;
@@ -5598,14 +5589,6 @@ var __defProp22 = Object.defineProperty;
5598
5589
  var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5599
5590
  var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5600
5591
  const shouldTryAnonymousFetchingOnCorsError = () => {
5601
- try {
5602
- console.log(
5603
- "window._rrweb_skip_re_fetching_to_suppress_cors_errors",
5604
- //@ts-expect-error
5605
- window._rrweb_skip_re_fetching_to_suppress_cors_errors
5606
- );
5607
- } catch (err) {
5608
- }
5609
5592
  return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
5610
5593
  };
5611
5594
  function fixBrowserCompatibilityIssuesInCSS(cssText) {
@@ -12693,6 +12676,9 @@ class StylesheetManager {
12693
12676
  trackStylesheetInLinkElement(_linkEl) {
12694
12677
  }
12695
12678
  }
12679
+ const isDebug = () => {
12680
+ return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
12681
+ };
12696
12682
  let wrappedEmit;
12697
12683
  let takeFullSnapshot$1;
12698
12684
  let canvasManager;
@@ -12705,7 +12691,7 @@ try {
12705
12691
  document.body.removeChild(cleanFrame);
12706
12692
  }
12707
12693
  } catch (err) {
12708
- console.debug("Unable to override Array.from", err);
12694
+ if (isDebug()) console.debug("Unable to override Array.from", err);
12709
12695
  }
12710
12696
  const mirror = createMirror$2();
12711
12697
  function record(options = {}) {
@@ -12984,7 +12970,8 @@ function record(options = {}) {
12984
12970
  keepIframeSrcFn
12985
12971
  });
12986
12972
  if (!node2) {
12987
- return console.warn("Failed to snapshot the document");
12973
+ if (isDebug()) console.warn("Failed to snapshot the document");
12974
+ return;
12988
12975
  }
12989
12976
  wrappedEmit(
12990
12977
  {
@@ -13132,7 +13119,10 @@ function record(options = {}) {
13132
13119
  try {
13133
13120
  handlers.push(observe(iframeEl.contentDocument));
13134
13121
  } catch (error) {
13135
- console.warn(error);
13122
+ if (isDebug()) {
13123
+ console.warn("internal error");
13124
+ console.warn(error);
13125
+ }
13136
13126
  }
13137
13127
  });
13138
13128
  let initedAt = null;
@@ -13191,7 +13181,10 @@ function record(options = {}) {
13191
13181
  unregisterErrorHandler();
13192
13182
  };
13193
13183
  } catch (error) {
13194
- console.warn(error);
13184
+ if (isDebug()) {
13185
+ console.warn("internal error1");
13186
+ console.warn(error);
13187
+ }
13195
13188
  }
13196
13189
  }
13197
13190
  record.addCustomEvent = (tag, payload) => {