@amplifyup/sdk 0.1.29 → 0.1.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.
package/dist/index.mjs CHANGED
@@ -429,7 +429,8 @@ function mapResolvedToPageConfig(payload) {
429
429
  meta: {
430
430
  // Stash edge meta for diagnostics (not visitor-facing)
431
431
  description: payload.meta?.degraded ? "degraded" : void 0
432
- }
432
+ },
433
+ ...payload.eventTracking && payload.eventTracking.length > 0 ? { eventTracking: payload.eventTracking } : {}
433
434
  };
434
435
  }
435
436
  function collectDegraded(payload) {
@@ -1604,6 +1605,11 @@ Available Console Commands:
1604
1605
  if (config.componentName) {
1605
1606
  properties.componentName = config.componentName;
1606
1607
  }
1608
+ if (config.staticProperties) {
1609
+ for (const [key, value] of Object.entries(config.staticProperties)) {
1610
+ if (key) properties[key] = value;
1611
+ }
1612
+ }
1607
1613
  if (config.properties && config.properties.length > 0) {
1608
1614
  config.properties.forEach((prop) => {
1609
1615
  const dataAttrValue = element.getAttribute(`data-${prop}`);
@@ -1970,13 +1976,23 @@ Available Console Commands:
1970
1976
  document.removeEventListener("click", this.eventSelectionClickHandler, true);
1971
1977
  this.eventSelectionClickHandler = null;
1972
1978
  }
1979
+ if (enabled && typeof window !== "undefined" && window.__AMPLIFYUP_PREVIEW_MODE__) {
1980
+ return;
1981
+ }
1973
1982
  if (enabled) {
1974
1983
  this.eventSelectionClickHandler = (e) => {
1975
- const target = e.target;
1976
- if (!target) return;
1984
+ const raw = e.target;
1985
+ if (!raw) return;
1986
+ const interactive = raw.closest(
1987
+ 'a, button, [role="button"], input, select, textarea, [data-el], [data-amplifyup-component], [data-component-id]'
1988
+ );
1989
+ const target = interactive instanceof HTMLElement ? interactive : raw;
1990
+ e.preventDefault();
1991
+ e.stopPropagation();
1992
+ e.stopImmediatePropagation();
1977
1993
  const selector = this.generateSelectorForElement(target);
1978
1994
  const tagName = target.tagName.toLowerCase();
1979
- const text = target.textContent?.trim().substring(0, 50) || "";
1995
+ const text = (target.textContent || "").replace(/\s+/g, " ").trim().substring(0, 80);
1980
1996
  if (window.parent && window.parent !== window) {
1981
1997
  window.parent.postMessage({
1982
1998
  type: "ELEMENT_CLICKED_FOR_EVENT",
@@ -1985,9 +2001,6 @@ Available Console Commands:
1985
2001
  text
1986
2002
  }, "*");
1987
2003
  }
1988
- if (tagName === "a") {
1989
- e.preventDefault();
1990
- }
1991
2004
  };
1992
2005
  document.addEventListener("click", this.eventSelectionClickHandler, true);
1993
2006
  if (this.config?.debug) {