@skippr/live-agent-sdk 0.48.0 → 0.49.0

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.
@@ -2013,6 +2013,7 @@ function getRectInTopViewport(el) {
2013
2013
  import { jsx, jsxs } from "react/jsx-runtime";
2014
2014
  var Z_INDEX = 2147483646;
2015
2015
  var HIGHLIGHT_PADDING = 6;
2016
+ var HIGHLIGHT_AUTO_CLEAR_MS = 1e4;
2016
2017
  var textDecoder = new TextDecoder;
2017
2018
  function parseHighlightMessage(payload) {
2018
2019
  try {
@@ -2118,6 +2119,14 @@ function HighlightOverlay() {
2118
2119
  scheduleRecompute();
2119
2120
  });
2120
2121
  mutationObserver.observe(scrollContainer, { childList: true, subtree: true });
2122
+ const onClick = (event) => {
2123
+ const node = event.target;
2124
+ if (node && target.contains(node))
2125
+ clearOverlay();
2126
+ };
2127
+ const targetDoc = target.ownerDocument;
2128
+ targetDoc.addEventListener("click", onClick, { capture: true });
2129
+ const autoClearTimer = window.setTimeout(clearOverlay, HIGHLIGHT_AUTO_CLEAR_MS);
2121
2130
  return () => {
2122
2131
  for (const win of watchedWindows) {
2123
2132
  win.removeEventListener("scroll", onScroll, { capture: true });
@@ -2125,6 +2134,8 @@ function HighlightOverlay() {
2125
2134
  }
2126
2135
  resizeObserver.disconnect();
2127
2136
  mutationObserver.disconnect();
2137
+ targetDoc.removeEventListener("click", onClick, { capture: true });
2138
+ window.clearTimeout(autoClearTimer);
2128
2139
  if (pendingFrameRef.current !== null) {
2129
2140
  window.cancelAnimationFrame(pendingFrameRef.current);
2130
2141
  pendingFrameRef.current = null;