@flowengage/react-chatbot 1.1.1 → 1.1.3
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.
|
@@ -1838,7 +1838,7 @@ function tn() {
|
|
|
1838
1838
|
var nn = () => {
|
|
1839
1839
|
if (typeof document > "u" || document.getElementById("fe-highlight-styles")) return;
|
|
1840
1840
|
let e = document.createElement("style");
|
|
1841
|
-
e.id = "fe-highlight-styles", e.textContent = "\n .fe-highlight-section {\n outline: 3px solid #7c3aed !important;\n box-shadow: 0 0 15px rgba(124, 58, 237, 0.6) !important;\n transition:
|
|
1841
|
+
e.id = "fe-highlight-styles", e.textContent = "\n .fe-highlight-section {\n outline: 3px solid #7c3aed !important;\n box-shadow: 0 0 15px rgba(124, 58, 237, 0.6) !important;\n transition: outline-color 0.3s ease, box-shadow 0.3s ease !important;\n border-radius: 8px !important;\n position: relative;\n }\n /* Smooth fade-in for the speaking highlight */\n .fe-highlight-section.fe-highlight-speaking {\n outline-color: #6366f1 !important;\n box-shadow: 0 0 20px rgba(99, 102, 241, 0.45), 0 0 4px rgba(99, 102, 241, 0.3) !important;\n animation: fe-hl-pulse 2s ease-in-out infinite !important;\n }\n @keyframes fe-hl-pulse {\n 0%, 100% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.40), 0 0 4px rgba(99, 102, 241, 0.25); }\n 50% { box-shadow: 0 0 25px rgba(99, 102, 241, 0.55), 0 0 8px rgba(99, 102, 241, 0.35); }\n }\n /* Exit transition — the old highlight fades out */\n .fe-highlight-exiting {\n outline: 3px solid transparent !important;\n box-shadow: none !important;\n transition: outline-color 0.25s ease, box-shadow 0.25s ease !important;\n }\n ", document.head.appendChild(e);
|
|
1842
1842
|
};
|
|
1843
1843
|
function rn(e, t) {
|
|
1844
1844
|
if (typeof document > "u") return null;
|
|
@@ -1873,14 +1873,25 @@ function rn(e, t) {
|
|
|
1873
1873
|
}
|
|
1874
1874
|
return null;
|
|
1875
1875
|
}
|
|
1876
|
-
function an(e) {
|
|
1877
|
-
!e || typeof document > "u"
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1876
|
+
function an(e, { speaking: t = !1 } = {}) {
|
|
1877
|
+
if (!e || typeof document > "u") return;
|
|
1878
|
+
nn();
|
|
1879
|
+
let n = document.querySelectorAll(".fe-highlight-section");
|
|
1880
|
+
for (let t of n) t !== e && (t.classList.remove("fe-highlight-section", "fe-highlight-speaking"), t.classList.add("fe-highlight-exiting"), setTimeout(() => t.classList.remove("fe-highlight-exiting"), 300));
|
|
1881
|
+
e.classList.remove("fe-highlight-exiting"), e.classList.add("fe-highlight-section"), t ? e.classList.add("fe-highlight-speaking") : e.classList.remove("fe-highlight-speaking");
|
|
1882
|
+
try {
|
|
1883
|
+
e.scrollIntoView({
|
|
1884
|
+
behavior: "smooth",
|
|
1885
|
+
block: "center"
|
|
1886
|
+
});
|
|
1887
|
+
} catch {
|
|
1888
|
+
try {
|
|
1889
|
+
e.scrollIntoView(!0);
|
|
1890
|
+
} catch {}
|
|
1891
|
+
}
|
|
1881
1892
|
}
|
|
1882
1893
|
function on() {
|
|
1883
|
-
typeof document > "u" || document.querySelectorAll(".fe-highlight-section").forEach((e) => e.classList.remove("fe-highlight-section"));
|
|
1894
|
+
typeof document > "u" || document.querySelectorAll(".fe-highlight-section, .fe-highlight-exiting").forEach((e) => e.classList.remove("fe-highlight-section", "fe-highlight-speaking", "fe-highlight-exiting"));
|
|
1884
1895
|
}
|
|
1885
1896
|
function sn(e) {
|
|
1886
1897
|
if (typeof window > "u") return e;
|
|
@@ -22273,7 +22284,24 @@ function Sg() {
|
|
|
22273
22284
|
}));
|
|
22274
22285
|
}), e;
|
|
22275
22286
|
}
|
|
22276
|
-
function Cg() {
|
|
22287
|
+
function Cg(e) {
|
|
22288
|
+
if (!e || typeof e.closest != "function") return !1;
|
|
22289
|
+
try {
|
|
22290
|
+
return !!e.closest("footer, [role=\"contentinfo\"], #footer, .site-footer, [class*=\"footer\"], [id*=\"footer\"]");
|
|
22291
|
+
} catch {
|
|
22292
|
+
return !1;
|
|
22293
|
+
}
|
|
22294
|
+
}
|
|
22295
|
+
function wg() {
|
|
22296
|
+
let e = Sg();
|
|
22297
|
+
for (let t of e) {
|
|
22298
|
+
if ((t.type || "").toLowerCase() !== "email" || Cg(t)) continue;
|
|
22299
|
+
let e = gg(t);
|
|
22300
|
+
if (e) return e;
|
|
22301
|
+
}
|
|
22302
|
+
return null;
|
|
22303
|
+
}
|
|
22304
|
+
function Tg() {
|
|
22277
22305
|
let e = Sg(), t = /* @__PURE__ */ new Map(), n = 0;
|
|
22278
22306
|
return e.map((e, r) => {
|
|
22279
22307
|
let i = gg(e), a = i || "__orphan__";
|
|
@@ -22292,7 +22320,7 @@ function Cg() {
|
|
|
22292
22320
|
};
|
|
22293
22321
|
});
|
|
22294
22322
|
}
|
|
22295
|
-
function
|
|
22323
|
+
function Eg() {
|
|
22296
22324
|
let e = [];
|
|
22297
22325
|
return yg((t) => {
|
|
22298
22326
|
e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
|
|
@@ -22310,18 +22338,18 @@ function wg() {
|
|
|
22310
22338
|
type: e.type || e.tagName
|
|
22311
22339
|
}));
|
|
22312
22340
|
}
|
|
22313
|
-
function
|
|
22341
|
+
function Dg(e) {
|
|
22314
22342
|
return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
|
|
22315
22343
|
}
|
|
22316
|
-
function
|
|
22317
|
-
let t =
|
|
22344
|
+
function Og(e) {
|
|
22345
|
+
let t = Dg(e);
|
|
22318
22346
|
return t = t.replace(/\s+field\s*$/i, "").trim(), t;
|
|
22319
22347
|
}
|
|
22320
|
-
function
|
|
22321
|
-
let n =
|
|
22348
|
+
function kg(e, t) {
|
|
22349
|
+
let n = Og(t);
|
|
22322
22350
|
if (!n) return 0;
|
|
22323
22351
|
let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
|
|
22324
|
-
if (r === "url" && /url|website|domain|site|
|
|
22352
|
+
if (r === "url" && /url|website|domain|audit|conduct|site(\s|$)|page(\s|$)/.test(n) && !/email|e-mail|mail|name|message|phone/.test(n) || (i === "url-input" || i.endsWith("-url-input")) && /url|website|domain|audit|conduct/.test(n) && !/email|e-mail|mail|name|message|phone/.test(n)) return 100;
|
|
22325
22353
|
let a = (e.type || "").toLowerCase();
|
|
22326
22354
|
if (a === "email" && /email|e-mail|mail/.test(n)) return 100;
|
|
22327
22355
|
if (a === "tel" && /phone|mobile|tel|cell/.test(n)) return 95;
|
|
@@ -22335,7 +22363,7 @@ function Dg(e, t) {
|
|
|
22335
22363
|
e.getAttribute("title"),
|
|
22336
22364
|
e.getAttribute("data-testid"),
|
|
22337
22365
|
e.getAttribute("autocomplete")
|
|
22338
|
-
].filter(Boolean).map((e) =>
|
|
22366
|
+
].filter(Boolean).map((e) => Dg(e)), s = 0;
|
|
22339
22367
|
for (let e of o) {
|
|
22340
22368
|
if (!e) continue;
|
|
22341
22369
|
if (e === n) {
|
|
@@ -22355,18 +22383,18 @@ function Dg(e, t) {
|
|
|
22355
22383
|
}
|
|
22356
22384
|
return s;
|
|
22357
22385
|
}
|
|
22358
|
-
var
|
|
22359
|
-
function
|
|
22386
|
+
var Ag = 22;
|
|
22387
|
+
function jg(e, t) {
|
|
22360
22388
|
let n = null, r = 0;
|
|
22361
22389
|
for (let i of e) {
|
|
22362
|
-
let e =
|
|
22390
|
+
let e = kg(i, t);
|
|
22363
22391
|
e > r && (r = e, n = i);
|
|
22364
22392
|
}
|
|
22365
|
-
return !n || r <
|
|
22393
|
+
return !n || r < Ag ? null : n;
|
|
22366
22394
|
}
|
|
22367
|
-
function
|
|
22395
|
+
function Mg(e, t, n) {
|
|
22368
22396
|
let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
|
|
22369
|
-
if (!(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
|
|
22397
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i) || !(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
|
|
22370
22398
|
let a = null, o = 0;
|
|
22371
22399
|
for (let t of e) {
|
|
22372
22400
|
if (t.tagName !== "INPUT" && t.tagName !== "TEXTAREA") continue;
|
|
@@ -22392,15 +22420,15 @@ function Ag(e, t, n) {
|
|
|
22392
22420
|
}
|
|
22393
22421
|
return !a || o < 42 ? null : a;
|
|
22394
22422
|
}
|
|
22395
|
-
function
|
|
22423
|
+
function Ng(e) {
|
|
22396
22424
|
let t = String(e ?? "").trim();
|
|
22397
|
-
return t ? /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t)
|
|
22425
|
+
return !t || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t) ? !1 : /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t);
|
|
22398
22426
|
}
|
|
22399
|
-
function
|
|
22427
|
+
function Pg(e) {
|
|
22400
22428
|
let t = String(e ?? "").toLowerCase().trim();
|
|
22401
22429
|
return t ? !!(t === "url" || t === "website" || t === "website url" || t === "website_url" || t === "enter website url" || t.includes("website") || t.includes("domain") || /(enter\s+website|site\s*url|page\s*url)/.test(t)) : !1;
|
|
22402
22430
|
}
|
|
22403
|
-
function
|
|
22431
|
+
function Fg(e) {
|
|
22404
22432
|
if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
|
|
22405
22433
|
let t = (e.type || "").toLowerCase();
|
|
22406
22434
|
return ![
|
|
@@ -22412,8 +22440,8 @@ function Ng(e) {
|
|
|
22412
22440
|
"file"
|
|
22413
22441
|
].includes(t);
|
|
22414
22442
|
}
|
|
22415
|
-
function
|
|
22416
|
-
if (!
|
|
22443
|
+
function Ig(e) {
|
|
22444
|
+
if (!Fg(e)) return !1;
|
|
22417
22445
|
let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
|
|
22418
22446
|
e.name,
|
|
22419
22447
|
e.id,
|
|
@@ -22423,11 +22451,11 @@ function Pg(e) {
|
|
|
22423
22451
|
].filter(Boolean).join(" ").toLowerCase();
|
|
22424
22452
|
return t === "url" || n === "url-input" || n.endsWith("-url-input") || /(website\s*url|enter\s+website|site\s*url)/.test(r) || /(website|domain)/.test(r) && /(url|site)/.test(r);
|
|
22425
22453
|
}
|
|
22426
|
-
function
|
|
22427
|
-
let r = String(t ?? ""), i = String(n ?? ""), a =
|
|
22454
|
+
function Lg(e, t, n) {
|
|
22455
|
+
let r = String(t ?? ""), i = String(n ?? ""), a = Bg(e, r) || jg(e, r) || Mg(e, r, i);
|
|
22428
22456
|
if (!a) return [];
|
|
22429
22457
|
let o = new Set([a]);
|
|
22430
|
-
if (
|
|
22458
|
+
if (Ng(i) && Pg(r)) for (let t of e) t !== a && Ig(t) && o.add(t);
|
|
22431
22459
|
let s = Array.from(o);
|
|
22432
22460
|
return s.sort((e, t) => {
|
|
22433
22461
|
if (e === t) return 0;
|
|
@@ -22435,7 +22463,7 @@ function Fg(e, t, n) {
|
|
|
22435
22463
|
return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
22436
22464
|
}), s;
|
|
22437
22465
|
}
|
|
22438
|
-
function
|
|
22466
|
+
function Rg(e, t) {
|
|
22439
22467
|
try {
|
|
22440
22468
|
if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
|
|
22441
22469
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
|
|
@@ -22450,7 +22478,7 @@ function Ig(e, t) {
|
|
|
22450
22478
|
return Infinity;
|
|
22451
22479
|
}
|
|
22452
22480
|
}
|
|
22453
|
-
function
|
|
22481
|
+
function zg(e) {
|
|
22454
22482
|
if (!e || typeof e != "string") return null;
|
|
22455
22483
|
let t = null;
|
|
22456
22484
|
return yg((n) => {
|
|
@@ -22460,7 +22488,7 @@ function Lg(e) {
|
|
|
22460
22488
|
} catch {}
|
|
22461
22489
|
}), t;
|
|
22462
22490
|
}
|
|
22463
|
-
function
|
|
22491
|
+
function Bg(e, t) {
|
|
22464
22492
|
let n = String(t ?? "").trim();
|
|
22465
22493
|
if (!n) return null;
|
|
22466
22494
|
let r = n.match(/^name:\s*([\w.-]+)$/i);
|
|
@@ -22470,12 +22498,12 @@ function Rg(e, t) {
|
|
|
22470
22498
|
}
|
|
22471
22499
|
let i = n.match(/^id:\s*([\w.-]+)$/i);
|
|
22472
22500
|
if (i) {
|
|
22473
|
-
let e =
|
|
22501
|
+
let e = zg(i[1]);
|
|
22474
22502
|
if (e) return e;
|
|
22475
22503
|
}
|
|
22476
22504
|
let a = n.startsWith("#") ? n.slice(1) : n;
|
|
22477
22505
|
if (/^[\w-]+$/.test(a)) {
|
|
22478
|
-
let e =
|
|
22506
|
+
let e = zg(a);
|
|
22479
22507
|
if (e) return e;
|
|
22480
22508
|
}
|
|
22481
22509
|
let o = n.toLowerCase().replace(/\s+/g, " ");
|
|
@@ -22485,7 +22513,7 @@ function Rg(e, t) {
|
|
|
22485
22513
|
}
|
|
22486
22514
|
return null;
|
|
22487
22515
|
}
|
|
22488
|
-
function
|
|
22516
|
+
function Vg(e, t) {
|
|
22489
22517
|
let n = String(t || "").toLowerCase().trim();
|
|
22490
22518
|
if (!n) return 0;
|
|
22491
22519
|
let r = [
|
|
@@ -22502,7 +22530,7 @@ function zg(e, t) {
|
|
|
22502
22530
|
for (let e of i) r.includes(e) && (a += 1);
|
|
22503
22531
|
return a / i.length * 92;
|
|
22504
22532
|
}
|
|
22505
|
-
function
|
|
22533
|
+
function Hg(e, t) {
|
|
22506
22534
|
let n = [];
|
|
22507
22535
|
yg((e) => {
|
|
22508
22536
|
n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
|
|
@@ -22516,7 +22544,7 @@ function Bg(e, t) {
|
|
|
22516
22544
|
});
|
|
22517
22545
|
let r = 0, i = n.map((t) => ({
|
|
22518
22546
|
el: t,
|
|
22519
|
-
s:
|
|
22547
|
+
s: Vg(t, e)
|
|
22520
22548
|
}));
|
|
22521
22549
|
for (let { s: e } of i) e > r && (r = e);
|
|
22522
22550
|
if (r < 36) return null;
|
|
@@ -22526,14 +22554,14 @@ function Bg(e, t) {
|
|
|
22526
22554
|
if (o.length) {
|
|
22527
22555
|
let e = a[0], t = Infinity;
|
|
22528
22556
|
for (let n of a) for (let r of o) {
|
|
22529
|
-
let i =
|
|
22557
|
+
let i = Rg(n, r);
|
|
22530
22558
|
i < t && (t = i, e = n);
|
|
22531
22559
|
}
|
|
22532
22560
|
return e;
|
|
22533
22561
|
}
|
|
22534
22562
|
return a[0];
|
|
22535
22563
|
}
|
|
22536
|
-
function
|
|
22564
|
+
function Ug(e) {
|
|
22537
22565
|
if (e == null) return {};
|
|
22538
22566
|
if (typeof e == "string") {
|
|
22539
22567
|
let t = e.trim();
|
|
@@ -22546,8 +22574,8 @@ function Vg(e) {
|
|
|
22546
22574
|
}
|
|
22547
22575
|
return e;
|
|
22548
22576
|
}
|
|
22549
|
-
function
|
|
22550
|
-
let t =
|
|
22577
|
+
function Wg(e) {
|
|
22578
|
+
let t = Ug(e);
|
|
22551
22579
|
if (Array.isArray(t) && t.length > 0) {
|
|
22552
22580
|
let e = t[0];
|
|
22553
22581
|
if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
|
|
@@ -22575,12 +22603,12 @@ function Hg(e) {
|
|
|
22575
22603
|
value: e?.value ?? e?.Value
|
|
22576
22604
|
})) : [];
|
|
22577
22605
|
}
|
|
22578
|
-
function
|
|
22606
|
+
function Gg(e) {
|
|
22579
22607
|
if (!e || typeof e != "string") return e;
|
|
22580
22608
|
let t = e.trim();
|
|
22581
22609
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t) ? t : (t = t.replace(/\s+at\s+the\s+rate\s*(of)?\s+/gi, "@"), t = t.replace(/\s+at\s+/gi, "@"), t = t.replace(/\s+dot\s+/gi, "."), t = t.replace(/\s+/g, ""), t = t.replace(/\.{2,}/g, ".").replace(/\.$/, ""), t);
|
|
22582
22610
|
}
|
|
22583
|
-
function
|
|
22611
|
+
function Kg(e) {
|
|
22584
22612
|
if (!e || typeof e != "string") return e;
|
|
22585
22613
|
let t = {
|
|
22586
22614
|
zero: "0",
|
|
@@ -22599,7 +22627,7 @@ function Wg(e) {
|
|
|
22599
22627
|
for (let [e, r] of Object.entries(t)) n = n.replace(RegExp(`\\b${e}\\b`, "g"), r);
|
|
22600
22628
|
return n = n.replace(/[^\d+]/g, ""), n;
|
|
22601
22629
|
}
|
|
22602
|
-
function
|
|
22630
|
+
function qg(e) {
|
|
22603
22631
|
if (!e || typeof e != "string") return [];
|
|
22604
22632
|
let t = e.trim();
|
|
22605
22633
|
if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
|
|
@@ -22618,7 +22646,7 @@ function Gg(e) {
|
|
|
22618
22646
|
}
|
|
22619
22647
|
return [];
|
|
22620
22648
|
}
|
|
22621
|
-
function
|
|
22649
|
+
function Jg(e) {
|
|
22622
22650
|
if (!e || typeof e != "string") return [];
|
|
22623
22651
|
let t = e.trim();
|
|
22624
22652
|
if (!t) return [];
|
|
@@ -22630,7 +22658,7 @@ function Kg(e) {
|
|
|
22630
22658
|
field_key: e,
|
|
22631
22659
|
value: i
|
|
22632
22660
|
}));
|
|
22633
|
-
}, o =
|
|
22661
|
+
}, o = Gg(t), s = i.test(o), c = o.match(/^\s*([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,})\s*$/i);
|
|
22634
22662
|
if (c) return a("Email Address", c[1]), n;
|
|
22635
22663
|
if (!i.test(t) && s) {
|
|
22636
22664
|
let e = o.match(i);
|
|
@@ -22658,17 +22686,17 @@ function Kg(e) {
|
|
|
22658
22686
|
}
|
|
22659
22687
|
return n;
|
|
22660
22688
|
}
|
|
22661
|
-
function
|
|
22689
|
+
function Yg(e) {
|
|
22662
22690
|
if (!e || typeof e != "object") return null;
|
|
22663
22691
|
let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
|
|
22664
22692
|
return t == null ? null : String(t).trim() || null;
|
|
22665
22693
|
}
|
|
22666
|
-
function
|
|
22694
|
+
function Xg(e) {
|
|
22667
22695
|
if (!e || typeof e != "object") return null;
|
|
22668
22696
|
let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords ?? e.search_query ?? e.searchQuery ?? e.question ?? e.prompt ?? e.topic ?? e.intent;
|
|
22669
22697
|
return t == null ? null : String(t).trim() || null;
|
|
22670
22698
|
}
|
|
22671
|
-
function
|
|
22699
|
+
function Zg(e) {
|
|
22672
22700
|
let t = e.ownerDocument?.defaultView || window, n = e.tagName === "TEXTAREA" ? t.HTMLTextAreaElement.prototype : t.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value");
|
|
22673
22701
|
return (e, t) => {
|
|
22674
22702
|
try {
|
|
@@ -22677,7 +22705,7 @@ function Yg(e) {
|
|
|
22677
22705
|
r?.set ? r.set.call(e, t) : e.value = t;
|
|
22678
22706
|
};
|
|
22679
22707
|
}
|
|
22680
|
-
async function
|
|
22708
|
+
async function Qg(e, t, n) {
|
|
22681
22709
|
if (!n?.skipScroll) try {
|
|
22682
22710
|
e.scrollIntoView({
|
|
22683
22711
|
behavior: "smooth",
|
|
@@ -22717,7 +22745,7 @@ async function Xg(e, t, n) {
|
|
|
22717
22745
|
].includes(String(t).toLowerCase().trim()), e.dispatchEvent(new Event("input", a)), e.dispatchEvent(new Event("change", a)), cg(e), !0;
|
|
22718
22746
|
let o = String(t);
|
|
22719
22747
|
if (r === "INPUT" || r === "TEXTAREA") {
|
|
22720
|
-
let t =
|
|
22748
|
+
let t = Zg(e);
|
|
22721
22749
|
try {
|
|
22722
22750
|
await eg(e, o, t);
|
|
22723
22751
|
} catch {
|
|
@@ -22747,11 +22775,11 @@ async function Xg(e, t, n) {
|
|
|
22747
22775
|
} catch {}
|
|
22748
22776
|
return cg(e), !0;
|
|
22749
22777
|
}
|
|
22750
|
-
function
|
|
22778
|
+
function $g(e) {
|
|
22751
22779
|
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = null, o = {
|
|
22752
22780
|
navigate_to_page: async (n) => {
|
|
22753
22781
|
$("navigate_to_page ▶ raw parameters:", n);
|
|
22754
|
-
let r =
|
|
22782
|
+
let r = Ug(n), i = Yg(r), a = r.section_text ?? r.sectionText ?? r.section;
|
|
22755
22783
|
if ($("navigate_to_page · coerced:", {
|
|
22756
22784
|
url: i,
|
|
22757
22785
|
sectionText: a
|
|
@@ -22778,7 +22806,7 @@ function Zg(e) {
|
|
|
22778
22806
|
}
|
|
22779
22807
|
let e = "";
|
|
22780
22808
|
try {
|
|
22781
|
-
let t =
|
|
22809
|
+
let t = Tg(), n = Eg();
|
|
22782
22810
|
if (t.length > 0) {
|
|
22783
22811
|
let r = t.map((e) => e.label || e.placeholder || e.name || e.id).filter(Boolean).join(", "), i = n.map((e) => e.text).filter(Boolean).join(", ");
|
|
22784
22812
|
e = ` This page has a form with fields: [${r}]` + (i ? ` and buttons: [${i}].` : ".") + " Call list_page_forms then start filling.";
|
|
@@ -22794,12 +22822,12 @@ function Zg(e) {
|
|
|
22794
22822
|
},
|
|
22795
22823
|
highlight_on_page: async (e) => {
|
|
22796
22824
|
$("highlight_on_page ▶", e);
|
|
22797
|
-
let t =
|
|
22798
|
-
return i ? (an(i), $("highlight_on_page ✓"), "
|
|
22825
|
+
let t = Ug(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = rn(n || null, r || null);
|
|
22826
|
+
return i ? (an(i, { speaking: !0 }), $("highlight_on_page ✓ (speaking)"), "OK_HIGHLIGHT section is now highlighted and scrolled into view.") : ($("highlight_on_page ✖ no element"), "Could not find that section on the page.");
|
|
22799
22827
|
},
|
|
22800
22828
|
search_site_content: async (e) => {
|
|
22801
22829
|
$("search_site_content ▶", e);
|
|
22802
|
-
let r =
|
|
22830
|
+
let r = Xg(Ug(e));
|
|
22803
22831
|
if ($("search_site_content · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), rg("Searching site content…", { spinner: !0 }), !r) return ig(), $("search_site_content ✖ missing query"), "Missing query parameter.";
|
|
22804
22832
|
if (!t) return ig(), $("search_site_content ✖ no siteId"), "Site is not configured for search.";
|
|
22805
22833
|
if (!n) return ig(), $("search_site_content ✖ no api base"), "API base URL is missing; cannot search.";
|
|
@@ -22833,20 +22861,20 @@ function Zg(e) {
|
|
|
22833
22861
|
duration: 2e3
|
|
22834
22862
|
}), dg(!0), lg(), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
|
|
22835
22863
|
list_page_forms: async () => {
|
|
22836
|
-
let e =
|
|
22837
|
-
return $("list_page_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), a =
|
|
22864
|
+
let e = Tg(), t = Eg();
|
|
22865
|
+
return $("list_page_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), a = wg(), $("list_page_forms · activeFormAncestor", a ? "contact-preferring" : "none"), JSON.stringify({
|
|
22838
22866
|
fields: e,
|
|
22839
22867
|
buttons: t,
|
|
22840
|
-
hint: "Fields are grouped by formIndex/formName. Work with ONE form at a time — only fill fields from the same formIndex. Do not jump to fields in a different form. field_key: use placeholder, label, name, or id from this list. click_page_button picks the button nearest the filled fields."
|
|
22868
|
+
hint: "Fields are grouped by formIndex/formName. Work with ONE form at a time — only fill fields from the same formIndex. Do not jump to fields in a different form. On pages with a contact form AND a footer 'Conduct Audit' / website URL field: only use the contact form unless the visitor explicitly asks to run an audit. Contact forms: fill in order Full Name → Email Address → Message. Message must be a short note the visitor wants to send (one or two sentences), never a recap of the whole chat or assistant replies. field_key: use placeholder, label, name, or id from this list. click_page_button picks the button nearest the filled fields (e.g. Send Message on the same form)."
|
|
22841
22869
|
});
|
|
22842
22870
|
},
|
|
22843
22871
|
fill_form_fields: async (e) => {
|
|
22844
22872
|
try {
|
|
22845
22873
|
$("fill_form_fields ▶ raw:", e);
|
|
22846
|
-
let t =
|
|
22874
|
+
let t = Wg(e);
|
|
22847
22875
|
if (!t.length && r) {
|
|
22848
|
-
let e = r(), n =
|
|
22849
|
-
n.length ? $("fill_form_fields · inferred URL from last user utterance (model omitted usable fields):", n) : (n =
|
|
22876
|
+
let e = r(), n = qg(e);
|
|
22877
|
+
n.length ? $("fill_form_fields · inferred URL from last user utterance (model omitted usable fields):", n) : (n = Jg(e), n.length && $("fill_form_fields · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
|
|
22850
22878
|
}
|
|
22851
22879
|
if ($("fill_form_fields · normalized fields:", t), !t.length) return "No fields provided. Call list_page_forms for field_key strings, then fill_form_fields with { \"fields\": [ { \"field_key\": \"<label or placeholder from list>\", \"value\": \"<user value>\" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.";
|
|
22852
22880
|
t.length > 1 && rg(`Filling ${t.length} fields…`);
|
|
@@ -22855,7 +22883,16 @@ function Zg(e) {
|
|
|
22855
22883
|
let t = e?.field_key ?? e?.fieldKey, r = e?.value;
|
|
22856
22884
|
if (t == null || r == null) continue;
|
|
22857
22885
|
let o = String(t).toLowerCase();
|
|
22858
|
-
/email|e-mail|mail/.test(o)
|
|
22886
|
+
if (/email|e-mail|mail/.test(o)) r = Gg(r);
|
|
22887
|
+
else if (/phone|mobile|tel|cell/.test(o)) r = Kg(r);
|
|
22888
|
+
else if (Pg(t) || o === "url") {
|
|
22889
|
+
let e = String(r ?? "").trim();
|
|
22890
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) || /\bat\b/i.test(e) && /\bdot\b/i.test(e)) {
|
|
22891
|
+
let n = Gg(e);
|
|
22892
|
+
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.trim()) && ($("fill_form_fields · remapping url/website intent to Email Address (value is an email)"), t = "Email Address", o = "email address", r = n.trim());
|
|
22893
|
+
}
|
|
22894
|
+
}
|
|
22895
|
+
rg(`Filling ${t}…`), $("fill_form_fields · processing field:", t, "=", r);
|
|
22859
22896
|
let s = Sg(), c = s;
|
|
22860
22897
|
if (a) {
|
|
22861
22898
|
let e = s.filter((e) => gg(e) === a);
|
|
@@ -22864,15 +22901,15 @@ function Zg(e) {
|
|
|
22864
22901
|
$("fill_form_fields · visible inputs count:", s.length, "scoped:", c.length);
|
|
22865
22902
|
let l = !1;
|
|
22866
22903
|
for (let e of [c, ...c === s ? [] : [s]]) {
|
|
22867
|
-
let o =
|
|
22904
|
+
let o = Lg(e, String(t), r);
|
|
22868
22905
|
if (o.length) {
|
|
22869
|
-
for (let e = 0; e < o.length; e++) await
|
|
22906
|
+
for (let e = 0; e < o.length; e++) await Qg(o[e], r, { skipScroll: e > 0 }), await new Promise((e) => setTimeout(e, 80));
|
|
22870
22907
|
i = o, a = gg(o[0]) || a, n.push(String(t)), l = !0;
|
|
22871
22908
|
break;
|
|
22872
22909
|
}
|
|
22873
|
-
let s =
|
|
22874
|
-
if (s ||=
|
|
22875
|
-
await
|
|
22910
|
+
let s = Bg(e, String(t));
|
|
22911
|
+
if (s ||= jg(e, String(t)), s ||= Mg(e, String(t), r), s) {
|
|
22912
|
+
await Qg(s, r), i = [s], a = gg(s) || a, n.push(String(t)), l = !0;
|
|
22876
22913
|
break;
|
|
22877
22914
|
}
|
|
22878
22915
|
}
|
|
@@ -22892,10 +22929,10 @@ function Zg(e) {
|
|
|
22892
22929
|
}
|
|
22893
22930
|
},
|
|
22894
22931
|
click_page_button: async (e) => {
|
|
22895
|
-
let t =
|
|
22932
|
+
let t = Ug(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
|
|
22896
22933
|
if ($("click_page_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
|
|
22897
22934
|
rg(`Clicking "${n}"…`);
|
|
22898
|
-
let r =
|
|
22935
|
+
let r = Hg(n, i);
|
|
22899
22936
|
if (!r) return ig(200), $("click_page_button ✖ no match"), `Could not find a button matching "${n}". Call list_page_forms to see button texts.`;
|
|
22900
22937
|
try {
|
|
22901
22938
|
try {
|
|
@@ -22961,7 +22998,7 @@ function Zg(e) {
|
|
|
22961
22998
|
}
|
|
22962
22999
|
//#endregion
|
|
22963
23000
|
//#region src/utils/wrapVoiceToolsForLogging.js
|
|
22964
|
-
function
|
|
23001
|
+
function e_(e) {
|
|
22965
23002
|
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
|
|
22966
23003
|
let r = Zt();
|
|
22967
23004
|
r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
|
|
@@ -22978,22 +23015,22 @@ function Qg(e) {
|
|
|
22978
23015
|
}
|
|
22979
23016
|
//#endregion
|
|
22980
23017
|
//#region src/components/VoiceInterface.jsx
|
|
22981
|
-
var
|
|
23018
|
+
var t_ = {
|
|
22982
23019
|
idle: "rgba(99,102,241,0.18)",
|
|
22983
23020
|
listening: "rgba(16,185,129,0.25)",
|
|
22984
23021
|
speaking: "rgba(245,158,11,0.25)",
|
|
22985
23022
|
error: "rgba(239,68,68,0.2)"
|
|
22986
|
-
},
|
|
23023
|
+
}, n_ = {
|
|
22987
23024
|
idle: "#6366f1",
|
|
22988
23025
|
listening: "#10b981",
|
|
22989
23026
|
speaking: "#f59e0b",
|
|
22990
23027
|
error: "#ef4444"
|
|
22991
23028
|
};
|
|
22992
|
-
function
|
|
23029
|
+
function r_(e, t) {
|
|
22993
23030
|
let n = (t || "").trim();
|
|
22994
23031
|
return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
|
|
22995
23032
|
}
|
|
22996
|
-
function
|
|
23033
|
+
function i_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
|
|
22997
23034
|
let [h, g] = s("idle"), [ee, te] = s(null), [_, ne] = s(!1), re = o(null), ie = o(null), ae = o(""), oe = o(async () => {}), se = o(!1), v = n(async () => {
|
|
22998
23035
|
try {
|
|
22999
23036
|
await re.current?.endSession?.();
|
|
@@ -23010,7 +23047,7 @@ function n_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
23010
23047
|
try {
|
|
23011
23048
|
if (await navigator.mediaDevices.getUserMedia({ audio: !0 }), t) return;
|
|
23012
23049
|
d.current = [], ae.current = "", se.current = !1;
|
|
23013
|
-
let i =
|
|
23050
|
+
let i = e_($g({
|
|
23014
23051
|
siteId: r || null,
|
|
23015
23052
|
apiBaseUrl: a || null,
|
|
23016
23053
|
getLastUserVoiceText: () => ae.current,
|
|
@@ -23037,7 +23074,7 @@ function n_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
23037
23074
|
message: r,
|
|
23038
23075
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
23039
23076
|
};
|
|
23040
|
-
n === "user" && (ae.current = r), d.current = [...d.current, i],
|
|
23077
|
+
n === "user" && (ae.current = r), d.current = [...d.current, i], r_(n, r) && queueMicrotask(() => {
|
|
23041
23078
|
se.current || (se.current = !0, oe.current?.());
|
|
23042
23079
|
});
|
|
23043
23080
|
},
|
|
@@ -23060,7 +23097,7 @@ function n_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
23060
23097
|
} catch {
|
|
23061
23098
|
t = "[]";
|
|
23062
23099
|
}
|
|
23063
|
-
o.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${r || "unknown"}. Page fields/buttons JSON: ${t}. Navigation: when the user wants to go to any page (contact, pricing, about, services, etc.), call search_site_content then navigate_to_page immediately — never ask permission. After navigating to a page with a form, call list_page_forms and proactively start helping the user fill it.
|
|
23100
|
+
o.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${r || "unknown"}. Page fields/buttons JSON: ${t}. Navigation: when the user wants to go to any page (contact, pricing, about, services, etc.), call search_site_content then navigate_to_page immediately — never ask permission. After navigating to a page with a form, call list_page_forms and proactively start helping the user fill it. Contact / lead forms: use only the main contact form (Full Name, Email, Message). Ignore footer “Conduct Audit” or marketing URL fields unless the user explicitly asks to run a website audit. Fill in order: name → email → message. Message must be a short visitor note (what they want from the team), not a transcript of the conversation. Forms: use fill_form_fields then click_page_button (e.g. Send Message) when appropriate. Fill each field right after the user gives that value — do not click submit until required fields are filled. Voice: if the user wants to end the voice session, call end_voice_session or confirm and end.`);
|
|
23064
23101
|
} catch {}
|
|
23065
23102
|
typeof m == "function" && m();
|
|
23066
23103
|
} catch (e) {
|
|
@@ -23076,7 +23113,7 @@ function n_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
23076
23113
|
d,
|
|
23077
23114
|
m
|
|
23078
23115
|
]);
|
|
23079
|
-
let ce = h === "listening" || h === "speaking", le =
|
|
23116
|
+
let ce = h === "listening" || h === "speaking", le = n_[h] || n_.idle, ue = t_[h] || t_.idle;
|
|
23080
23117
|
return /* @__PURE__ */ u("div", {
|
|
23081
23118
|
ref: ie,
|
|
23082
23119
|
style: {
|
|
@@ -23182,7 +23219,7 @@ function n_({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
23182
23219
|
}
|
|
23183
23220
|
//#endregion
|
|
23184
23221
|
//#region src/components/FlowEngageWidget.jsx
|
|
23185
|
-
var
|
|
23222
|
+
var a_ = [
|
|
23186
23223
|
{
|
|
23187
23224
|
key: "become_client",
|
|
23188
23225
|
label: "Become a Client"
|
|
@@ -23203,7 +23240,7 @@ var r_ = [
|
|
|
23203
23240
|
key: "looking_for_job",
|
|
23204
23241
|
label: "Looking for a Job"
|
|
23205
23242
|
}
|
|
23206
|
-
],
|
|
23243
|
+
], o_ = () => /* @__PURE__ */ l("div", {
|
|
23207
23244
|
style: {
|
|
23208
23245
|
display: "flex",
|
|
23209
23246
|
marginBottom: "12px",
|
|
@@ -23234,7 +23271,7 @@ var r_ = [
|
|
|
23234
23271
|
} }, e)), /* @__PURE__ */ l("style", { children: "\n @keyframes fe-dot-bounce {\n 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }\n 40% { transform: translateY(-5px); opacity: 1; }\n }\n " })]
|
|
23235
23272
|
})
|
|
23236
23273
|
});
|
|
23237
|
-
function
|
|
23274
|
+
function s_() {
|
|
23238
23275
|
let { status: e, runtimeConfig: t, resolvedConfig: n, chatId: r, chatHistory: o, isOpen: c, activeScreen: d, isHumanHandled: f, agentName: p, agentHeadshot: m, visitorEmail: h, isAgentTyping: g, isAiTyping: ee, isLoading: te, isVoiceMode: _, isRateLimited: ne, rateLimitMessage: re, isConversationEnded: ie, incomingCall: ae, activeCallId: oe, callConnectionState: se, callConnectedAt: v, isCallMuted: ce, webRTCError: le, language: ue, historyRef: y, onMessageSync: b, endConversation: de, acceptCall: fe, rejectCall: pe, endWebRTCCall: me, toggleCallMute: he, dismissCallError: ge, captureVisitorEmail: _e, openWidget: ve, closeWidget: ye, sendMessage: be, setVoiceMode: xe, startTyping: Se, stopTyping: Ce, updateTypingDraft: we } = Xt(), [Te, Ee] = s(""), [De, Oe] = s(null), [ke, Ae] = s(null), [je, Me] = s(null), [Ne, Pe] = s(0), [x, Fe] = s(h || ""), [Ie, Le] = s("");
|
|
23239
23276
|
i(() => {
|
|
23240
23277
|
try {
|
|
@@ -23262,7 +23299,7 @@ function a_() {
|
|
|
23262
23299
|
outline: "none",
|
|
23263
23300
|
fontFamily: "ui-sans-serif, system-ui, sans-serif",
|
|
23264
23301
|
...c ? {} : Ue
|
|
23265
|
-
}, Ge = S.recommendations?.[ue] || Re.recommendations?.[ue] ||
|
|
23302
|
+
}, Ge = S.recommendations?.[ue] || Re.recommendations?.[ue] || a_, Ke = S.greetings?.[ue] || Re.greetings?.[ue], qe = ze.chatButtonText || "Chat with us", Je = ze.headerName || t?.websiteName || "OpenSense Labs", C = ze.logoUrl || null, w = ze.hideWatermark || !1, T = Re.elevenLabsAgentId || t?.elevenLabsAgentId || null, Ye = t?.siteId || n?.siteId || null, Xe = t?.apiBaseUrl || "", Ze = ze.fallbackAgentName || "Agent", Qe = ze.botLabel || "AI", $e = m && String(m).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, et = ae?.agentName || p || Ze, tt = o.some((e) => e.sender === "user"), nt = a(() => {
|
|
23266
23303
|
let e = o.findIndex((e) => e.sender === "user");
|
|
23267
23304
|
return e === -1 ? !1 : o.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
23268
23305
|
}, [o]), rt = !h && tt && nt;
|
|
@@ -23390,7 +23427,7 @@ function a_() {
|
|
|
23390
23427
|
flexDirection: "column"
|
|
23391
23428
|
},
|
|
23392
23429
|
className: "fe-screen-fade-in",
|
|
23393
|
-
children: /* @__PURE__ */ l(
|
|
23430
|
+
children: /* @__PURE__ */ l(i_, {
|
|
23394
23431
|
agentId: T,
|
|
23395
23432
|
chatId: r,
|
|
23396
23433
|
siteId: Ye,
|
|
@@ -23423,7 +23460,7 @@ function a_() {
|
|
|
23423
23460
|
isAiTyping: ee,
|
|
23424
23461
|
isAgentTyping: g,
|
|
23425
23462
|
setReplyContext: Me,
|
|
23426
|
-
TypingDots:
|
|
23463
|
+
TypingDots: o_,
|
|
23427
23464
|
primaryColor: Ve,
|
|
23428
23465
|
agentHeadshot: $e,
|
|
23429
23466
|
agentDisplayName: p || Ze
|
|
@@ -23502,4 +23539,4 @@ function a_() {
|
|
|
23502
23539
|
}) : null;
|
|
23503
23540
|
}
|
|
23504
23541
|
//#endregion
|
|
23505
|
-
export { vn as FlowEngageProvider,
|
|
23542
|
+
export { vn as FlowEngageProvider, s_ as FlowEngageWidget, Xt as useFlowEngage };
|