@flowengage/react-chatbot 1.6.2 → 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,9 +2119,68 @@ 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
- }), a.title && (document.title = a.title);
2152
+ });
2153
+ let c = new Set(Array.from(document.querySelectorAll("script[src]")).map((e) => {
2154
+ try {
2155
+ return new URL(e.getAttribute("src") || "", window.location.href).href;
2156
+ } catch {
2157
+ return "";
2158
+ }
2159
+ }));
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;
2166
+ try {
2167
+ n = new URL(r, e).href;
2168
+ } catch {
2169
+ return;
2170
+ }
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);
2180
+ try {
2181
+ typeof window.Drupal?.attachBehaviors == "function" && window.Drupal.attachBehaviors(document.body, window.drupalSettings);
2182
+ } catch {}
2183
+ a.title && (document.title = a.title);
2125
2184
  try {
2126
2185
  history.pushState({ flowengageSpa: !0 }, "", e);
2127
2186
  } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "1.6.2",
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",