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