@appsurify-testmap/rrweb-record 2.0.0-alpha.30 → 2.0.0-alpha.31

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.
@@ -7,46 +7,6 @@ var _a;
7
7
  var __defProp$1 = Object.defineProperty;
8
8
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
9
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
10
- var InteractiveEvent = /* @__PURE__ */ ((InteractiveEvent2) => {
11
- InteractiveEvent2[InteractiveEvent2["Change"] = 0] = "Change";
12
- InteractiveEvent2[InteractiveEvent2["Submit"] = 1] = "Submit";
13
- InteractiveEvent2[InteractiveEvent2["DragStart"] = 2] = "DragStart";
14
- InteractiveEvent2[InteractiveEvent2["Drop"] = 3] = "Drop";
15
- InteractiveEvent2[InteractiveEvent2["PointerDown"] = 4] = "PointerDown";
16
- InteractiveEvent2[InteractiveEvent2["PointerUp"] = 5] = "PointerUp";
17
- InteractiveEvent2[InteractiveEvent2["Input"] = 6] = "Input";
18
- InteractiveEvent2[InteractiveEvent2["KeyDown"] = 7] = "KeyDown";
19
- InteractiveEvent2[InteractiveEvent2["KeyUp"] = 8] = "KeyUp";
20
- InteractiveEvent2[InteractiveEvent2["KeyPress"] = 9] = "KeyPress";
21
- InteractiveEvent2[InteractiveEvent2["MouseEnter"] = 10] = "MouseEnter";
22
- InteractiveEvent2[InteractiveEvent2["MouseLeave"] = 11] = "MouseLeave";
23
- InteractiveEvent2[InteractiveEvent2["MouseUp"] = 12] = "MouseUp";
24
- InteractiveEvent2[InteractiveEvent2["MouseDown"] = 13] = "MouseDown";
25
- InteractiveEvent2[InteractiveEvent2["Click"] = 14] = "Click";
26
- InteractiveEvent2[InteractiveEvent2["ContextMenu"] = 15] = "ContextMenu";
27
- InteractiveEvent2[InteractiveEvent2["DblClick"] = 16] = "DblClick";
28
- InteractiveEvent2[InteractiveEvent2["Focus"] = 17] = "Focus";
29
- InteractiveEvent2[InteractiveEvent2["Blur"] = 18] = "Blur";
30
- InteractiveEvent2[InteractiveEvent2["TouchStart"] = 19] = "TouchStart";
31
- InteractiveEvent2[InteractiveEvent2["TouchMove"] = 20] = "TouchMove";
32
- InteractiveEvent2[InteractiveEvent2["TouchEnd"] = 21] = "TouchEnd";
33
- InteractiveEvent2[InteractiveEvent2["TouchCancel"] = 22] = "TouchCancel";
34
- return InteractiveEvent2;
35
- })(InteractiveEvent || {});
36
- var interactiveTag = /* @__PURE__ */ ((interactiveTag2) => {
37
- interactiveTag2[interactiveTag2["Input"] = 0] = "Input";
38
- interactiveTag2[interactiveTag2["Button"] = 1] = "Button";
39
- interactiveTag2[interactiveTag2["A"] = 2] = "A";
40
- interactiveTag2[interactiveTag2["Select"] = 3] = "Select";
41
- interactiveTag2[interactiveTag2["Textarea"] = 4] = "Textarea";
42
- interactiveTag2[interactiveTag2["Label"] = 5] = "Label";
43
- interactiveTag2[interactiveTag2["Details"] = 6] = "Details";
44
- interactiveTag2[interactiveTag2["Summary"] = 7] = "Summary";
45
- interactiveTag2[interactiveTag2["Dialog"] = 8] = "Dialog";
46
- interactiveTag2[interactiveTag2["Video"] = 9] = "Video";
47
- interactiveTag2[interactiveTag2["Audio"] = 10] = "Audio";
48
- return interactiveTag2;
49
- })(interactiveTag || {});
50
10
  var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
51
11
  NodeType2[NodeType2["Document"] = 0] = "Document";
52
12
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -626,32 +586,94 @@ function isStyleVisible(n2) {
626
586
  function isRectVisible(rect) {
627
587
  return rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
628
588
  }
629
- function getInteractiveEvents() {
630
- return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
631
- }
632
- function getInteractiveTags() {
633
- return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
634
- }
589
+ const interactiveEvents$1 = [
590
+ "change",
591
+ "submit",
592
+ "dragstart",
593
+ "drop",
594
+ "pointerdown",
595
+ "pointerup",
596
+ "input",
597
+ "keydown",
598
+ "keyup",
599
+ "keypress",
600
+ "mouseenter",
601
+ "mouseleave",
602
+ "mouseup",
603
+ "mousedown",
604
+ "click",
605
+ "contextmenu",
606
+ "dblclick",
607
+ "focus",
608
+ "blur",
609
+ "touchstart",
610
+ "touchmove",
611
+ "touchend",
612
+ "touchcancel"
613
+ ];
614
+ const interactiveTags = [
615
+ "a",
616
+ "button",
617
+ "input",
618
+ "select",
619
+ "textarea",
620
+ "label",
621
+ "details",
622
+ "summary",
623
+ "dialog",
624
+ "video",
625
+ "audio"
626
+ ];
627
+ const inlineEventAttributes$1 = [
628
+ "onclick",
629
+ "ondblclick",
630
+ "onmousedown",
631
+ "onmouseup",
632
+ "onmouseover",
633
+ "onmouseout",
634
+ "onmousemove",
635
+ "onfocus",
636
+ "onblur",
637
+ "onkeydown",
638
+ "onkeypress",
639
+ "onkeyup",
640
+ "onchange",
641
+ "oninput",
642
+ "onsubmit",
643
+ "onreset",
644
+ "onselect",
645
+ "oncontextmenu",
646
+ "ontouchstart",
647
+ "ontouchmove",
648
+ "ontouchend",
649
+ "ontouchcancel"
650
+ ];
651
+ const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
652
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
653
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
654
+ originalAddEventListener$1.call(this, type, listener, options);
655
+ if (this instanceof Element) {
656
+ const eventType = type.toLowerCase();
657
+ console.info("Event type: ", eventType);
658
+ if (interactiveEvents$1.includes(eventType)) {
659
+ interactiveElementsRegistry$1.add(this);
660
+ }
661
+ }
662
+ };
663
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
664
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
665
+ originalRemoveEventListener$1.call(this, type, listener, options);
666
+ };
635
667
  function hasEventListeners(n2) {
636
- return getInteractiveEvents().some((eventType) => {
637
- let hasListener = false;
638
- const testListener = () => {
639
- hasListener = true;
640
- };
641
- n2.addEventListener(eventType, testListener);
642
- n2.dispatchEvent(new Event(eventType));
643
- n2.removeEventListener(eventType, testListener);
644
- return hasListener;
645
- });
668
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
646
669
  }
647
670
  function isElementInteractive(n2) {
648
671
  var _a2;
649
- const allowedTags = getInteractiveTags();
650
672
  if (n2.nodeType === Node.ELEMENT_NODE) {
651
673
  const element = n2;
652
674
  const tagName = element.tagName.toLowerCase();
653
- if (!allowedTags.includes(tagName)) {
654
- return false;
675
+ if (interactiveTags.includes(tagName)) {
676
+ return true;
655
677
  }
656
678
  const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
657
679
  const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
@@ -663,10 +685,28 @@ function isElementInteractive(n2) {
663
685
  if (n2.nodeType === Node.TEXT_NODE) {
664
686
  const textNode = n2;
665
687
  const parentElement2 = textNode.parentElement;
666
- return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
688
+ if (parentElement2 !== null && interactiveTags.includes(parentElement2.tagName.toLowerCase())) {
689
+ return true;
690
+ }
691
+ return parentElement2 !== null && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
667
692
  }
668
693
  return false;
669
694
  }
695
+ function inspectInlineEventHandlers$1() {
696
+ const allElements = document.querySelectorAll("*");
697
+ allElements.forEach((el) => {
698
+ inlineEventAttributes$1.forEach((attr) => {
699
+ if (el.hasAttribute(attr)) {
700
+ interactiveElementsRegistry$1.add(el);
701
+ }
702
+ });
703
+ });
704
+ }
705
+ if (document.readyState === "complete" || document.readyState === "interactive") {
706
+ inspectInlineEventHandlers$1();
707
+ } else {
708
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
709
+ }
670
710
  let _id = 1;
671
711
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
672
712
  const IGNORED_NODE = -2;
@@ -5129,6 +5169,86 @@ postcss$1$1.Node;
5129
5169
  var __defProp2 = Object.defineProperty;
5130
5170
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5131
5171
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
5172
+ const interactiveEvents = [
5173
+ "change",
5174
+ "submit",
5175
+ "dragstart",
5176
+ "drop",
5177
+ "pointerdown",
5178
+ "pointerup",
5179
+ "input",
5180
+ "keydown",
5181
+ "keyup",
5182
+ "keypress",
5183
+ "mouseenter",
5184
+ "mouseleave",
5185
+ "mouseup",
5186
+ "mousedown",
5187
+ "click",
5188
+ "contextmenu",
5189
+ "dblclick",
5190
+ "focus",
5191
+ "blur",
5192
+ "touchstart",
5193
+ "touchmove",
5194
+ "touchend",
5195
+ "touchcancel"
5196
+ ];
5197
+ const inlineEventAttributes = [
5198
+ "onclick",
5199
+ "ondblclick",
5200
+ "onmousedown",
5201
+ "onmouseup",
5202
+ "onmouseover",
5203
+ "onmouseout",
5204
+ "onmousemove",
5205
+ "onfocus",
5206
+ "onblur",
5207
+ "onkeydown",
5208
+ "onkeypress",
5209
+ "onkeyup",
5210
+ "onchange",
5211
+ "oninput",
5212
+ "onsubmit",
5213
+ "onreset",
5214
+ "onselect",
5215
+ "oncontextmenu",
5216
+ "ontouchstart",
5217
+ "ontouchmove",
5218
+ "ontouchend",
5219
+ "ontouchcancel"
5220
+ ];
5221
+ const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5222
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5223
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5224
+ originalAddEventListener.call(this, type, listener, options);
5225
+ if (this instanceof Element) {
5226
+ const eventType = type.toLowerCase();
5227
+ console.info("Event type: ", eventType);
5228
+ if (interactiveEvents.includes(eventType)) {
5229
+ interactiveElementsRegistry.add(this);
5230
+ }
5231
+ }
5232
+ };
5233
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5234
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5235
+ originalRemoveEventListener.call(this, type, listener, options);
5236
+ };
5237
+ function inspectInlineEventHandlers() {
5238
+ const allElements = document.querySelectorAll("*");
5239
+ allElements.forEach((el) => {
5240
+ inlineEventAttributes.forEach((attr) => {
5241
+ if (el.hasAttribute(attr)) {
5242
+ interactiveElementsRegistry.add(el);
5243
+ }
5244
+ });
5245
+ });
5246
+ }
5247
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5248
+ inspectInlineEventHandlers();
5249
+ } else {
5250
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5251
+ }
5132
5252
  function getDefaultExportFromCjs(x2) {
5133
5253
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5134
5254
  }
@@ -9995,6 +10115,7 @@ function initMouseInteractionObserver({
9995
10115
  }) {
9996
10116
  if (sampling.mouseInteraction === false) {
9997
10117
  return () => {
10118
+ console.debug("MouseInteractionObserver: No operation needed");
9998
10119
  };
9999
10120
  }
10000
10121
  const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;