@flowengage/react-chatbot 1.6.3 → 1.6.4

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.
@@ -2119,34 +2119,64 @@ async function Mn(e) {
2119
2119
  if (e === o) return;
2120
2120
  let t = e.tagName?.toUpperCase();
2121
2121
  t === "AUDIO" || t === "VIDEO" || e.remove();
2122
- }), Array.from(a.body.children).forEach((e) => {
2122
+ });
2123
+ let s = new Set(Array.from(document.querySelectorAll("link[rel='stylesheet']")).map((e) => {
2124
+ try {
2125
+ return new URL(e.getAttribute("href") || "", window.location.href).href;
2126
+ } catch {
2127
+ return "";
2128
+ }
2129
+ }));
2130
+ for (let t of Array.from(a.head.querySelectorAll("link[rel='stylesheet']"))) {
2131
+ let n = t.getAttribute("href");
2132
+ if (!n) continue;
2133
+ let r;
2134
+ try {
2135
+ r = new URL(n, e).href;
2136
+ } catch {
2137
+ continue;
2138
+ }
2139
+ if (s.has(r)) continue;
2140
+ let i = document.createElement("link");
2141
+ i.rel = "stylesheet", i.href = r, t.media && (i.media = t.media), document.head.appendChild(i);
2142
+ }
2143
+ for (let e of Array.from(a.head.querySelectorAll("style"))) {
2144
+ if (!e.textContent.trim()) continue;
2145
+ let t = e.textContent.trim().slice(0, 120);
2146
+ if (Array.from(document.head.querySelectorAll("style")).some((e) => e.textContent.trim().slice(0, 120) === t)) continue;
2147
+ let n = document.createElement("style");
2148
+ n.textContent = e.textContent, document.head.appendChild(n);
2149
+ }
2150
+ Array.from(a.body.children).forEach((e) => {
2123
2151
  e.tagName?.toUpperCase() !== "SCRIPT" && document.body.insertBefore(document.importNode(e, !0), o);
2124
2152
  });
2125
- let s = new Set(Array.from(document.querySelectorAll("script[src]")).map((e) => {
2153
+ let c = new Set(Array.from(document.querySelectorAll("script[src]")).map((e) => {
2126
2154
  try {
2127
2155
  return new URL(e.getAttribute("src") || "", window.location.href).href;
2128
2156
  } catch {
2129
2157
  return "";
2130
2158
  }
2131
2159
  }));
2132
- for (let t of Array.from(a.body.querySelectorAll("script"))) {
2133
- let n = t.getAttribute("src") || "";
2134
- if (n.includes("flowengage")) continue;
2135
- let r = document.createElement("script");
2136
- if (n) {
2137
- let i;
2160
+ function l(t, n) {
2161
+ let r = t.getAttribute("src") || "";
2162
+ if (r.includes("flowengage")) return;
2163
+ let i = document.createElement("script");
2164
+ if (r) {
2165
+ let n;
2138
2166
  try {
2139
- i = new URL(n, e).href;
2167
+ n = new URL(r, e).href;
2140
2168
  } catch {
2141
- continue;
2169
+ return;
2142
2170
  }
2143
- if (s.has(i)) continue;
2144
- r.src = i, r.async = t.async, r.defer = t.defer;
2145
- } else if (t.textContent.trim()) r.textContent = t.textContent;
2146
- else continue;
2147
- let i = t.getAttribute("type");
2148
- i && i !== "text/javascript" && i !== "" && (r.type = i), document.body.insertBefore(r, o);
2149
- }
2171
+ if (c.has(n)) return;
2172
+ c.add(n), i.src = n, i.async = t.async, i.defer = t.defer;
2173
+ } else if (t.textContent.trim()) i.textContent = t.textContent;
2174
+ else return;
2175
+ let a = t.getAttribute("type");
2176
+ a && a !== "text/javascript" && a !== "" && (i.type = a), n.parentNode.insertBefore(i, n);
2177
+ }
2178
+ for (let e of Array.from(a.head.querySelectorAll("script"))) l(e, o);
2179
+ for (let e of Array.from(a.body.querySelectorAll("script"))) l(e, o);
2150
2180
  try {
2151
2181
  typeof window.Drupal?.attachBehaviors == "function" && window.Drupal.attachBehaviors(document.body, window.drupalSettings);
2152
2182
  } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "description": "Embeddable AI chat widget for React — powered by FlowEngage. Drop it in with a single siteId.",
5
5
  "keywords": [
6
6
  "chatbot",