@flowengage/react-chatbot 1.7.4 → 1.7.6

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.
@@ -2343,14 +2343,36 @@ async function Qn(e, { skipPushState: t = !1, isBack: n = !1 } = {}) {
2343
2343
  Array.from(s.body.children).forEach((e) => {
2344
2344
  e.tagName?.toUpperCase() !== "SCRIPT" && document.body.insertBefore(document.importNode(e, !0), c);
2345
2345
  });
2346
- let u = new Set(Array.from(document.querySelectorAll("script[src]")).map((e) => {
2346
+ let u = [
2347
+ "jquery",
2348
+ "jquery-once",
2349
+ "drupal.js",
2350
+ "core/misc",
2351
+ "core/modules",
2352
+ "core/assets",
2353
+ "core/themes",
2354
+ "wp-includes",
2355
+ "wp-admin",
2356
+ "react.",
2357
+ "react-dom",
2358
+ "vue.",
2359
+ "angular.",
2360
+ "flowengage",
2361
+ "elevenlabs",
2362
+ "11labs"
2363
+ ];
2364
+ function d(e) {
2365
+ let t = e.toLowerCase();
2366
+ return u.some((e) => t.includes(e));
2367
+ }
2368
+ let f = new Set(Array.from(document.querySelectorAll("script[src]")).map((e) => {
2347
2369
  try {
2348
2370
  return new URL(e.getAttribute("src") || "", window.location.href).href;
2349
2371
  } catch {
2350
2372
  return "";
2351
2373
  }
2352
2374
  }));
2353
- function d(t, n) {
2375
+ function p(t, n) {
2354
2376
  let r = t.getAttribute("src") || "";
2355
2377
  if (r.includes("flowengage")) return;
2356
2378
  let i = document.createElement("script");
@@ -2361,18 +2383,33 @@ async function Qn(e, { skipPushState: t = !1, isBack: n = !1 } = {}) {
2361
2383
  } catch {
2362
2384
  return;
2363
2385
  }
2364
- if (u.has(n)) return;
2365
- u.add(n), i.src = n, i.async = t.async, i.defer = t.defer;
2386
+ if (f.has(n)) {
2387
+ if (d(n)) return;
2388
+ bn("replayScript: re-running theme script →", n);
2389
+ }
2390
+ f.add(n), i.src = n, i.async = t.async, i.defer = t.defer;
2366
2391
  } else if (t.textContent.trim()) i.textContent = t.textContent;
2367
2392
  else return;
2368
2393
  let a = t.getAttribute("type");
2369
2394
  a && a !== "text/javascript" && a !== "" && (i.type = a), n.parentNode.insertBefore(i, n);
2370
2395
  }
2371
- for (let e of Array.from(s.head.querySelectorAll("script"))) d(e, c);
2372
- for (let e of Array.from(s.body.querySelectorAll("script"))) d(e, c);
2396
+ for (let e of Array.from(s.head.querySelectorAll("script"))) p(e, c);
2397
+ for (let e of Array.from(s.body.querySelectorAll("script"))) p(e, c);
2373
2398
  try {
2399
+ if (typeof window.Drupal?.detachBehaviors == "function") try {
2400
+ window.Drupal.detachBehaviors(document.body, window.drupalSettings);
2401
+ } catch {}
2374
2402
  typeof window.Drupal?.attachBehaviors == "function" && window.Drupal.attachBehaviors(document.body, window.drupalSettings);
2375
2403
  } catch {}
2404
+ try {
2405
+ document.dispatchEvent(new Event("DOMContentLoaded"));
2406
+ } catch {}
2407
+ try {
2408
+ window.dispatchEvent(new Event("load"));
2409
+ } catch {}
2410
+ try {
2411
+ document.body.dispatchEvent(new Event("post-load", { bubbles: !0 }));
2412
+ } catch {}
2376
2413
  if (s.title && (document.title = s.title), !t) try {
2377
2414
  history.pushState({ flowengageSpa: !0 }, "", e);
2378
2415
  } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
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",