@skippr/live-agent-sdk 0.62.0 → 0.64.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.
@@ -1836,6 +1836,16 @@ function isInteractive(element, role) {
1836
1836
  return true;
1837
1837
  return false;
1838
1838
  }
1839
+ function isCursorClickable(element, rect) {
1840
+ if (!intersectsViewport(rect, window.innerWidth, window.innerHeight))
1841
+ return false;
1842
+ if (window.getComputedStyle(element).cursor !== "pointer")
1843
+ return false;
1844
+ const parent = element.parentElement;
1845
+ if (parent && window.getComputedStyle(parent).cursor === "pointer")
1846
+ return false;
1847
+ return true;
1848
+ }
1839
1849
  function isBlindRegion(role) {
1840
1850
  return role === "video" || role === "iframe" || role === "canvas" || role === "audio" || role === "embed" || role === "object";
1841
1851
  }
@@ -2117,7 +2127,7 @@ function walkAndCollect(element, depth, entries) {
2117
2127
  if (shouldSkipSubtree(element))
2118
2128
  return;
2119
2129
  const rect = element.getBoundingClientRect();
2120
- const role = inferRole(element);
2130
+ const role = inferRole(element) ?? (isCursorClickable(element, rect) ? "button" : null);
2121
2131
  const isVisibleAndEmittable = role !== null && isVisible(element, rect) && shouldEmitElement(element, role);
2122
2132
  let childDepth = depth;
2123
2133
  if (isVisibleAndEmittable && role) {
@@ -3186,8 +3196,6 @@ function parsePageAction(payload) {
3186
3196
  const direction = parseScrollDirection(json.direction);
3187
3197
  return typeof json.ref === "string" && direction ? { type: "scroll_in", ref: json.ref, direction } : null;
3188
3198
  }
3189
- case "navigate":
3190
- return typeof json.url === "string" ? { type: "navigate", url: json.url } : null;
3191
3199
  default:
3192
3200
  return null;
3193
3201
  }
@@ -3195,16 +3203,6 @@ function parsePageAction(payload) {
3195
3203
  return null;
3196
3204
  }
3197
3205
  }
3198
- function isSameOriginHttpUrl(url) {
3199
- try {
3200
- const parsed = new URL(url);
3201
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:")
3202
- return false;
3203
- return parsed.origin === window.location.origin;
3204
- } catch {
3205
- return false;
3206
- }
3207
- }
3208
3206
  function isVisible2(element) {
3209
3207
  const rect = element.getBoundingClientRect();
3210
3208
  if (rect.width === 0 && rect.height === 0)
@@ -3381,8 +3379,6 @@ function labelFor(action) {
3381
3379
  return "Scrolling…";
3382
3380
  case "hover":
3383
3381
  return "Hovering…";
3384
- case "navigate":
3385
- return "Navigating…";
3386
3382
  }
3387
3383
  }
3388
3384
  function PageActionHandler() {
@@ -3393,13 +3389,6 @@ function PageActionHandler() {
3393
3389
  const endStepRef = useRef8(null);
3394
3390
  const runStep = useCallback7((action) => {
3395
3391
  return new Promise((resolve) => {
3396
- if (action.type === "navigate") {
3397
- queueRef.current.length = 0;
3398
- if (isSameOriginHttpUrl(action.url))
3399
- window.location.assign(action.url);
3400
- resolve(true);
3401
- return;
3402
- }
3403
3392
  if (action.type === "scroll_page") {
3404
3393
  let scrolled = false;
3405
3394
  const finishScroll = () => {