@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.
package/dist/index.mjs CHANGED
@@ -1605,6 +1605,11 @@ Available Console Commands:
1605
1605
  if (config.componentName) {
1606
1606
  properties.componentName = config.componentName;
1607
1607
  }
1608
+ if (config.staticProperties) {
1609
+ for (const [key, value] of Object.entries(config.staticProperties)) {
1610
+ if (key) properties[key] = value;
1611
+ }
1612
+ }
1608
1613
  if (config.properties && config.properties.length > 0) {
1609
1614
  config.properties.forEach((prop) => {
1610
1615
  const dataAttrValue = element.getAttribute(`data-${prop}`);
@@ -1971,13 +1976,23 @@ Available Console Commands:
1971
1976
  document.removeEventListener("click", this.eventSelectionClickHandler, true);
1972
1977
  this.eventSelectionClickHandler = null;
1973
1978
  }
1979
+ if (enabled && typeof window !== "undefined" && window.__AMPLIFYUP_PREVIEW_MODE__) {
1980
+ return;
1981
+ }
1974
1982
  if (enabled) {
1975
1983
  this.eventSelectionClickHandler = (e) => {
1976
- const target = e.target;
1977
- 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();
1978
1993
  const selector = this.generateSelectorForElement(target);
1979
1994
  const tagName = target.tagName.toLowerCase();
1980
- const text = target.textContent?.trim().substring(0, 50) || "";
1995
+ const text = (target.textContent || "").replace(/\s+/g, " ").trim().substring(0, 80);
1981
1996
  if (window.parent && window.parent !== window) {
1982
1997
  window.parent.postMessage({
1983
1998
  type: "ELEMENT_CLICKED_FOR_EVENT",
@@ -1986,9 +2001,6 @@ Available Console Commands:
1986
2001
  text
1987
2002
  }, "*");
1988
2003
  }
1989
- if (tagName === "a") {
1990
- e.preventDefault();
1991
- }
1992
2004
  };
1993
2005
  document.addEventListener("click", this.eventSelectionClickHandler, true);
1994
2006
  if (this.config?.debug) {