@crestapps/ai-chat-ui 2.0.0-preview.260 → 2.0.0-preview.263

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.
@@ -418,6 +418,7 @@
418
418
  console.error("The sendButtonElementSelector is required.");
419
419
  return;
420
420
  }
421
+ window.CoreAIChatSurface.registerRoot(document.querySelector(config.appElementSelector));
421
422
  return Vue.createApp({
422
423
  data() {
423
424
  return {
@@ -1857,8 +1858,11 @@
1857
1858
  }
1858
1859
  function scanForAutoInitialization(root) {
1859
1860
  if (!root || typeof root.querySelectorAll !== "function") return;
1860
- if (typeof root.matches === "function" && root.matches(autoInitializeSelector)) initializeFromElement(root);
1861
- root.querySelectorAll(autoInitializeSelector).forEach(initializeFromElement);
1861
+ const isPageMarkup = (element) => !window.CoreAIChatSurface.isInsideRenderedMessage(element);
1862
+ if (typeof root.matches === "function" && root.matches(autoInitializeSelector) && isPageMarkup(root)) initializeFromElement(root);
1863
+ root.querySelectorAll(autoInitializeSelector).forEach((element) => {
1864
+ if (isPageMarkup(element)) initializeFromElement(element);
1865
+ });
1862
1866
  }
1863
1867
  function startAutoInitialization() {
1864
1868
  scanForAutoInitialization(document);