@amplifyup/sdk 0.1.30 → 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.
@@ -1444,6 +1444,11 @@ Available Console Commands:
1444
1444
  if (config.componentName) {
1445
1445
  properties.componentName = config.componentName;
1446
1446
  }
1447
+ if (config.staticProperties) {
1448
+ for (const [key, value] of Object.entries(config.staticProperties)) {
1449
+ if (key) properties[key] = value;
1450
+ }
1451
+ }
1447
1452
  if (config.properties && config.properties.length > 0) {
1448
1453
  config.properties.forEach((prop) => {
1449
1454
  const dataAttrValue = element.getAttribute(`data-${prop}`);
@@ -1810,13 +1815,23 @@ Available Console Commands:
1810
1815
  document.removeEventListener("click", this.eventSelectionClickHandler, true);
1811
1816
  this.eventSelectionClickHandler = null;
1812
1817
  }
1818
+ if (enabled && typeof window !== "undefined" && window.__AMPLIFYUP_PREVIEW_MODE__) {
1819
+ return;
1820
+ }
1813
1821
  if (enabled) {
1814
1822
  this.eventSelectionClickHandler = (e) => {
1815
- const target = e.target;
1816
- if (!target) return;
1823
+ const raw = e.target;
1824
+ if (!raw) return;
1825
+ const interactive = raw.closest(
1826
+ 'a, button, [role="button"], input, select, textarea, [data-el], [data-amplifyup-component], [data-component-id]'
1827
+ );
1828
+ const target = interactive instanceof HTMLElement ? interactive : raw;
1829
+ e.preventDefault();
1830
+ e.stopPropagation();
1831
+ e.stopImmediatePropagation();
1817
1832
  const selector = this.generateSelectorForElement(target);
1818
1833
  const tagName = target.tagName.toLowerCase();
1819
- const text = target.textContent?.trim().substring(0, 50) || "";
1834
+ const text = (target.textContent || "").replace(/\s+/g, " ").trim().substring(0, 80);
1820
1835
  if (window.parent && window.parent !== window) {
1821
1836
  window.parent.postMessage({
1822
1837
  type: "ELEMENT_CLICKED_FOR_EVENT",
@@ -1825,9 +1840,6 @@ Available Console Commands:
1825
1840
  text
1826
1841
  }, "*");
1827
1842
  }
1828
- if (tagName === "a") {
1829
- e.preventDefault();
1830
- }
1831
1843
  };
1832
1844
  document.addEventListener("click", this.eventSelectionClickHandler, true);
1833
1845
  if (this.config?.debug) {