@skippr/live-agent-sdk 0.113.0 → 0.114.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.
@@ -7180,6 +7180,7 @@ function DomCapture({ pushOrTapMicMode = false, startMuted = false }) {
7180
7180
  import { useDataChannel } from "@livekit/components-react/hooks";
7181
7181
  import { useCallback as useCallback18, useEffect as useEffect25, useRef as useRef19 } from "react";
7182
7182
  var HIGHLIGHT_AUTO_CLEAR_MS = 25000;
7183
+ var HIGHLIGHT_RETARGET_INTERVAL_MS = 250;
7183
7184
  var textDecoder = new TextDecoder;
7184
7185
  function parseHighlightMessage(payload) {
7185
7186
  try {
@@ -7202,12 +7203,14 @@ function parseHighlightMessage(payload) {
7202
7203
  }
7203
7204
  function HighlightOverlay() {
7204
7205
  const targetRef = useRef19(null);
7206
+ const shownRef = useRef19(null);
7205
7207
  const autoClearRef = useRef19(null);
7206
7208
  const clear = useCallback18(() => {
7207
7209
  if (autoClearRef.current)
7208
7210
  clearTimeout(autoClearRef.current);
7209
7211
  autoClearRef.current = null;
7210
7212
  targetRef.current = null;
7213
+ shownRef.current = null;
7211
7214
  clearCursorTarget("guide");
7212
7215
  setHighlightActive(false);
7213
7216
  }, []);
@@ -7227,6 +7230,7 @@ function HighlightOverlay() {
7227
7230
  if (autoClearRef.current)
7228
7231
  clearTimeout(autoClearRef.current);
7229
7232
  targetRef.current = element;
7233
+ shownRef.current = parsed;
7230
7234
  setCursorTarget("guide", {
7231
7235
  element,
7232
7236
  label: parsed.message || "Click here",
@@ -7237,6 +7241,26 @@ function HighlightOverlay() {
7237
7241
  }, [clear]);
7238
7242
  useDataChannel(HIGHLIGHT_TOPIC, onHighlightMessage);
7239
7243
  useEffect25(() => onHighlightCleared(clear), [clear]);
7244
+ useEffect25(() => {
7245
+ const timer = setInterval(() => {
7246
+ const shown = shownRef.current;
7247
+ const target = targetRef.current;
7248
+ if (!shown || !target || target.isConnected)
7249
+ return;
7250
+ const replacement = findElementByRef(shown.ref);
7251
+ if (!replacement) {
7252
+ clear();
7253
+ return;
7254
+ }
7255
+ targetRef.current = replacement;
7256
+ setCursorTarget("guide", {
7257
+ element: replacement,
7258
+ label: shown.message || "Click here",
7259
+ mode: "guide"
7260
+ });
7261
+ }, HIGHLIGHT_RETARGET_INTERVAL_MS);
7262
+ return () => clearInterval(timer);
7263
+ }, [clear]);
7240
7264
  useEffect25(() => {
7241
7265
  const onClick = (event) => {
7242
7266
  const target = targetRef.current;