@shellapps/experience 1.10.0 → 1.10.2

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/index.js CHANGED
@@ -916,10 +916,10 @@ var BreadcrumbManager = class {
916
916
  }
917
917
  setupFetchWrapping() {
918
918
  if (typeof fetch === "undefined" || typeof window === "undefined") return;
919
- this.originalFetch = window.fetch;
919
+ this.originalFetch = window.fetch.bind(window);
920
920
  window.fetch = async (input, init) => {
921
- const url = typeof input === "string" ? input : input.toString();
922
- const method = init?.method || "GET";
921
+ const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input instanceof Request ? input.url : String(input);
922
+ const method = init?.method || (input instanceof Request ? input.method : "GET");
923
923
  const startTime = Date.now();
924
924
  try {
925
925
  const response = await this.originalFetch(input, init);
@@ -1670,7 +1670,7 @@ var DataTTracker = class {
1670
1670
  setupEventDelegation() {
1671
1671
  const handleClick = (event) => {
1672
1672
  const target = event.target;
1673
- if (!target) return;
1673
+ if (!(target instanceof Element)) return;
1674
1674
  const dataTElement = this.findDataTParent(target);
1675
1675
  if (dataTElement) {
1676
1676
  this.trackDataTEvent("click", dataTElement, {
@@ -1712,6 +1712,7 @@ var DataTTracker = class {
1712
1712
  setupHoverTracking() {
1713
1713
  const handleMouseEnter = (event) => {
1714
1714
  const target = event.target;
1715
+ if (!(target instanceof Element)) return;
1715
1716
  const dataTElement = this.findDataTParent(target);
1716
1717
  if (!dataTElement) return;
1717
1718
  const timer = window.setTimeout(() => {
@@ -1722,6 +1723,7 @@ var DataTTracker = class {
1722
1723
  };
1723
1724
  const handleMouseLeave = (event) => {
1724
1725
  const target = event.target;
1726
+ if (!(target instanceof Element)) return;
1725
1727
  const dataTElement = this.findDataTParent(target);
1726
1728
  if (!dataTElement) return;
1727
1729
  const timer = this.hoverTimers.get(dataTElement);
@@ -1752,7 +1754,7 @@ var DataTTracker = class {
1752
1754
  findDataTParent(element) {
1753
1755
  let current = element;
1754
1756
  while (current) {
1755
- if (current.hasAttribute("data-t")) {
1757
+ if (typeof current.hasAttribute === "function" && current.hasAttribute("data-t")) {
1756
1758
  return current;
1757
1759
  }
1758
1760
  current = current.parentElement;