@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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-6qEnwLda.mjs';
2
- export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-6qEnwLda.mjs';
1
+ import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-npF_lNoq.mjs';
2
+ export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-npF_lNoq.mjs';
3
3
  export { i as isComposerPreview, a as isPreviewRequest } from './preview-BMrIgUvp.mjs';
4
4
 
5
5
  interface FetchContentResult {
@@ -122,6 +122,7 @@ interface EventTrackingConfig {
122
122
  selector?: string;
123
123
  description?: string;
124
124
  properties?: string[];
125
+ staticProperties?: Record<string, string>;
125
126
  enabled?: boolean;
126
127
  componentId?: string | null;
127
128
  componentName?: string | null;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-6qEnwLda.js';
2
- export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-6qEnwLda.js';
1
+ import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-npF_lNoq.js';
2
+ export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-npF_lNoq.js';
3
3
  export { i as isComposerPreview, a as isPreviewRequest } from './preview-BMrIgUvp.js';
4
4
 
5
5
  interface FetchContentResult {
@@ -122,6 +122,7 @@ interface EventTrackingConfig {
122
122
  selector?: string;
123
123
  description?: string;
124
124
  properties?: string[];
125
+ staticProperties?: Record<string, string>;
125
126
  enabled?: boolean;
126
127
  componentId?: string | null;
127
128
  componentName?: string | null;
package/dist/index.js CHANGED
@@ -1609,6 +1609,11 @@ Available Console Commands:
1609
1609
  if (config.componentName) {
1610
1610
  properties.componentName = config.componentName;
1611
1611
  }
1612
+ if (config.staticProperties) {
1613
+ for (const [key, value] of Object.entries(config.staticProperties)) {
1614
+ if (key) properties[key] = value;
1615
+ }
1616
+ }
1612
1617
  if (config.properties && config.properties.length > 0) {
1613
1618
  config.properties.forEach((prop) => {
1614
1619
  const dataAttrValue = element.getAttribute(`data-${prop}`);
@@ -1975,13 +1980,23 @@ Available Console Commands:
1975
1980
  document.removeEventListener("click", this.eventSelectionClickHandler, true);
1976
1981
  this.eventSelectionClickHandler = null;
1977
1982
  }
1983
+ if (enabled && typeof window !== "undefined" && window.__AMPLIFYUP_PREVIEW_MODE__) {
1984
+ return;
1985
+ }
1978
1986
  if (enabled) {
1979
1987
  this.eventSelectionClickHandler = (e) => {
1980
- const target = e.target;
1981
- if (!target) return;
1988
+ const raw = e.target;
1989
+ if (!raw) return;
1990
+ const interactive = raw.closest(
1991
+ 'a, button, [role="button"], input, select, textarea, [data-el], [data-amplifyup-component], [data-component-id]'
1992
+ );
1993
+ const target = interactive instanceof HTMLElement ? interactive : raw;
1994
+ e.preventDefault();
1995
+ e.stopPropagation();
1996
+ e.stopImmediatePropagation();
1982
1997
  const selector = this.generateSelectorForElement(target);
1983
1998
  const tagName = target.tagName.toLowerCase();
1984
- const text = target.textContent?.trim().substring(0, 50) || "";
1999
+ const text = (target.textContent || "").replace(/\s+/g, " ").trim().substring(0, 80);
1985
2000
  if (window.parent && window.parent !== window) {
1986
2001
  window.parent.postMessage({
1987
2002
  type: "ELEMENT_CLICKED_FOR_EVENT",
@@ -1990,9 +2005,6 @@ Available Console Commands:
1990
2005
  text
1991
2006
  }, "*");
1992
2007
  }
1993
- if (tagName === "a") {
1994
- e.preventDefault();
1995
- }
1996
2008
  };
1997
2009
  document.addEventListener("click", this.eventSelectionClickHandler, true);
1998
2010
  if (this.config?.debug) {