@flowengage/react-chatbot 8.0.121 → 8.0.123
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.
|
@@ -9880,17 +9880,35 @@ function Uh(e, t) {
|
|
|
9880
9880
|
n();
|
|
9881
9881
|
}
|
|
9882
9882
|
}
|
|
9883
|
-
function Wh(e, t
|
|
9883
|
+
function Wh(e, t) {
|
|
9884
|
+
let n = Number(e);
|
|
9885
|
+
if (!Number.isFinite(n)) return null;
|
|
9886
|
+
let r = n.toLocaleString(void 0, {
|
|
9887
|
+
minimumFractionDigits: n % 1 == 0 ? 0 : 2,
|
|
9888
|
+
maximumFractionDigits: 2
|
|
9889
|
+
});
|
|
9890
|
+
return t ? `${t} ${r}` : r;
|
|
9891
|
+
}
|
|
9892
|
+
function Gh(e) {
|
|
9893
|
+
if (!e) return null;
|
|
9894
|
+
let t = new Date(e);
|
|
9895
|
+
return Number.isNaN(t.getTime()) ? null : t.toLocaleDateString(void 0, {
|
|
9896
|
+
day: "numeric",
|
|
9897
|
+
month: "short",
|
|
9898
|
+
year: "numeric"
|
|
9899
|
+
});
|
|
9900
|
+
}
|
|
9901
|
+
function Kh(e, t = {}) {
|
|
9884
9902
|
try {
|
|
9885
|
-
|
|
9903
|
+
qh(e, t);
|
|
9886
9904
|
} catch (e) {
|
|
9887
|
-
console.error("[FlowEngage] product panel render failed:", e),
|
|
9905
|
+
console.error("[FlowEngage] product panel render failed:", e), Jh();
|
|
9888
9906
|
}
|
|
9889
9907
|
}
|
|
9890
|
-
function
|
|
9908
|
+
function qh(e, { title: t = "Products", side: n = "right", productUrl: r = null } = {}) {
|
|
9891
9909
|
if (typeof document > "u") return;
|
|
9892
9910
|
let i = Array.isArray(e) ? e.filter(Boolean) : [];
|
|
9893
|
-
if (!i.length) return console.log("[FlowEngage] product panel: nothing to show"),
|
|
9911
|
+
if (!i.length) return console.log("[FlowEngage] product panel: nothing to show"), Jh();
|
|
9894
9912
|
Ah();
|
|
9895
9913
|
let a = Lh();
|
|
9896
9914
|
Vh = n === "left" ? "left" : "right", Uh(a, Vh), Hh || (Hh = !0, window.addEventListener("resize", () => {
|
|
@@ -9903,7 +9921,7 @@ function Gh(e, { title: t = "Products", side: n = "right", productUrl: r = null
|
|
|
9903
9921
|
let l = document.createElement("span");
|
|
9904
9922
|
l.id = `${Q}-panel-count`, l.textContent = String(i.length);
|
|
9905
9923
|
let u = document.createElement("button");
|
|
9906
|
-
u.id = `${Q}-panel-close`, u.type = "button", u.setAttribute("aria-label", "Close product panel"), u.textContent = "×", u.addEventListener("click", () =>
|
|
9924
|
+
u.id = `${Q}-panel-close`, u.type = "button", u.setAttribute("aria-label", "Close product panel"), u.textContent = "×", u.addEventListener("click", () => Jh()), s.append(c, l, u);
|
|
9907
9925
|
let d = document.createElement("div");
|
|
9908
9926
|
d.id = `${Q}-panel-list`;
|
|
9909
9927
|
for (let e of i) {
|
|
@@ -9924,7 +9942,7 @@ function Gh(e, { title: t = "Products", side: n = "right", productUrl: r = null
|
|
|
9924
9942
|
a.className = `${Q}-card-title`, a.textContent = e.title || "Item", i.appendChild(a);
|
|
9925
9943
|
let o = [];
|
|
9926
9944
|
e.quantity > 1 && o.push(`Qty ${e.quantity}`);
|
|
9927
|
-
let s =
|
|
9945
|
+
let s = Gh(e.orderedAt);
|
|
9928
9946
|
if (s && o.push(s), e.fulfillmentStatus && o.push(e.fulfillmentStatus), o.length || e.productType) {
|
|
9929
9947
|
let t = document.createElement("div");
|
|
9930
9948
|
if (t.className = `${Q}-card-meta`, e.productType) {
|
|
@@ -9933,7 +9951,7 @@ function Gh(e, { title: t = "Products", side: n = "right", productUrl: r = null
|
|
|
9933
9951
|
}
|
|
9934
9952
|
t.appendChild(document.createTextNode(o.join(" · "))), i.appendChild(t);
|
|
9935
9953
|
}
|
|
9936
|
-
let c =
|
|
9954
|
+
let c = Wh(e.price, e.currency);
|
|
9937
9955
|
if (c) {
|
|
9938
9956
|
let e = document.createElement("div");
|
|
9939
9957
|
e.className = `${Q}-card-price`, e.textContent = c, i.appendChild(e);
|
|
@@ -9947,45 +9965,45 @@ function Gh(e, { title: t = "Products", side: n = "right", productUrl: r = null
|
|
|
9947
9965
|
rect: a.getBoundingClientRect()
|
|
9948
9966
|
});
|
|
9949
9967
|
}
|
|
9950
|
-
function
|
|
9968
|
+
function Jh() {
|
|
9951
9969
|
Ih && Ih.classList.remove(`${Q}-show`);
|
|
9952
9970
|
}
|
|
9953
|
-
var
|
|
9954
|
-
function
|
|
9955
|
-
return (!
|
|
9971
|
+
var Yh = null, Xh = [];
|
|
9972
|
+
function Zh() {
|
|
9973
|
+
return (!Yh || !Yh.isConnected) && (Yh = document.createElement("div"), Yh.id = `${Q}-bar`, document.body.appendChild(Yh)), Yh;
|
|
9956
9974
|
}
|
|
9957
|
-
function
|
|
9975
|
+
function Qh() {
|
|
9958
9976
|
if (typeof document > "u") return;
|
|
9959
|
-
Ah(),
|
|
9960
|
-
let e =
|
|
9977
|
+
Ah(), Xh.forEach(clearTimeout), Xh = [];
|
|
9978
|
+
let e = Zh();
|
|
9961
9979
|
e.style.transition = "none", e.style.width = "0%", e.classList.add(`${Q}-bar-active`), e.offsetHeight, e.style.transition = "width 0.35s ease, opacity 0.25s ease";
|
|
9962
9980
|
let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
|
|
9963
9981
|
for (let [e, r] of t) {
|
|
9964
9982
|
let t = n, i = e, a = r;
|
|
9965
|
-
|
|
9966
|
-
|
|
9983
|
+
Xh.push(setTimeout(() => {
|
|
9984
|
+
Yh && (Yh.style.transition = a, Yh.style.width = `${i}%`);
|
|
9967
9985
|
}, t)), n += 800;
|
|
9968
9986
|
}
|
|
9969
9987
|
}
|
|
9970
|
-
function
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9988
|
+
function $h() {
|
|
9989
|
+
Yh && (Xh.forEach(clearTimeout), Xh = [], Yh.style.transition = "width 0.2s ease", Yh.style.width = "100%", Xh.push(setTimeout(() => {
|
|
9990
|
+
Yh && (Yh.style.transition = "opacity 0.35s ease", Yh.style.opacity = "0", Xh.push(setTimeout(() => {
|
|
9991
|
+
Yh && (Yh.style.width = "0%", Yh.classList.remove(`${Q}-bar-active`));
|
|
9974
9992
|
}, 380)));
|
|
9975
9993
|
}, 220)));
|
|
9976
9994
|
}
|
|
9977
|
-
var
|
|
9995
|
+
var eg = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
|
|
9978
9996
|
<filter id="${Q}-csh">
|
|
9979
9997
|
<feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
|
|
9980
9998
|
</filter>
|
|
9981
9999
|
<path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
|
|
9982
10000
|
fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
|
|
9983
10001
|
filter="url(#${Q}-csh)"/>
|
|
9984
|
-
</svg>`,
|
|
9985
|
-
function
|
|
9986
|
-
return (
|
|
10002
|
+
</svg>`, tg = null, ng = !1;
|
|
10003
|
+
function rg() {
|
|
10004
|
+
return (!tg || !tg.isConnected) && (tg = document.createElement("div"), tg.id = `${Q}-cursor`, tg.innerHTML = eg, document.body.appendChild(tg), ng = !1), tg;
|
|
9987
10005
|
}
|
|
9988
|
-
async function
|
|
10006
|
+
async function ig(e) {
|
|
9989
10007
|
if (typeof document > "u" || !e) return;
|
|
9990
10008
|
Ah();
|
|
9991
10009
|
let t;
|
|
@@ -9994,18 +10012,18 @@ async function ng(e) {
|
|
|
9994
10012
|
} catch {
|
|
9995
10013
|
return;
|
|
9996
10014
|
}
|
|
9997
|
-
let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i =
|
|
9998
|
-
|
|
10015
|
+
let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = rg();
|
|
10016
|
+
ng ||= (i.style.transition = "none", i.style.left = `${window.innerWidth / 2}px`, i.style.top = `${window.innerHeight * .4}px`, i.classList.add(`${Q}-cursor-visible`), i.offsetHeight, i.style.transition = "left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease", !0), i.style.left = `${n}px`, i.style.top = `${r}px`, await cg(360);
|
|
9999
10017
|
}
|
|
10000
|
-
function
|
|
10001
|
-
|
|
10002
|
-
|
|
10018
|
+
function ag(e = !1) {
|
|
10019
|
+
tg && (e ? (tg.classList.remove(`${Q}-cursor-visible`), ng = !1) : (tg.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
|
|
10020
|
+
ng = !1;
|
|
10003
10021
|
}, 250)));
|
|
10004
10022
|
}
|
|
10005
|
-
async function
|
|
10006
|
-
|
|
10023
|
+
async function og(e) {
|
|
10024
|
+
tg && (tg.classList.add(`${Q}-cursor-click`), await cg(280), tg.classList.remove(`${Q}-cursor-click`));
|
|
10007
10025
|
}
|
|
10008
|
-
function
|
|
10026
|
+
function sg(e) {
|
|
10009
10027
|
if (!e || typeof document > "u") return;
|
|
10010
10028
|
Ah();
|
|
10011
10029
|
let t;
|
|
@@ -10033,12 +10051,12 @@ function ag(e) {
|
|
|
10033
10051
|
a.remove(), e.style.position = n, e.style.overflow = r;
|
|
10034
10052
|
}, 650);
|
|
10035
10053
|
}
|
|
10036
|
-
function
|
|
10054
|
+
function cg(e) {
|
|
10037
10055
|
return new Promise((t) => setTimeout(t, e));
|
|
10038
10056
|
}
|
|
10039
10057
|
//#endregion
|
|
10040
10058
|
//#region src/lib/svgIcons.jsx
|
|
10041
|
-
var
|
|
10059
|
+
var lg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
|
|
10042
10060
|
width: e,
|
|
10043
10061
|
height: e,
|
|
10044
10062
|
viewBox: "0 0 24 24",
|
|
@@ -10054,7 +10072,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10054
10072
|
strokeLinecap: "round",
|
|
10055
10073
|
strokeLinejoin: "round"
|
|
10056
10074
|
})]
|
|
10057
|
-
}),
|
|
10075
|
+
}), ug = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
|
|
10058
10076
|
width: e,
|
|
10059
10077
|
height: e,
|
|
10060
10078
|
viewBox: "0 0 24 24",
|
|
@@ -10069,7 +10087,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10069
10087
|
x2: "1",
|
|
10070
10088
|
y2: "23"
|
|
10071
10089
|
})]
|
|
10072
|
-
}),
|
|
10090
|
+
}), dg = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
|
|
10073
10091
|
width: e,
|
|
10074
10092
|
height: e,
|
|
10075
10093
|
viewBox: "0 0 24 24",
|
|
@@ -10084,7 +10102,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10084
10102
|
x2: "12",
|
|
10085
10103
|
y2: "5"
|
|
10086
10104
|
}), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
|
|
10087
|
-
}),
|
|
10105
|
+
}), fg = () => /* @__PURE__ */ _("svg", {
|
|
10088
10106
|
width: "14",
|
|
10089
10107
|
height: "14",
|
|
10090
10108
|
viewBox: "0 0 24 24",
|
|
@@ -10094,7 +10112,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10094
10112
|
strokeLinecap: "round",
|
|
10095
10113
|
strokeLinejoin: "round",
|
|
10096
10114
|
children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
|
|
10097
|
-
}),
|
|
10115
|
+
}), pg = () => /* @__PURE__ */ g("svg", {
|
|
10098
10116
|
width: "18",
|
|
10099
10117
|
height: "18",
|
|
10100
10118
|
viewBox: "0 0 24 24",
|
|
@@ -10104,7 +10122,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10104
10122
|
strokeLinecap: "round",
|
|
10105
10123
|
strokeLinejoin: "round",
|
|
10106
10124
|
children: /* @__PURE__ */ g("path", { d: "M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z" })
|
|
10107
|
-
}),
|
|
10125
|
+
}), mg = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
|
|
10108
10126
|
className: e,
|
|
10109
10127
|
width: "14",
|
|
10110
10128
|
height: "14",
|
|
@@ -10133,7 +10151,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10133
10151
|
y2: "16"
|
|
10134
10152
|
})
|
|
10135
10153
|
]
|
|
10136
|
-
}),
|
|
10154
|
+
}), hg = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
|
|
10137
10155
|
width: e,
|
|
10138
10156
|
height: e,
|
|
10139
10157
|
viewBox: "0 0 24 24",
|
|
@@ -10156,7 +10174,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10156
10174
|
/* @__PURE__ */ g("path", { d: "M15 13v2" }),
|
|
10157
10175
|
/* @__PURE__ */ g("path", { d: "M9 13v2" })
|
|
10158
10176
|
]
|
|
10159
|
-
}),
|
|
10177
|
+
}), gg = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
|
|
10160
10178
|
width: e,
|
|
10161
10179
|
height: e,
|
|
10162
10180
|
viewBox: "0 0 24 24",
|
|
@@ -10176,7 +10194,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10176
10194
|
x2: "19",
|
|
10177
10195
|
y2: "12"
|
|
10178
10196
|
})]
|
|
10179
|
-
}),
|
|
10197
|
+
}), _g = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
|
|
10180
10198
|
width: e,
|
|
10181
10199
|
height: e,
|
|
10182
10200
|
viewBox: "0 0 24 24",
|
|
@@ -10202,7 +10220,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10202
10220
|
fill: t
|
|
10203
10221
|
})
|
|
10204
10222
|
]
|
|
10205
|
-
}),
|
|
10223
|
+
}), vg = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
|
|
10206
10224
|
width: "24",
|
|
10207
10225
|
height: "24",
|
|
10208
10226
|
viewBox: "0 0 24 24",
|
|
@@ -10220,7 +10238,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10220
10238
|
"stroke-linecap": "round",
|
|
10221
10239
|
"stroke-linejoin": "round"
|
|
10222
10240
|
})]
|
|
10223
|
-
}),
|
|
10241
|
+
}), yg = () => /* @__PURE__ */ g("svg", {
|
|
10224
10242
|
width: "24",
|
|
10225
10243
|
height: "24",
|
|
10226
10244
|
viewBox: "0 0 24 24",
|
|
@@ -10232,7 +10250,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10232
10250
|
"stroke-width": "1.5",
|
|
10233
10251
|
"stroke-linejoin": "round"
|
|
10234
10252
|
})
|
|
10235
|
-
}),
|
|
10253
|
+
}), bg = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
|
|
10236
10254
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10237
10255
|
width: e,
|
|
10238
10256
|
height: e,
|
|
@@ -10250,7 +10268,7 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10250
10268
|
/* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
|
|
10251
10269
|
/* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
|
|
10252
10270
|
]
|
|
10253
|
-
}),
|
|
10271
|
+
}), xg = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Sg = (e = "") => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), Cg = new Set([
|
|
10254
10272
|
"p",
|
|
10255
10273
|
"br",
|
|
10256
10274
|
"ul",
|
|
@@ -10261,30 +10279,30 @@ var sg = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg
|
|
|
10261
10279
|
"b",
|
|
10262
10280
|
"i",
|
|
10263
10281
|
"a"
|
|
10264
|
-
]),
|
|
10265
|
-
function
|
|
10282
|
+
]), wg = /^https?:\/\//i;
|
|
10283
|
+
function Tg(e) {
|
|
10266
10284
|
let t = Array.from(e.childNodes);
|
|
10267
10285
|
for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
|
|
10268
10286
|
let t = n.tagName.toLowerCase();
|
|
10269
|
-
if (!
|
|
10287
|
+
if (!Cg.has(t)) {
|
|
10270
10288
|
e.replaceChild(document.createTextNode(n.textContent), n);
|
|
10271
10289
|
continue;
|
|
10272
10290
|
}
|
|
10273
10291
|
let r = {};
|
|
10274
10292
|
if (t === "a") {
|
|
10275
10293
|
let e = n.getAttribute("href") || "";
|
|
10276
|
-
|
|
10294
|
+
wg.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
|
|
10277
10295
|
}
|
|
10278
10296
|
for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
|
|
10279
10297
|
for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
|
|
10280
|
-
|
|
10298
|
+
Tg(n);
|
|
10281
10299
|
} else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
|
|
10282
10300
|
}
|
|
10283
|
-
function
|
|
10301
|
+
function Eg(e) {
|
|
10284
10302
|
let t = document.createElement("div");
|
|
10285
|
-
return t.innerHTML = e,
|
|
10303
|
+
return t.innerHTML = e, Tg(t), t.innerHTML;
|
|
10286
10304
|
}
|
|
10287
|
-
function
|
|
10305
|
+
function Dg(e) {
|
|
10288
10306
|
let t = String(e || "").trim();
|
|
10289
10307
|
if (!t) return t;
|
|
10290
10308
|
let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
|
|
@@ -10296,33 +10314,33 @@ function Tg(e) {
|
|
|
10296
10314
|
}
|
|
10297
10315
|
return e;
|
|
10298
10316
|
}
|
|
10299
|
-
var
|
|
10317
|
+
var Og = (e = "") => {
|
|
10300
10318
|
let t = String(e || "").trim();
|
|
10301
10319
|
if (!t) return "";
|
|
10302
|
-
if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return
|
|
10303
|
-
let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) =>
|
|
10304
|
-
return
|
|
10320
|
+
if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return Dg(Eg(t));
|
|
10321
|
+
let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) => Sg(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*\n]+)\*/g, "<em>$1</em>");
|
|
10322
|
+
return Dg(n.map((e) => {
|
|
10305
10323
|
let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
|
|
10306
10324
|
if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
|
|
10307
10325
|
let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
|
|
10308
10326
|
return i.length >= 2 && i.every((e) => /^[-*]\s+/.test(e)) ? `<ul>${i.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>` : `<p>${r(e).replace(/\n/g, "<br />")}</p>`;
|
|
10309
10327
|
}).join(""));
|
|
10310
|
-
},
|
|
10328
|
+
}, kg = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Ag = new Set([
|
|
10311
10329
|
".pdf",
|
|
10312
10330
|
".docx",
|
|
10313
10331
|
".png",
|
|
10314
10332
|
".jpg",
|
|
10315
10333
|
".jpeg"
|
|
10316
|
-
]),
|
|
10317
|
-
function
|
|
10334
|
+
]), jg = "image/png,image/jpeg,.pdf,.docx";
|
|
10335
|
+
function Mg(e) {
|
|
10318
10336
|
if (!e) return !1;
|
|
10319
10337
|
let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
|
|
10320
|
-
return r === "image/png" || r === "image/jpeg" ||
|
|
10338
|
+
return r === "image/png" || r === "image/jpeg" || kg.has(r) || Ag.has(n);
|
|
10321
10339
|
}
|
|
10322
|
-
function
|
|
10323
|
-
return e ?
|
|
10340
|
+
function Ng(e) {
|
|
10341
|
+
return e ? Mg(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
|
|
10324
10342
|
}
|
|
10325
|
-
function
|
|
10343
|
+
function Pg(e = 0) {
|
|
10326
10344
|
if (!Number.isFinite(e) || e <= 0) return "";
|
|
10327
10345
|
let t = [
|
|
10328
10346
|
"B",
|
|
@@ -10334,12 +10352,12 @@ function Mg(e = 0) {
|
|
|
10334
10352
|
let i = n >= 10 || r === 0 ? 0 : 1;
|
|
10335
10353
|
return `${n.toFixed(i)} ${t[r]}`;
|
|
10336
10354
|
}
|
|
10337
|
-
function
|
|
10355
|
+
function Fg(e) {
|
|
10338
10356
|
return e ? e.name || "Attachment" : "";
|
|
10339
10357
|
}
|
|
10340
10358
|
//#endregion
|
|
10341
10359
|
//#region src/utils/avatarHelpers.js
|
|
10342
|
-
function
|
|
10360
|
+
function Ig(e) {
|
|
10343
10361
|
if (!e || typeof e != "string") return "?";
|
|
10344
10362
|
let t = e.trim();
|
|
10345
10363
|
if (!t) return "?";
|
|
@@ -10348,7 +10366,7 @@ function Pg(e) {
|
|
|
10348
10366
|
}
|
|
10349
10367
|
//#endregion
|
|
10350
10368
|
//#region src/components/AvatarImageOrInitials.jsx
|
|
10351
|
-
function
|
|
10369
|
+
function Lg({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
|
|
10352
10370
|
let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
|
|
10353
10371
|
return c(() => {
|
|
10354
10372
|
if (!o) {
|
|
@@ -10371,12 +10389,12 @@ function Fg({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
|
|
|
10371
10389
|
onError: () => a(null)
|
|
10372
10390
|
}) : /* @__PURE__ */ g("span", {
|
|
10373
10391
|
style: r,
|
|
10374
|
-
children:
|
|
10392
|
+
children: Ig(t)
|
|
10375
10393
|
});
|
|
10376
10394
|
}
|
|
10377
10395
|
//#endregion
|
|
10378
10396
|
//#region src/components/MessageList.jsx
|
|
10379
|
-
function
|
|
10397
|
+
function Rg({ siteId: e, onChoose: t }) {
|
|
10380
10398
|
let [n, r] = m(null), i = (n) => {
|
|
10381
10399
|
le(e, n), r(n), t?.(n);
|
|
10382
10400
|
};
|
|
@@ -10449,7 +10467,7 @@ function Ig({ siteId: e, onChoose: t }) {
|
|
|
10449
10467
|
})
|
|
10450
10468
|
});
|
|
10451
10469
|
}
|
|
10452
|
-
function
|
|
10470
|
+
function zg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
|
|
10453
10471
|
let { resolvedConfig: d } = kn(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
|
|
10454
10472
|
let t = e.target.closest("a[href]");
|
|
10455
10473
|
if (!t) return;
|
|
@@ -10504,8 +10522,8 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10504
10522
|
children: [
|
|
10505
10523
|
e.map((e) => {
|
|
10506
10524
|
if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
|
|
10507
|
-
if (e.type === "nav_pref_choice") return /* @__PURE__ */ g(
|
|
10508
|
-
let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || l, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, v =
|
|
10525
|
+
if (e.type === "nav_pref_choice") return /* @__PURE__ */ g(Rg, { siteId: d?.siteId }, e.id || e.messageId);
|
|
10526
|
+
let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, f = e.type === "file" && e.metadata?.fileUrl, p = e.agent_name || e.agentName || e.metadata?.agentName || l, m = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, v = xg(e.replyToContent || e.replyContext?.message || ""), S = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
|
|
10509
10527
|
return t ? /* @__PURE__ */ g("div", {
|
|
10510
10528
|
style: {
|
|
10511
10529
|
display: "flex",
|
|
@@ -10550,7 +10568,7 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10550
10568
|
fontWeight: 800,
|
|
10551
10569
|
marginTop: !c && (r || o) ? "22px" : "0px"
|
|
10552
10570
|
},
|
|
10553
|
-
children: r ? u || /* @__PURE__ */ g(
|
|
10571
|
+
children: r ? u || /* @__PURE__ */ g(hg, { size: 16 }) : /* @__PURE__ */ g(Lg, {
|
|
10554
10572
|
src: m || "",
|
|
10555
10573
|
name: p,
|
|
10556
10574
|
imgStyle: {
|
|
@@ -10592,7 +10610,7 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10592
10610
|
onMouseLeave: (e) => {
|
|
10593
10611
|
e.currentTarget.style.color = "#9ca3af";
|
|
10594
10612
|
},
|
|
10595
|
-
children: [/* @__PURE__ */ g(
|
|
10613
|
+
children: [/* @__PURE__ */ g(fg, {}), "Reply"]
|
|
10596
10614
|
}),
|
|
10597
10615
|
/* @__PURE__ */ _("div", {
|
|
10598
10616
|
style: {
|
|
@@ -10636,7 +10654,7 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10636
10654
|
children: v
|
|
10637
10655
|
})]
|
|
10638
10656
|
}), f ? (() => {
|
|
10639
|
-
let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i =
|
|
10657
|
+
let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Pg(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
|
|
10640
10658
|
color: "#ef4444",
|
|
10641
10659
|
label: "PDF"
|
|
10642
10660
|
} : t.includes("word") || t.includes("docx") ? {
|
|
@@ -10817,7 +10835,7 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10817
10835
|
});
|
|
10818
10836
|
})() : r ? /* @__PURE__ */ g("div", {
|
|
10819
10837
|
className: "flowengage-message-content fe-bot-message",
|
|
10820
|
-
dangerouslySetInnerHTML: { __html:
|
|
10838
|
+
dangerouslySetInnerHTML: { __html: Og(e.message) },
|
|
10821
10839
|
onClick: T
|
|
10822
10840
|
}) : /* @__PURE__ */ g("div", {
|
|
10823
10841
|
style: { whiteSpace: "pre-wrap" },
|
|
@@ -10882,7 +10900,7 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10882
10900
|
boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
|
|
10883
10901
|
overflow: "hidden"
|
|
10884
10902
|
},
|
|
10885
|
-
children: u || /* @__PURE__ */ g(
|
|
10903
|
+
children: u || /* @__PURE__ */ g(hg, { size: 16 })
|
|
10886
10904
|
}), /* @__PURE__ */ _("div", {
|
|
10887
10905
|
style: {
|
|
10888
10906
|
display: "flex",
|
|
@@ -10924,7 +10942,7 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
10924
10942
|
borderRadius: "50%",
|
|
10925
10943
|
overflow: "hidden"
|
|
10926
10944
|
},
|
|
10927
|
-
children: /* @__PURE__ */ g(
|
|
10945
|
+
children: /* @__PURE__ */ g(Lg, {
|
|
10928
10946
|
src: s || "",
|
|
10929
10947
|
name: l,
|
|
10930
10948
|
imgStyle: {
|
|
@@ -11018,22 +11036,22 @@ function Lg({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
|
|
|
11018
11036
|
}
|
|
11019
11037
|
//#endregion
|
|
11020
11038
|
//#region src/components/ChatInput.jsx
|
|
11021
|
-
var
|
|
11022
|
-
function
|
|
11039
|
+
var Bg = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
|
|
11040
|
+
function Vg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
|
|
11023
11041
|
let D = p(null), O = p(null), k = (e) => {
|
|
11024
11042
|
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
|
|
11025
11043
|
};
|
|
11026
11044
|
c(() => {
|
|
11027
11045
|
d || k(O.current);
|
|
11028
11046
|
}, [e, d]), c(() => {
|
|
11029
|
-
d ||
|
|
11047
|
+
d || Bg || e || s || O.current?.focus();
|
|
11030
11048
|
}, [
|
|
11031
11049
|
e,
|
|
11032
11050
|
d,
|
|
11033
11051
|
s
|
|
11034
11052
|
]);
|
|
11035
11053
|
let A = (e) => {
|
|
11036
|
-
e.key === "Enter" && (
|
|
11054
|
+
e.key === "Enter" && (Bg || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
|
|
11037
11055
|
}, ee = l?.sender === "user" ? "You" : l?.sender === "agent" ? "Agent" : "AI Assistant", te = d ? !!f?.trim() : !!e?.trim() || !!S, ne = s || T || !te, j = !d && b && y;
|
|
11038
11056
|
return /* @__PURE__ */ _("div", {
|
|
11039
11057
|
style: {
|
|
@@ -11128,7 +11146,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11128
11146
|
background: "rgba(59,130,246,0.08)",
|
|
11129
11147
|
color: "var(--flowengage-primary)"
|
|
11130
11148
|
},
|
|
11131
|
-
children: /* @__PURE__ */ g(
|
|
11149
|
+
children: /* @__PURE__ */ g(hg, { size: 13 })
|
|
11132
11150
|
}), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
|
|
11133
11151
|
})
|
|
11134
11152
|
}),
|
|
@@ -11168,7 +11186,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11168
11186
|
overflow: "hidden",
|
|
11169
11187
|
textOverflow: "ellipsis"
|
|
11170
11188
|
},
|
|
11171
|
-
children:
|
|
11189
|
+
children: Fg(S)
|
|
11172
11190
|
}),
|
|
11173
11191
|
/* @__PURE__ */ g("div", {
|
|
11174
11192
|
style: {
|
|
@@ -11176,7 +11194,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11176
11194
|
color: "#6b7280",
|
|
11177
11195
|
marginTop: "2px"
|
|
11178
11196
|
},
|
|
11179
|
-
children:
|
|
11197
|
+
children: Pg(S.size)
|
|
11180
11198
|
})
|
|
11181
11199
|
]
|
|
11182
11200
|
}), /* @__PURE__ */ g("button", {
|
|
@@ -11221,7 +11239,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11221
11239
|
j ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
|
|
11222
11240
|
ref: D,
|
|
11223
11241
|
type: "file",
|
|
11224
|
-
accept:
|
|
11242
|
+
accept: jg,
|
|
11225
11243
|
style: { display: "none" },
|
|
11226
11244
|
onChange: (e) => {
|
|
11227
11245
|
let t = e.target.files?.[0];
|
|
@@ -11253,7 +11271,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11253
11271
|
onMouseLeave: (e) => {
|
|
11254
11272
|
e.currentTarget.style.opacity = "1";
|
|
11255
11273
|
},
|
|
11256
|
-
children: /* @__PURE__ */ g(
|
|
11274
|
+
children: /* @__PURE__ */ g(gg, {
|
|
11257
11275
|
size: 16,
|
|
11258
11276
|
color: "currentColor"
|
|
11259
11277
|
})
|
|
@@ -11334,7 +11352,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11334
11352
|
onMouseLeave: (e) => {
|
|
11335
11353
|
e.currentTarget.style.opacity = "1";
|
|
11336
11354
|
},
|
|
11337
|
-
children: /* @__PURE__ */ g(
|
|
11355
|
+
children: /* @__PURE__ */ g(dg, { size: 16 })
|
|
11338
11356
|
})
|
|
11339
11357
|
]
|
|
11340
11358
|
}),
|
|
@@ -11397,7 +11415,7 @@ function zg({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
11397
11415
|
}
|
|
11398
11416
|
//#endregion
|
|
11399
11417
|
//#region src/components/StatusBanners.jsx
|
|
11400
|
-
function
|
|
11418
|
+
function Hg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
|
|
11401
11419
|
return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
|
|
11402
11420
|
style: {
|
|
11403
11421
|
margin: "0 20px 10px",
|
|
@@ -11410,7 +11428,7 @@ function Bg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
|
|
|
11410
11428
|
gap: "10px"
|
|
11411
11429
|
},
|
|
11412
11430
|
children: [
|
|
11413
|
-
/* @__PURE__ */ g(
|
|
11431
|
+
/* @__PURE__ */ g(mg, { className: "" }),
|
|
11414
11432
|
/* @__PURE__ */ g("span", {
|
|
11415
11433
|
style: {
|
|
11416
11434
|
fontSize: "12px",
|
|
@@ -11456,13 +11474,13 @@ function Bg({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
|
|
|
11456
11474
|
}
|
|
11457
11475
|
//#endregion
|
|
11458
11476
|
//#region src/components/AnimatedOrb.jsx
|
|
11459
|
-
var
|
|
11477
|
+
var Ug = [
|
|
11460
11478
|
"#135bd8",
|
|
11461
11479
|
"#ef334b",
|
|
11462
11480
|
"#ffbd2e"
|
|
11463
11481
|
];
|
|
11464
|
-
function
|
|
11465
|
-
return !Array.isArray(e) || e.length === 0 ?
|
|
11482
|
+
function Wg(e) {
|
|
11483
|
+
return !Array.isArray(e) || e.length === 0 ? Ug : e.length === 1 ? [
|
|
11466
11484
|
e[0],
|
|
11467
11485
|
e[0],
|
|
11468
11486
|
e[0]
|
|
@@ -11476,7 +11494,7 @@ function Hg(e) {
|
|
|
11476
11494
|
e[2]
|
|
11477
11495
|
];
|
|
11478
11496
|
}
|
|
11479
|
-
var
|
|
11497
|
+
var Gg = {
|
|
11480
11498
|
idle: 3,
|
|
11481
11499
|
listening: .75,
|
|
11482
11500
|
thinking: 1,
|
|
@@ -11484,7 +11502,7 @@ var Ug = {
|
|
|
11484
11502
|
muted: .75,
|
|
11485
11503
|
error: .08
|
|
11486
11504
|
};
|
|
11487
|
-
function
|
|
11505
|
+
function Kg(e) {
|
|
11488
11506
|
if (!e || typeof e != "string") return [
|
|
11489
11507
|
0,
|
|
11490
11508
|
0,
|
|
@@ -11497,14 +11515,14 @@ function Wg(e) {
|
|
|
11497
11515
|
parseInt(n.slice(4, 6), 16) / 255
|
|
11498
11516
|
];
|
|
11499
11517
|
}
|
|
11500
|
-
function
|
|
11518
|
+
function qg(e, t) {
|
|
11501
11519
|
if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
|
|
11502
11520
|
if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
|
|
11503
11521
|
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
11504
11522
|
return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
|
|
11505
11523
|
}
|
|
11506
|
-
var
|
|
11507
|
-
function
|
|
11524
|
+
var Jg = "\n attribute vec2 a_pos;\n varying vec2 v_uv;\n void main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n }\n", Yg = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
|
|
11525
|
+
function Xg(e, t, n) {
|
|
11508
11526
|
let r = (t, n) => {
|
|
11509
11527
|
let r = e.createShader(t);
|
|
11510
11528
|
return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
|
|
@@ -11513,10 +11531,10 @@ function Jg(e, t, n) {
|
|
|
11513
11531
|
let o = e.createProgram();
|
|
11514
11532
|
return e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), e.getProgramParameter(o, e.LINK_STATUS) ? o : (console.error("[AnimatedOrb link]", e.getProgramInfoLog(o)), null);
|
|
11515
11533
|
}
|
|
11516
|
-
function
|
|
11517
|
-
let [s, l, u] =
|
|
11534
|
+
function Zg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
|
|
11535
|
+
let [s, l, u] = Wg(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(Gg[t] ?? .35);
|
|
11518
11536
|
c(() => {
|
|
11519
|
-
h.current =
|
|
11537
|
+
h.current = Gg[t] ?? .35;
|
|
11520
11538
|
}, [t]), c(() => {
|
|
11521
11539
|
let t = m.current;
|
|
11522
11540
|
if (!t) return;
|
|
@@ -11533,7 +11551,7 @@ function Yg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
|
|
|
11533
11551
|
console.warn("[AnimatedOrb] WebGL unavailable.");
|
|
11534
11552
|
return;
|
|
11535
11553
|
}
|
|
11536
|
-
let i =
|
|
11554
|
+
let i = Xg(r, Jg, Yg);
|
|
11537
11555
|
if (!i) {
|
|
11538
11556
|
console.error("[AnimatedOrb] WebGL program failed to compile/link");
|
|
11539
11557
|
return;
|
|
@@ -11563,7 +11581,7 @@ function Yg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
|
|
|
11563
11581
|
c2: r.getUniformLocation(i, "u_c2"),
|
|
11564
11582
|
c3: r.getUniformLocation(i, "u_c3")
|
|
11565
11583
|
};
|
|
11566
|
-
r.uniform3fv(c.c1,
|
|
11584
|
+
r.uniform3fv(c.c1, Kg(s)), r.uniform3fv(c.c2, Kg(l)), r.uniform3fv(c.c3, Kg(u)), r.viewport(0, 0, t.width, t.height);
|
|
11567
11585
|
let d = performance.now(), f, p = (e) => {
|
|
11568
11586
|
r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
|
|
11569
11587
|
};
|
|
@@ -11594,7 +11612,7 @@ function Yg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
|
|
|
11594
11612
|
position: "absolute",
|
|
11595
11613
|
inset: -10,
|
|
11596
11614
|
borderRadius: "50%",
|
|
11597
|
-
background: `radial-gradient(circle, ${
|
|
11615
|
+
background: `radial-gradient(circle, ${qg(s, .18)} 0%, transparent 70%)`,
|
|
11598
11616
|
pointerEvents: "none"
|
|
11599
11617
|
},
|
|
11600
11618
|
animate: { opacity: [.3, .75] },
|
|
@@ -11672,17 +11690,17 @@ function Yg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
|
|
|
11672
11690
|
}
|
|
11673
11691
|
//#endregion
|
|
11674
11692
|
//#region src/components/CallScreen.jsx
|
|
11675
|
-
var
|
|
11676
|
-
function
|
|
11693
|
+
var Qg = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
|
|
11694
|
+
function $g(e) {
|
|
11677
11695
|
let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
|
|
11678
11696
|
return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
|
|
11679
11697
|
}
|
|
11680
|
-
function
|
|
11698
|
+
function e_(e) {
|
|
11681
11699
|
if (!e || typeof e != "string") return "#1a1a1a";
|
|
11682
11700
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16) / 255, a = parseInt(n.slice(4, 6), 16) / 255, o = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
11683
11701
|
return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
|
|
11684
11702
|
}
|
|
11685
|
-
function
|
|
11703
|
+
function t_(e, t) {
|
|
11686
11704
|
let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
|
|
11687
11705
|
return n.length === 1 ? [
|
|
11688
11706
|
`radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
|
|
@@ -11699,8 +11717,8 @@ function $g(e, t) {
|
|
|
11699
11717
|
"#f7f8fa"
|
|
11700
11718
|
].join(", ");
|
|
11701
11719
|
}
|
|
11702
|
-
function
|
|
11703
|
-
let i = (t || "A")[0].toUpperCase(), a =
|
|
11720
|
+
function n_({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
|
|
11721
|
+
let i = (t || "A")[0].toUpperCase(), a = e_(r), o = n > 48 ? {
|
|
11704
11722
|
boxShadow: `0 0 0 3px ${r}44`,
|
|
11705
11723
|
border: "3px solid rgba(255,255,255,0.15)"
|
|
11706
11724
|
} : { border: `1.5px solid ${r}55` };
|
|
@@ -11737,7 +11755,7 @@ function e_({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
|
|
|
11737
11755
|
children: i
|
|
11738
11756
|
});
|
|
11739
11757
|
}
|
|
11740
|
-
function
|
|
11758
|
+
function r_(e) {
|
|
11741
11759
|
let t = p(null), n = o(() => {
|
|
11742
11760
|
if (!t.current) return;
|
|
11743
11761
|
let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
|
|
@@ -11784,8 +11802,8 @@ function t_(e) {
|
|
|
11784
11802
|
n
|
|
11785
11803
|
]), c(() => () => n(), [n]), n;
|
|
11786
11804
|
}
|
|
11787
|
-
function
|
|
11788
|
-
let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x =
|
|
11805
|
+
function i_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
|
|
11806
|
+
let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = r_(!!e), S = async () => {
|
|
11789
11807
|
x(), await c();
|
|
11790
11808
|
}, C = async () => {
|
|
11791
11809
|
x(), await l();
|
|
@@ -11797,14 +11815,14 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
11797
11815
|
flexDirection: "column",
|
|
11798
11816
|
borderRadius: "inherit",
|
|
11799
11817
|
overflow: "hidden",
|
|
11800
|
-
background:
|
|
11818
|
+
background: t_(h, m),
|
|
11801
11819
|
animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
|
|
11802
11820
|
};
|
|
11803
11821
|
if (b === "incoming") {
|
|
11804
11822
|
let e = Array.isArray(h) && h.length > 0 ? h : [m];
|
|
11805
11823
|
return /* @__PURE__ */ _("div", {
|
|
11806
11824
|
style: E,
|
|
11807
|
-
children: [/* @__PURE__ */ g("style", { children:
|
|
11825
|
+
children: [/* @__PURE__ */ g("style", { children: Qg }), /* @__PURE__ */ _("div", {
|
|
11808
11826
|
style: {
|
|
11809
11827
|
flex: 1,
|
|
11810
11828
|
display: "flex",
|
|
@@ -11835,7 +11853,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
11835
11853
|
width: "96px",
|
|
11836
11854
|
height: "96px",
|
|
11837
11855
|
borderRadius: "50%",
|
|
11838
|
-
background: `radial-gradient(circle, rgba(${
|
|
11856
|
+
background: `radial-gradient(circle, rgba(${$g(e[0])},0.2) 0%, transparent 70%)`,
|
|
11839
11857
|
filter: "blur(10px)",
|
|
11840
11858
|
zIndex: 0
|
|
11841
11859
|
} }),
|
|
@@ -11852,7 +11870,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
11852
11870
|
animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
|
|
11853
11871
|
zIndex: 1
|
|
11854
11872
|
} }, n)),
|
|
11855
|
-
/* @__PURE__ */ g(
|
|
11873
|
+
/* @__PURE__ */ g(n_, {
|
|
11856
11874
|
headshot: o,
|
|
11857
11875
|
name: y,
|
|
11858
11876
|
size: 82,
|
|
@@ -11932,7 +11950,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
11932
11950
|
e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
|
|
11933
11951
|
},
|
|
11934
11952
|
"aria-label": "Decline call",
|
|
11935
|
-
children: /* @__PURE__ */ g(
|
|
11953
|
+
children: /* @__PURE__ */ g(ug, { size: 26 })
|
|
11936
11954
|
}), /* @__PURE__ */ g("span", {
|
|
11937
11955
|
style: {
|
|
11938
11956
|
fontSize: "12px",
|
|
@@ -11973,7 +11991,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
11973
11991
|
e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
|
|
11974
11992
|
},
|
|
11975
11993
|
"aria-label": "Accept call",
|
|
11976
|
-
children: /* @__PURE__ */ g(
|
|
11994
|
+
children: /* @__PURE__ */ g(pg, {})
|
|
11977
11995
|
}), /* @__PURE__ */ g("span", {
|
|
11978
11996
|
style: {
|
|
11979
11997
|
fontSize: "12px",
|
|
@@ -11990,7 +12008,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
11990
12008
|
}
|
|
11991
12009
|
return b === "connecting" ? /* @__PURE__ */ _("div", {
|
|
11992
12010
|
style: E,
|
|
11993
|
-
children: [/* @__PURE__ */ g("style", { children:
|
|
12011
|
+
children: [/* @__PURE__ */ g("style", { children: Qg }), /* @__PURE__ */ _("div", {
|
|
11994
12012
|
style: {
|
|
11995
12013
|
flex: 1,
|
|
11996
12014
|
display: "flex",
|
|
@@ -12000,7 +12018,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
12000
12018
|
gap: "24px"
|
|
12001
12019
|
},
|
|
12002
12020
|
children: [
|
|
12003
|
-
/* @__PURE__ */ g(
|
|
12021
|
+
/* @__PURE__ */ g(n_, {
|
|
12004
12022
|
headshot: o,
|
|
12005
12023
|
name: y,
|
|
12006
12024
|
size: 64,
|
|
@@ -12027,7 +12045,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
12027
12045
|
}) : /* @__PURE__ */ _("div", {
|
|
12028
12046
|
style: E,
|
|
12029
12047
|
children: [
|
|
12030
|
-
/* @__PURE__ */ g("style", { children:
|
|
12048
|
+
/* @__PURE__ */ g("style", { children: Qg }),
|
|
12031
12049
|
/* @__PURE__ */ _("div", {
|
|
12032
12050
|
style: {
|
|
12033
12051
|
display: "flex",
|
|
@@ -12073,7 +12091,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
12073
12091
|
children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
|
|
12074
12092
|
})
|
|
12075
12093
|
}),
|
|
12076
|
-
/* @__PURE__ */ g(
|
|
12094
|
+
/* @__PURE__ */ g(Zg, {
|
|
12077
12095
|
colors: h,
|
|
12078
12096
|
size: 36,
|
|
12079
12097
|
voiceState: w
|
|
@@ -12124,7 +12142,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
12124
12142
|
gap: "16px",
|
|
12125
12143
|
padding: "0 24px 16px"
|
|
12126
12144
|
},
|
|
12127
|
-
children: [/* @__PURE__ */ g(
|
|
12145
|
+
children: [/* @__PURE__ */ g(n_, {
|
|
12128
12146
|
headshot: o,
|
|
12129
12147
|
name: y,
|
|
12130
12148
|
size: 116,
|
|
@@ -12179,7 +12197,7 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
12179
12197
|
transition: "all 0.2s ease"
|
|
12180
12198
|
},
|
|
12181
12199
|
"aria-label": i ? "Unmute" : "Mute",
|
|
12182
|
-
children: [g(i ?
|
|
12200
|
+
children: [g(i ? bg : lg, { size: 18 }), i ? "Unmute" : "Mute"]
|
|
12183
12201
|
}), /* @__PURE__ */ _("button", {
|
|
12184
12202
|
type: "button",
|
|
12185
12203
|
onClick: u,
|
|
@@ -12207,15 +12225,15 @@ function n_({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
|
|
|
12207
12225
|
e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
|
|
12208
12226
|
},
|
|
12209
12227
|
"aria-label": "End call",
|
|
12210
|
-
children: [/* @__PURE__ */ g(
|
|
12228
|
+
children: [/* @__PURE__ */ g(ug, { size: 18 }), "End Call"]
|
|
12211
12229
|
})]
|
|
12212
12230
|
})
|
|
12213
12231
|
]
|
|
12214
12232
|
});
|
|
12215
12233
|
}
|
|
12216
|
-
function
|
|
12234
|
+
function a_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
|
|
12217
12235
|
let u = e || n || "Agent";
|
|
12218
|
-
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children:
|
|
12236
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: Qg }), /* @__PURE__ */ _("div", {
|
|
12219
12237
|
role: "button",
|
|
12220
12238
|
tabIndex: 0,
|
|
12221
12239
|
onClick: c,
|
|
@@ -12272,7 +12290,7 @@ function r_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
|
|
|
12272
12290
|
borderRadius: "50%",
|
|
12273
12291
|
border: `1.5px solid ${l}55`
|
|
12274
12292
|
} }),
|
|
12275
|
-
/* @__PURE__ */ g(
|
|
12293
|
+
/* @__PURE__ */ g(n_, {
|
|
12276
12294
|
headshot: t,
|
|
12277
12295
|
name: u,
|
|
12278
12296
|
size: 38,
|
|
@@ -12356,7 +12374,7 @@ function r_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
|
|
|
12356
12374
|
boxShadow: i ? `0 0 0 3px ${l}12` : "none"
|
|
12357
12375
|
},
|
|
12358
12376
|
"aria-label": i ? "Unmute" : "Mute",
|
|
12359
|
-
children: g(i ?
|
|
12377
|
+
children: g(i ? bg : lg, { size: 15 })
|
|
12360
12378
|
}), /* @__PURE__ */ g("button", {
|
|
12361
12379
|
type: "button",
|
|
12362
12380
|
onClick: (e) => {
|
|
@@ -12384,7 +12402,7 @@ function r_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
|
|
|
12384
12402
|
transition: "all 0.18s ease"
|
|
12385
12403
|
},
|
|
12386
12404
|
"aria-label": "End call",
|
|
12387
|
-
children: /* @__PURE__ */ g(
|
|
12405
|
+
children: /* @__PURE__ */ g(ug, { size: 16 })
|
|
12388
12406
|
})]
|
|
12389
12407
|
})
|
|
12390
12408
|
]
|
|
@@ -12392,7 +12410,7 @@ function r_({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
|
|
|
12392
12410
|
}
|
|
12393
12411
|
//#endregion
|
|
12394
12412
|
//#region src/utils/voicePriorContext.js
|
|
12395
|
-
function
|
|
12413
|
+
function o_(e, t = {}) {
|
|
12396
12414
|
let n = t.maxChars ?? 4500;
|
|
12397
12415
|
if (!Array.isArray(e) || e.length === 0) return "";
|
|
12398
12416
|
let r = [];
|
|
@@ -12409,24 +12427,24 @@ function i_(e, t = {}) {
|
|
|
12409
12427
|
}
|
|
12410
12428
|
//#endregion
|
|
12411
12429
|
//#region src/utils/voiceClientTools.js
|
|
12412
|
-
var
|
|
12413
|
-
function
|
|
12414
|
-
return String(e || "").replace(
|
|
12430
|
+
var s_ = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
|
|
12431
|
+
function c_(e) {
|
|
12432
|
+
return String(e || "").replace(s_, "").replace(/\/+$/, "").toLowerCase() || "/";
|
|
12415
12433
|
}
|
|
12416
|
-
function
|
|
12417
|
-
return
|
|
12434
|
+
function l_(e, t) {
|
|
12435
|
+
return c_(e) === c_(t);
|
|
12418
12436
|
}
|
|
12419
12437
|
function $(...e) {
|
|
12420
12438
|
An() && console.log("[FlowEngage:voice-tools]", ...e);
|
|
12421
12439
|
}
|
|
12422
|
-
function
|
|
12440
|
+
function u_(e) {
|
|
12423
12441
|
try {
|
|
12424
12442
|
let t = e.ownerDocument?.defaultView;
|
|
12425
12443
|
if (t) return t.getComputedStyle(e);
|
|
12426
12444
|
} catch {}
|
|
12427
12445
|
return window.getComputedStyle(e);
|
|
12428
12446
|
}
|
|
12429
|
-
function
|
|
12447
|
+
function d_(e) {
|
|
12430
12448
|
let t = /* @__PURE__ */ new Set();
|
|
12431
12449
|
function n(r) {
|
|
12432
12450
|
if (!r || t.has(r)) return;
|
|
@@ -12439,10 +12457,10 @@ function l_(e) {
|
|
|
12439
12457
|
}
|
|
12440
12458
|
typeof document < "u" && n(document);
|
|
12441
12459
|
}
|
|
12442
|
-
function
|
|
12460
|
+
function f_(e) {
|
|
12443
12461
|
return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
|
|
12444
12462
|
}
|
|
12445
|
-
function
|
|
12463
|
+
function p_(e) {
|
|
12446
12464
|
let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
|
|
12447
12465
|
if (n) {
|
|
12448
12466
|
let e = n.trim().split(/\s+/).filter(Boolean), r = [];
|
|
@@ -12450,40 +12468,40 @@ function d_(e) {
|
|
|
12450
12468
|
let e = t.getElementById(n);
|
|
12451
12469
|
e?.textContent && r.push(e.textContent.trim());
|
|
12452
12470
|
} catch {}
|
|
12453
|
-
if (r.length) return
|
|
12471
|
+
if (r.length) return f_(r.join(" "));
|
|
12454
12472
|
}
|
|
12455
|
-
if (e.labels && e.labels.length) return
|
|
12473
|
+
if (e.labels && e.labels.length) return f_(e.labels[0].textContent);
|
|
12456
12474
|
let r = e.id;
|
|
12457
12475
|
if (r) try {
|
|
12458
12476
|
let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
|
|
12459
|
-
if (e) return
|
|
12477
|
+
if (e) return f_(e.textContent);
|
|
12460
12478
|
} catch {
|
|
12461
12479
|
let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
|
|
12462
|
-
if (e) return
|
|
12480
|
+
if (e) return f_(e.textContent);
|
|
12463
12481
|
}
|
|
12464
12482
|
let i = e.previousElementSibling;
|
|
12465
12483
|
for (let e = 0; e < 6 && i; e += 1) {
|
|
12466
|
-
if (i.tagName === "LABEL") return
|
|
12484
|
+
if (i.tagName === "LABEL") return f_(i.textContent);
|
|
12467
12485
|
let e = (i.className || "").toString().toLowerCase();
|
|
12468
12486
|
if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
|
|
12469
|
-
let e =
|
|
12487
|
+
let e = f_(i.textContent);
|
|
12470
12488
|
if (e) return e;
|
|
12471
12489
|
}
|
|
12472
12490
|
i = i.previousElementSibling;
|
|
12473
12491
|
}
|
|
12474
12492
|
let a = e.parentElement;
|
|
12475
12493
|
for (let e = 0; e < 5 && a; e += 1) {
|
|
12476
|
-
if (a.tagName === "LABEL") return
|
|
12494
|
+
if (a.tagName === "LABEL") return f_(a.textContent);
|
|
12477
12495
|
let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
|
|
12478
|
-
if (e?.textContent) return
|
|
12496
|
+
if (e?.textContent) return f_(e.textContent);
|
|
12479
12497
|
a = a.parentElement;
|
|
12480
12498
|
}
|
|
12481
12499
|
let o = e.getAttribute("aria-label");
|
|
12482
|
-
return o ?
|
|
12500
|
+
return o ? f_(o) : null;
|
|
12483
12501
|
}
|
|
12484
|
-
function
|
|
12502
|
+
function m_() {
|
|
12485
12503
|
let e = [];
|
|
12486
|
-
return
|
|
12504
|
+
return d_((t) => {
|
|
12487
12505
|
e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
|
|
12488
12506
|
if (In(e)) return !1;
|
|
12489
12507
|
let t = (e.type || "").toLowerCase();
|
|
@@ -12494,15 +12512,15 @@ function f_() {
|
|
|
12494
12512
|
"image"
|
|
12495
12513
|
].includes(t) || e.disabled || e.readOnly) return !1;
|
|
12496
12514
|
try {
|
|
12497
|
-
let t =
|
|
12515
|
+
let t = u_(e);
|
|
12498
12516
|
if (t.display === "none" || t.visibility === "hidden") return !1;
|
|
12499
12517
|
} catch {}
|
|
12500
12518
|
return !0;
|
|
12501
12519
|
}));
|
|
12502
12520
|
}), e;
|
|
12503
12521
|
}
|
|
12504
|
-
function
|
|
12505
|
-
return
|
|
12522
|
+
function h_() {
|
|
12523
|
+
return m_().map((e, t) => {
|
|
12506
12524
|
let n = {
|
|
12507
12525
|
formIndex: 0,
|
|
12508
12526
|
fieldIndex: t,
|
|
@@ -12510,7 +12528,7 @@ function p_() {
|
|
|
12510
12528
|
type: e.type || "text",
|
|
12511
12529
|
name: e.name || null,
|
|
12512
12530
|
id: e.id || null,
|
|
12513
|
-
label:
|
|
12531
|
+
label: p_(e),
|
|
12514
12532
|
placeholder: e.placeholder || null
|
|
12515
12533
|
};
|
|
12516
12534
|
return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
|
|
@@ -12519,13 +12537,13 @@ function p_() {
|
|
|
12519
12537
|
})), n.currentValue = e.value || null), n;
|
|
12520
12538
|
});
|
|
12521
12539
|
}
|
|
12522
|
-
function
|
|
12540
|
+
function g_() {
|
|
12523
12541
|
let e = [];
|
|
12524
|
-
return
|
|
12542
|
+
return d_((t) => {
|
|
12525
12543
|
e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
|
|
12526
12544
|
if (In(e) || e.disabled) return !1;
|
|
12527
12545
|
try {
|
|
12528
|
-
let t =
|
|
12546
|
+
let t = u_(e);
|
|
12529
12547
|
if (t.display === "none" || t.visibility === "hidden") return !1;
|
|
12530
12548
|
} catch {}
|
|
12531
12549
|
return !0;
|
|
@@ -12537,7 +12555,7 @@ function m_() {
|
|
|
12537
12555
|
type: e.type || e.tagName
|
|
12538
12556
|
}));
|
|
12539
12557
|
}
|
|
12540
|
-
function
|
|
12558
|
+
function __(e, t) {
|
|
12541
12559
|
try {
|
|
12542
12560
|
if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
|
|
12543
12561
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
|
|
@@ -12552,7 +12570,7 @@ function h_(e, t) {
|
|
|
12552
12570
|
return Infinity;
|
|
12553
12571
|
}
|
|
12554
12572
|
}
|
|
12555
|
-
function
|
|
12573
|
+
function v_(e, t) {
|
|
12556
12574
|
let n = String(t || "").toLowerCase().trim();
|
|
12557
12575
|
if (!n) return 0;
|
|
12558
12576
|
let r = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim(), i = [
|
|
@@ -12570,21 +12588,21 @@ function g_(e, t) {
|
|
|
12570
12588
|
for (let e of a) i.includes(e) && (o += 1);
|
|
12571
12589
|
return o / a.length * 92;
|
|
12572
12590
|
}
|
|
12573
|
-
function
|
|
12591
|
+
function y_(e, t, n = 6) {
|
|
12574
12592
|
let r = String(t || "").toLowerCase().trim();
|
|
12575
12593
|
if (!r) return !1;
|
|
12576
12594
|
let i = e;
|
|
12577
12595
|
for (let e = 0; e < n && i && (i = i.parentElement, i); e++) if ((i.innerText || i.textContent || "").toLowerCase().includes(r)) return !0;
|
|
12578
12596
|
return !1;
|
|
12579
12597
|
}
|
|
12580
|
-
function
|
|
12598
|
+
function b_(e, t, n) {
|
|
12581
12599
|
let r = [];
|
|
12582
|
-
|
|
12600
|
+
d_((e) => {
|
|
12583
12601
|
let t = Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], a[href]"));
|
|
12584
12602
|
r.push(...t.filter((e) => {
|
|
12585
12603
|
if (In(e) || e.disabled) return !1;
|
|
12586
12604
|
try {
|
|
12587
|
-
let t =
|
|
12605
|
+
let t = u_(e);
|
|
12588
12606
|
if (t.display === "none" || t.visibility === "hidden" || t.opacity === "0") return !1;
|
|
12589
12607
|
} catch {}
|
|
12590
12608
|
return !0;
|
|
@@ -12592,14 +12610,14 @@ function v_(e, t, n) {
|
|
|
12592
12610
|
});
|
|
12593
12611
|
let i = 0, a = r.map((t) => ({
|
|
12594
12612
|
el: t,
|
|
12595
|
-
s:
|
|
12613
|
+
s: v_(t, e)
|
|
12596
12614
|
}));
|
|
12597
12615
|
for (let { s: e } of a) e > i && (i = e);
|
|
12598
12616
|
if (i < 28) return null;
|
|
12599
12617
|
let o = a.filter(({ s: e }) => e === i).map(({ el: e }) => e);
|
|
12600
12618
|
if (o.length === 1) return o[0];
|
|
12601
12619
|
if (n) {
|
|
12602
|
-
let e = o.filter((e) =>
|
|
12620
|
+
let e = o.filter((e) => y_(e, n));
|
|
12603
12621
|
if (e.length === 1) return e[0];
|
|
12604
12622
|
e.length > 1 && (o = e);
|
|
12605
12623
|
}
|
|
@@ -12607,14 +12625,14 @@ function v_(e, t, n) {
|
|
|
12607
12625
|
if (s.length) {
|
|
12608
12626
|
let e = o[0], t = Infinity;
|
|
12609
12627
|
for (let n of o) for (let r of s) {
|
|
12610
|
-
let i =
|
|
12628
|
+
let i = __(n, r);
|
|
12611
12629
|
i < t && (t = i, e = n);
|
|
12612
12630
|
}
|
|
12613
12631
|
return e;
|
|
12614
12632
|
}
|
|
12615
12633
|
return o[0];
|
|
12616
12634
|
}
|
|
12617
|
-
function
|
|
12635
|
+
function x_(e) {
|
|
12618
12636
|
if (e == null) return {};
|
|
12619
12637
|
if (typeof e == "string") {
|
|
12620
12638
|
let t = e.trim();
|
|
@@ -12627,12 +12645,12 @@ function y_(e) {
|
|
|
12627
12645
|
}
|
|
12628
12646
|
return e;
|
|
12629
12647
|
}
|
|
12630
|
-
function
|
|
12648
|
+
function S_(e) {
|
|
12631
12649
|
if (!e || typeof e != "object") return null;
|
|
12632
12650
|
let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
|
|
12633
12651
|
return t == null ? null : String(t).trim() || null;
|
|
12634
12652
|
}
|
|
12635
|
-
function
|
|
12653
|
+
function C_() {
|
|
12636
12654
|
let e = {};
|
|
12637
12655
|
document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
|
|
12638
12656
|
if (t.id) return;
|
|
@@ -12647,7 +12665,7 @@ function x_() {
|
|
|
12647
12665
|
e[r] = !0, t.id = r;
|
|
12648
12666
|
});
|
|
12649
12667
|
}
|
|
12650
|
-
function
|
|
12668
|
+
function w_() {
|
|
12651
12669
|
let e = (e) => {
|
|
12652
12670
|
let t = Array.from(e).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root") && !e.closest("nav, footer, header, aside, .nav, .footer, .header, .sidebar")), n = [], r = 0;
|
|
12653
12671
|
for (; r < t.length;) {
|
|
@@ -12702,7 +12720,7 @@ function S_() {
|
|
|
12702
12720
|
containerHeadings: o
|
|
12703
12721
|
};
|
|
12704
12722
|
}
|
|
12705
|
-
function
|
|
12723
|
+
function T_(e) {
|
|
12706
12724
|
if (!e || typeof document > "u") return "";
|
|
12707
12725
|
let t = new Set([
|
|
12708
12726
|
"script",
|
|
@@ -12788,11 +12806,11 @@ function C_(e) {
|
|
|
12788
12806
|
return d.has(t) ? !1 : (d.add(t), !0);
|
|
12789
12807
|
}).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
12790
12808
|
}
|
|
12791
|
-
function
|
|
12809
|
+
function E_(e) {
|
|
12792
12810
|
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = typeof e.beaconSyncFullVoiceHistory == "function" ? e.beaconSyncFullVoiceHistory : null, a = [], o = {
|
|
12793
12811
|
"fwh-navigate-mvp": async (n) => {
|
|
12794
12812
|
if ($("fwh-navigate-mvp ▶ raw parameters:", n), e?.isWalkthroughActive?.()) return $("fwh-navigate-mvp ✖ blocked — walkthrough in progress"), "NAVIGATION_BLOCKED_DURING_WALKTHROUGH. A walkthrough of the current page is in progress, so navigation is not allowed. Do NOT tell the visitor you navigated or offer to. Describe the requested section using the CURRENT page's own content (fwh-read-content-mvp), then stop.";
|
|
12795
|
-
let a =
|
|
12813
|
+
let a = x_(n), o = S_(a), s = a.section_text ?? a.sectionText ?? a.section, c = Array.isArray(a.expected_landmarks) ? a.expected_landmarks : Array.isArray(a.expectedLandmarks) ? a.expectedLandmarks : [];
|
|
12796
12814
|
if ($("fwh-navigate-mvp · coerced:", {
|
|
12797
12815
|
url: o,
|
|
12798
12816
|
sectionText: s,
|
|
@@ -12832,14 +12850,14 @@ function w_(e) {
|
|
|
12832
12850
|
correctedUrl: u
|
|
12833
12851
|
}), o = u);
|
|
12834
12852
|
try {
|
|
12835
|
-
Ph(`Navigating to ${o}...`, { spinner: !0 }),
|
|
12853
|
+
Ph(`Navigating to ${o}...`, { spinner: !0 }), Qh(), Pn();
|
|
12836
12854
|
try {
|
|
12837
12855
|
i?.();
|
|
12838
12856
|
} catch {}
|
|
12839
12857
|
try {
|
|
12840
12858
|
let e = r ? r() : "";
|
|
12841
12859
|
if (e && t) {
|
|
12842
|
-
let n =
|
|
12860
|
+
let n = o_([{
|
|
12843
12861
|
sender: "user",
|
|
12844
12862
|
message: e
|
|
12845
12863
|
}]);
|
|
@@ -12874,8 +12892,8 @@ function w_(e) {
|
|
|
12874
12892
|
typeof window < "u" && window.scrollTo(0, 0);
|
|
12875
12893
|
} catch {}
|
|
12876
12894
|
let a = [], s = null, c = "", l = Date.now() + 12e3;
|
|
12877
|
-
for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: a, pageTitleHeading: s, introText: c} =
|
|
12878
|
-
|
|
12895
|
+
for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: a, pageTitleHeading: s, introText: c} = w_(), !(a.length >= 1)););
|
|
12896
|
+
C_(), $("fwh-navigate-mvp → page headings collected:", a, "titleHeading:", s);
|
|
12879
12897
|
let u = a.length ? a.join(" | ") : "none", d = a.length ? "Use ONLY these exact heading strings for fwh-highlight-mvp — never invent or abbreviate." : "No headings collected yet — call fwh-get-current-page-mvp immediately (no speech) to get the live headings before speaking or highlighting.", f = s ? ` "${s}" is the PAGE TITLE, not a content section — do not fwh-highlight-mvp it separately; if doing a walkthrough, just fold this intro into your opening line: "${c || "(no intro text found)"}"` : c ? ` No separate page-title heading detected, but this intro text precedes the first section — mention it briefly before covering sections: "${c}"` : "", p = "";
|
|
12880
12898
|
try {
|
|
12881
12899
|
if (a.length > 0) {
|
|
@@ -12883,7 +12901,7 @@ function w_(e) {
|
|
|
12883
12901
|
for (let n of e) {
|
|
12884
12902
|
let e = mr(null, n);
|
|
12885
12903
|
if (e) {
|
|
12886
|
-
let r =
|
|
12904
|
+
let r = T_(e).substring(0, 800);
|
|
12887
12905
|
r && t.push(`[Section: ${n}] ${r}`);
|
|
12888
12906
|
}
|
|
12889
12907
|
}
|
|
@@ -12892,13 +12910,13 @@ function w_(e) {
|
|
|
12892
12910
|
} catch {}
|
|
12893
12911
|
if (Tr()) return Cr(), $("fwh-navigate-mvp ✖ landed on a not-found/404 page:", i), `NAVIGATION_PAGE_NOT_FOUND. The page at ${i} does not exist — it shows a "not found"/404 error, not real content. Do NOT offer a page overview, do NOT describe or highlight any sections, do NOT claim the navigation succeeded. Tell the visitor EXACTLY: "It looks like that page doesn't exist — I couldn't find it. Would you like me to take you somewhere else?" Then STOP and wait for their reply.`;
|
|
12894
12912
|
let m = Date.now() + 4e3, h = typeof window < "u" ? window.location.pathname : r;
|
|
12895
|
-
for (; Date.now() < m && !
|
|
12913
|
+
for (; Date.now() < m && !l_(h, e) && l_(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
|
|
12896
12914
|
$("fwh-navigate-mvp route settle:", {
|
|
12897
12915
|
startPath: t,
|
|
12898
12916
|
targetPath: e,
|
|
12899
12917
|
settledPath: h
|
|
12900
12918
|
});
|
|
12901
|
-
let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v =
|
|
12919
|
+
let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = l_(h, e), y = !l_(h, t), b = v || y;
|
|
12902
12920
|
return $("fwh-navigate-mvp settled:", h, "target:", e, "match:", b), b ? (Cr(), `OK_NAVIGATE_SPA. Visitor is now on: ${g} (page: "${_}") | Section headings: ${u}.${f} ${d}${p} Now confirm the arrival in ONE short sentence phrased for what the visitor actually asked for — mention the page by name and what it lets them do (e.g. for a contact request: "I've taken you to the Contact Us page — filling in this form sends your query straight to our team."). Do NOT use a fixed template. Then, in the same breath, offer either a specific section or a full overview. Then STOP — wait for their reply.`) : (Cr(), `NAVIGATION_DID_NOT_HAPPEN. The visitor is STILL on ${g} (page: "${_}") — the navigation did not go through. Do NOT say "I have navigated you". Do NOT claim success. Tell the visitor EXACTLY: "Sorry, I couldn't open that page just now. Would you like me to try again, or is there something else I can help with?" Then STOP and wait for their reply.`);
|
|
12903
12921
|
} catch {}
|
|
12904
12922
|
return "OK_NAVIGATE_RELOADING. The page is reloading now and this session is ending. Say NOTHING further — do not confirm the navigation, do not describe the page. The arrival greeting is spoken automatically on the new page; you resume from the visitor's next reply.";
|
|
@@ -12910,39 +12928,39 @@ function w_(e) {
|
|
|
12910
12928
|
duration: 1800
|
|
12911
12929
|
}), t;
|
|
12912
12930
|
} finally {
|
|
12913
|
-
|
|
12931
|
+
$h(), Fh(900);
|
|
12914
12932
|
}
|
|
12915
12933
|
},
|
|
12916
12934
|
"fwh-highlight-mvp": async (e) => {
|
|
12917
12935
|
$("fwh-highlight-mvp ▶", e);
|
|
12918
|
-
let t =
|
|
12936
|
+
let t = x_(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
|
|
12919
12937
|
if (Wn(3e3), typeof window < "u" && window.__fe_user_nav_during_speech) {
|
|
12920
12938
|
let e = window.__fe_user_nav_during_speech, t = window.location.pathname;
|
|
12921
12939
|
if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
|
|
12922
12940
|
else return $("flowengage_highlight ✖ blocked — user navigated during speech", e), `NAV_CHANGED: The visitor navigated from "${e.fromPageName}" to "${e.toPageName}" (current path: ${t}) while you were speaking. STOP the current walkthrough immediately. DO NOT call fwh-highlight-mvp again. Say out loud: "I see you've navigated to the ${e.toPageName} page — do you want me to continue what I was explaining, or shall I guide you through this page?" Wait for the visitor's answer before doing anything else.`;
|
|
12923
12941
|
}
|
|
12924
|
-
|
|
12942
|
+
C_();
|
|
12925
12943
|
let i = ((e) => e && e.replace(/^\d+\.\s*/, "").replace(/^["']|["']$/g, "").trim())(r), a = mr(n || null, i || null);
|
|
12926
12944
|
if (!a && i) {
|
|
12927
12945
|
let e = Date.now() + 600;
|
|
12928
|
-
for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)),
|
|
12946
|
+
for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), C_(), a = mr(null, i);
|
|
12929
12947
|
}
|
|
12930
12948
|
if (!a) {
|
|
12931
12949
|
$("fwh-highlight-mvp ✖ no element for:", i || n);
|
|
12932
|
-
let { headings: e } =
|
|
12950
|
+
let { headings: e } = w_(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
|
|
12933
12951
|
return `HIGHLIGHT_NOT_FOUND: "${i || n}" on the current page. ${t}`;
|
|
12934
12952
|
}
|
|
12935
12953
|
return Nn(a), $("fwh-highlight-mvp ✓", i || n), `OK_HIGHLIGHT: "${i || n}". Your NEXT response must be speech only (no tool call) describing THIS section — "${i || n}" — using its own content. Do not ask whether to continue.`;
|
|
12936
12954
|
},
|
|
12937
12955
|
"fwh-read-content-mvp": async (e) => {
|
|
12938
12956
|
$("fwh-read-content-mvp ▶", e);
|
|
12939
|
-
let t =
|
|
12957
|
+
let t = x_(e), n = t?.section_text || t?.sectionText || "";
|
|
12940
12958
|
try {
|
|
12941
12959
|
let e = "";
|
|
12942
12960
|
if (n) {
|
|
12943
12961
|
let t = mr(null, n);
|
|
12944
12962
|
if (!t) return `Could not find section "${n}" on the page.`;
|
|
12945
|
-
e =
|
|
12963
|
+
e = T_(t);
|
|
12946
12964
|
} else {
|
|
12947
12965
|
let t = (document.querySelector("main") || document.querySelector("article") || document.querySelector("[role=\"main\"]") || document.querySelector("#content") || document.querySelector(".content") || document.body).cloneNode(!0);
|
|
12948
12966
|
t.querySelectorAll("nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar, #flowengage-root, .flowengage-shell, .flowengage-widget-root").forEach((e) => e.remove()), e = t.textContent.replace(/\s+/g, " ").trim();
|
|
@@ -12954,7 +12972,7 @@ function w_(e) {
|
|
|
12954
12972
|
},
|
|
12955
12973
|
"fwh-page-content-mvp": async (e) => {
|
|
12956
12974
|
$("fwh-page-content-mvp ▶", e);
|
|
12957
|
-
let r =
|
|
12975
|
+
let r = x_(e), i = r?.url || r?.page_url || "";
|
|
12958
12976
|
if ($("fwh-page-content-mvp · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("fwh-page-content-mvp ✖ missing url"), "Missing url parameter.";
|
|
12959
12977
|
if (!t) return $("fwh-page-content-mvp ✖ no siteId"), "Site is not configured.";
|
|
12960
12978
|
if (!n) return $("fwh-page-content-mvp ✖ no api base"), "API base URL is missing; cannot fetch page content.";
|
|
@@ -12986,7 +13004,7 @@ function w_(e) {
|
|
|
12986
13004
|
},
|
|
12987
13005
|
"fwh-search-mvp": async (e) => {
|
|
12988
13006
|
$("fwh-search-mvp ▶", e);
|
|
12989
|
-
let r =
|
|
13007
|
+
let r = x_(e).query;
|
|
12990
13008
|
if (!r) return $("fwh-search-mvp ✖ missing query"), "Missing query parameter.";
|
|
12991
13009
|
if (!t) return $("fwh-search-mvp ✖ no siteId"), "Search unavailable (no siteId configured).";
|
|
12992
13010
|
if (!n) return $("fwh-search-mvp ✖ no api base"), "Search unavailable (no API base URL).";
|
|
@@ -13024,7 +13042,7 @@ function w_(e) {
|
|
|
13024
13042
|
"[class*='menu'] a",
|
|
13025
13043
|
"[class*='header'] a"
|
|
13026
13044
|
];
|
|
13027
|
-
if (
|
|
13045
|
+
if (d_((t) => {
|
|
13028
13046
|
for (let r of n) try {
|
|
13029
13047
|
t.querySelectorAll(r).forEach((t) => {
|
|
13030
13048
|
if (In(t)) return;
|
|
@@ -13032,7 +13050,7 @@ function w_(e) {
|
|
|
13032
13050
|
if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
|
|
13033
13051
|
try {
|
|
13034
13052
|
let e = t.parentElement;
|
|
13035
|
-
if (e &&
|
|
13053
|
+
if (e && u_(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
|
|
13036
13054
|
} catch {}
|
|
13037
13055
|
let i = r.toLowerCase() + "|" + n;
|
|
13038
13056
|
e.has(i) || e.set(i, {
|
|
@@ -13043,7 +13061,7 @@ function w_(e) {
|
|
|
13043
13061
|
} catch {}
|
|
13044
13062
|
t.querySelectorAll("select").forEach((t) => {
|
|
13045
13063
|
if (In(t)) return;
|
|
13046
|
-
let n =
|
|
13064
|
+
let n = p_(t);
|
|
13047
13065
|
/nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
|
|
13048
13066
|
if (!r.value || r.disabled) return;
|
|
13049
13067
|
let i = r.text.trim();
|
|
@@ -13067,7 +13085,7 @@ function w_(e) {
|
|
|
13067
13085
|
if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
|
|
13068
13086
|
let e = window.location.href, t = window.location.pathname, n = document.title || "";
|
|
13069
13087
|
if (Tr()) return $("fwh-get-current-page-mvp ✓ 404 detected", { url: e }), `CURRENT_PAGE_NOT_FOUND. The visitor is currently on a 404 / page-not-found error page (${e}). There is no real content here. Do NOT describe this page, do NOT list sections, do NOT offer a walkthrough, and do NOT describe it from your own knowledge. Tell the visitor plainly that the page they are on doesn't exist, and offer to take them somewhere that does.`;
|
|
13070
|
-
let { headings: r, pageTitleHeading: i, introText: a } =
|
|
13088
|
+
let { headings: r, pageTitleHeading: i, introText: a } = w_();
|
|
13071
13089
|
$("fwh-get-current-page-mvp ✓", {
|
|
13072
13090
|
url: e,
|
|
13073
13091
|
path: t,
|
|
@@ -13079,7 +13097,7 @@ function w_(e) {
|
|
|
13079
13097
|
return `CURRENT_PAGE. URL: ${e} | Title: ${n} | Page sections (${r.length} total): ${s}.${o} *** WALKTHROUGH: do NOT drive it yourself. Do not call fwh-highlight-mvp and do not decide the order — highlighting and section order are handled for you. You will be told which section to describe, one at a time. When told, describe ONLY that section in 3-4 sentences and then stop; never announce another section, never ask whether to continue. ***`;
|
|
13080
13098
|
},
|
|
13081
13099
|
"fwh-list-forms-mvp": async () => {
|
|
13082
|
-
let e =
|
|
13100
|
+
let e = h_(), t = g_();
|
|
13083
13101
|
$("fwh-list-forms-mvp ✓", `${e.length} field(s)`, `${t.length} button(s)`);
|
|
13084
13102
|
let n = e.map((e) => ({
|
|
13085
13103
|
...e,
|
|
@@ -13093,9 +13111,9 @@ function w_(e) {
|
|
|
13093
13111
|
},
|
|
13094
13112
|
"fwh-fill-form-mvp": async () => "FORM_FILLING_DISABLED: Form filling is not available at this time. Tell the visitor what fields are present (use fwh-list-forms-mvp) and ask them to fill the form themselves.",
|
|
13095
13113
|
"fwh-click-button-mvp": async (e) => {
|
|
13096
|
-
let t =
|
|
13114
|
+
let t = x_(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
|
|
13097
13115
|
if ($("fwh-click-button-mvp ▶", n, r ? `(card_context: ${r})` : ""), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
|
|
13098
|
-
let i =
|
|
13116
|
+
let i = b_(n, a, r);
|
|
13099
13117
|
if (!i) return $("fwh-click-button-mvp ✖ no match"), `Could not find a button matching "${n}". Call fwh-list-forms-mvp to see button texts.`;
|
|
13100
13118
|
try {
|
|
13101
13119
|
Ph(`Clicking ${n}...`, { spinner: !0 });
|
|
@@ -13107,7 +13125,7 @@ function w_(e) {
|
|
|
13107
13125
|
} catch {
|
|
13108
13126
|
i.scrollIntoView(!0);
|
|
13109
13127
|
}
|
|
13110
|
-
await
|
|
13128
|
+
await ig(i), i.focus?.(), await og(i), sg(i), i.click();
|
|
13111
13129
|
let e = (i.textContent || i.value || i.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
|
|
13112
13130
|
return $("fwh-click-button-mvp ✓", t), Ph(`Clicked ${e}`, {
|
|
13113
13131
|
spinner: !1,
|
|
@@ -13122,7 +13140,7 @@ function w_(e) {
|
|
|
13122
13140
|
duration: 1800
|
|
13123
13141
|
}), t;
|
|
13124
13142
|
} finally {
|
|
13125
|
-
|
|
13143
|
+
ag(), Fh(700);
|
|
13126
13144
|
}
|
|
13127
13145
|
},
|
|
13128
13146
|
"fwh-cart-get-mvp": async () => {
|
|
@@ -13235,10 +13253,10 @@ function w_(e) {
|
|
|
13235
13253
|
clickPageButton: o["fwh-click-button-mvp"]
|
|
13236
13254
|
};
|
|
13237
13255
|
}
|
|
13238
|
-
var
|
|
13239
|
-
function
|
|
13256
|
+
var D_ = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
|
|
13257
|
+
function O_() {
|
|
13240
13258
|
try {
|
|
13241
|
-
let { headings: e, pageTitleHeading: t, containerHeadings: n } =
|
|
13259
|
+
let { headings: e, pageTitleHeading: t, containerHeadings: n } = w_(), r = new Set((n || []).map((e) => e.trim())), i = (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !D_.test(e.trim())), a = i.filter((e) => !r.has(e.trim()));
|
|
13242
13260
|
return a.length ? a : i;
|
|
13243
13261
|
} catch {
|
|
13244
13262
|
return [];
|
|
@@ -13246,7 +13264,7 @@ function E_() {
|
|
|
13246
13264
|
}
|
|
13247
13265
|
//#endregion
|
|
13248
13266
|
//#region src/utils/wrapVoiceToolsForLogging.js
|
|
13249
|
-
function
|
|
13267
|
+
function k_(e) {
|
|
13250
13268
|
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
|
|
13251
13269
|
let r = An();
|
|
13252
13270
|
r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
|
|
@@ -13263,11 +13281,11 @@ function D_(e) {
|
|
|
13263
13281
|
}
|
|
13264
13282
|
//#endregion
|
|
13265
13283
|
//#region src/components/FlowEngageWidget.jsx
|
|
13266
|
-
var
|
|
13267
|
-
function
|
|
13268
|
-
return `${
|
|
13284
|
+
var A_ = "[PAGE_CONTEXT]";
|
|
13285
|
+
function j_(e, t, n) {
|
|
13286
|
+
return `${A_} SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${t || ""}. ${n ? `Forms: ${n}. ` : ""}The visitor is ALREADY on this page — do NOT offer to navigate there.`;
|
|
13269
13287
|
}
|
|
13270
|
-
var
|
|
13288
|
+
var M_ = {
|
|
13271
13289
|
blue: "#135bd8",
|
|
13272
13290
|
red: "#ef334b",
|
|
13273
13291
|
yellow: "#ffbd2e",
|
|
@@ -13275,7 +13293,7 @@ var A_ = {
|
|
|
13275
13293
|
highlight: "rgba(255,255,255,0.9)",
|
|
13276
13294
|
green: "#10b981"
|
|
13277
13295
|
};
|
|
13278
|
-
function
|
|
13296
|
+
function N_(e) {
|
|
13279
13297
|
if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
|
|
13280
13298
|
let [t, n, r] = e;
|
|
13281
13299
|
return e.length >= 3 && r ? [
|
|
@@ -13289,12 +13307,12 @@ function j_(e) {
|
|
|
13289
13307
|
"#f7f8fa"
|
|
13290
13308
|
].join(", ");
|
|
13291
13309
|
}
|
|
13292
|
-
function
|
|
13310
|
+
function P_(e) {
|
|
13293
13311
|
if (!e || typeof e != "string") return "#1a1a1a";
|
|
13294
13312
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16) / 255, a = parseInt(n.slice(4, 6), 16) / 255, o = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
13295
13313
|
return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
|
|
13296
13314
|
}
|
|
13297
|
-
function
|
|
13315
|
+
function F_(t) {
|
|
13298
13316
|
let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
|
|
13299
13317
|
return e.useEffect(() => {
|
|
13300
13318
|
if (!i) {
|
|
@@ -13312,8 +13330,8 @@ function N_(t) {
|
|
|
13312
13330
|
};
|
|
13313
13331
|
}, [i]), n;
|
|
13314
13332
|
}
|
|
13315
|
-
function
|
|
13316
|
-
let r =
|
|
13333
|
+
function I_({ logo: t, style: n }) {
|
|
13334
|
+
let r = F_(typeof t == "string" ? t : null);
|
|
13317
13335
|
if (!t) return null;
|
|
13318
13336
|
if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
|
|
13319
13337
|
src: r,
|
|
@@ -13338,7 +13356,7 @@ function P_({ logo: t, style: n }) {
|
|
|
13338
13356
|
children: i
|
|
13339
13357
|
}) : null;
|
|
13340
13358
|
}
|
|
13341
|
-
function
|
|
13359
|
+
function L_({ title: e }) {
|
|
13342
13360
|
return /* @__PURE__ */ g("div", {
|
|
13343
13361
|
style: {
|
|
13344
13362
|
width: "100%",
|
|
@@ -13356,18 +13374,18 @@ function F_({ title: e }) {
|
|
|
13356
13374
|
children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
|
|
13357
13375
|
});
|
|
13358
13376
|
}
|
|
13359
|
-
function
|
|
13377
|
+
function R_(e, t) {
|
|
13360
13378
|
let n = (t || "").trim();
|
|
13361
13379
|
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) || e === "bot" && (/\b(that'?s all|we'?re done)\b/i.test(n) || /\b(goodbye|bye)\b/i.test(n) || /\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))) : !1;
|
|
13362
13380
|
}
|
|
13363
|
-
function
|
|
13364
|
-
return /* @__PURE__ */ g(
|
|
13381
|
+
function z_({ orbColors: e, ...t }) {
|
|
13382
|
+
return /* @__PURE__ */ g(Zg, {
|
|
13365
13383
|
colors: e,
|
|
13366
13384
|
...t
|
|
13367
13385
|
});
|
|
13368
13386
|
}
|
|
13369
|
-
function
|
|
13370
|
-
let s = n ||
|
|
13387
|
+
function B_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
|
|
13388
|
+
let s = n || M_.green, c = P_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
|
|
13371
13389
|
style: {
|
|
13372
13390
|
display: "flex",
|
|
13373
13391
|
alignItems: a ? "flex-end" : "center",
|
|
@@ -13493,7 +13511,7 @@ function R_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
13493
13511
|
delay: 0
|
|
13494
13512
|
},
|
|
13495
13513
|
style: { flexShrink: 0 },
|
|
13496
|
-
children: /* @__PURE__ */ g(
|
|
13514
|
+
children: /* @__PURE__ */ g(z_, {
|
|
13497
13515
|
size: l,
|
|
13498
13516
|
orbColors: t
|
|
13499
13517
|
})
|
|
@@ -13525,8 +13543,8 @@ function R_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
13525
13543
|
children: u
|
|
13526
13544
|
})] });
|
|
13527
13545
|
}
|
|
13528
|
-
function
|
|
13529
|
-
let c = n ||
|
|
13546
|
+
function V_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
|
|
13547
|
+
let c = n || M_.green, l = P_(c);
|
|
13530
13548
|
return /* @__PURE__ */ _(oh.div, {
|
|
13531
13549
|
initial: {
|
|
13532
13550
|
scale: 50 / 350,
|
|
@@ -13597,7 +13615,7 @@ function z_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
13597
13615
|
children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
|
|
13598
13616
|
})
|
|
13599
13617
|
}),
|
|
13600
|
-
/* @__PURE__ */ g(
|
|
13618
|
+
/* @__PURE__ */ g(z_, {
|
|
13601
13619
|
size: 72,
|
|
13602
13620
|
orbColors: t
|
|
13603
13621
|
}),
|
|
@@ -13677,7 +13695,7 @@ function z_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
13677
13695
|
]
|
|
13678
13696
|
});
|
|
13679
13697
|
}
|
|
13680
|
-
function
|
|
13698
|
+
function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, beaconSyncVoiceTranscript: d, widgetPosition: f = "bottom-right", voiceEndCounter: h, websiteName: v, voiceFirstMessage: y, captureVisitorEmail: b, emailRequired: x, emailCaptureEnabled: S = !0, listeningLabel: C = "Listening...", thinkingLabel: w = "Thinking...", enterChatModeLabel: T = "Enter Chat Mode", endConversationLabel: E = "End Conversation" }) {
|
|
13681
13699
|
c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
|
|
13682
13700
|
let [D, O] = m("idle"), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(() => ce(i) === "auto"), M = () => {
|
|
13683
13701
|
let e = ne ? "ask" : "auto";
|
|
@@ -13764,7 +13782,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13764
13782
|
Pn();
|
|
13765
13783
|
} catch {}
|
|
13766
13784
|
try {
|
|
13767
|
-
|
|
13785
|
+
Jh();
|
|
13768
13786
|
} catch {}
|
|
13769
13787
|
if (i) try {
|
|
13770
13788
|
Le(i);
|
|
@@ -13812,7 +13830,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13812
13830
|
if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
|
|
13813
13831
|
l.current = [], Ce.current = "", Oe.current = !1, je.current = !1, Me.current = !1, Ne.current = "minimized", Nr({ onBeforeNavigate: () => {
|
|
13814
13832
|
if (i && l.current.length > 0) try {
|
|
13815
|
-
let e =
|
|
13833
|
+
let e = o_(l.current);
|
|
13816
13834
|
e && Te(i, e);
|
|
13817
13835
|
} catch {}
|
|
13818
13836
|
if (!$n()) {
|
|
@@ -13834,7 +13852,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13834
13852
|
}
|
|
13835
13853
|
ke();
|
|
13836
13854
|
} });
|
|
13837
|
-
let t =
|
|
13855
|
+
let t = k_(E_({
|
|
13838
13856
|
siteId: i || null,
|
|
13839
13857
|
apiBaseUrl: a || null,
|
|
13840
13858
|
chatId: s || null,
|
|
@@ -13896,7 +13914,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13896
13914
|
e || Ue("minimized");
|
|
13897
13915
|
},
|
|
13898
13916
|
onPanel: ({ title: t, items: n }) => {
|
|
13899
|
-
e ||
|
|
13917
|
+
e || Kh(n, {
|
|
13900
13918
|
title: t || "Products",
|
|
13901
13919
|
side: f === "bottom-left" ? "left" : "right",
|
|
13902
13920
|
productUrl: (e) => e.handle ? `${window.location.origin}/products/${encodeURIComponent(e.handle)}` : null
|
|
@@ -13958,8 +13976,12 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13958
13976
|
},
|
|
13959
13977
|
onMessage: (t) => {
|
|
13960
13978
|
if (e || pe.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
|
|
13961
|
-
let n = t.role === "user" && /^(Describe the section titled "|\[SYSTEM:|Give the visitor a complete spoken overview|That was the last section)/.test(String(t.message || "").trim())
|
|
13962
|
-
if (
|
|
13979
|
+
let n = t.role === "user" && /^(Describe the section titled "|\[SYSTEM:|Give the visitor a complete spoken overview|That was the last section)/.test(String(t.message || "").trim());
|
|
13980
|
+
if (t.role === "user" && !n) try {
|
|
13981
|
+
Jh();
|
|
13982
|
+
} catch {}
|
|
13983
|
+
let r = /\b(?:this|that|the)\s+(?:case\s*stud(?:y|ies)|product|article|blog|post|item|service)\b/i.test(String(t.message || ""));
|
|
13984
|
+
if (!n && !r && t.role === "user" && We.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), I(!0), ge.current = !1, me.current = 0, L.current = -1, ve.current = O_(), ye.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => xe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${ve.current.length} sections on this page`);
|
|
13963
13985
|
else if (!n && t.role === "user" && he.current) {
|
|
13964
13986
|
let e = String(t.message || "").trim(), n = Ye(e), r = (e) => !!e && (Ke.test(e) || Je.test(e));
|
|
13965
13987
|
qe.test(be.current || "") ? (console.log("[FlowEngage] walkthrough ended — visitor accepted a navigation offer"), ye.current = null, ve.current = [], I(!1)) : !n || r(e) || r(n) ? ge.current && (ge.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => xe.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), ye.current = null, ve.current = [], I(!1));
|
|
@@ -13976,10 +13998,10 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13976
13998
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13977
13999
|
debug: t.debug
|
|
13978
14000
|
}], i) try {
|
|
13979
|
-
let e =
|
|
14001
|
+
let e = o_(l.current);
|
|
13980
14002
|
e && Te(i, e);
|
|
13981
14003
|
} catch {}
|
|
13982
|
-
if (
|
|
14004
|
+
if (R_(a, o)) {
|
|
13983
14005
|
ze.current = !0;
|
|
13984
14006
|
return;
|
|
13985
14007
|
}
|
|
@@ -14039,7 +14061,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14039
14061
|
n.length || (n = Array.from(document.body.querySelectorAll("h1, h2, h3")).filter((t) => !t.closest(e)).map((e) => e.textContent.replace(/\s+/g, " ").trim()).filter((e) => e.length > 2 && e.length < 200)), n.length && (o = [...new Set(n)].slice(0, 15).join(" | "));
|
|
14040
14062
|
} catch {}
|
|
14041
14063
|
let s = r && !m ? `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${n?.transcript || ""}\n\n` : "";
|
|
14042
|
-
ue.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${x ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`), ue.sendContextualUpdate(
|
|
14064
|
+
ue.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${x ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`), ue.sendContextualUpdate(j_(e, o, a));
|
|
14043
14065
|
} catch {}
|
|
14044
14066
|
if (typeof window < "u") {
|
|
14045
14067
|
let t = window.location.pathname, n = Date.now(), r = (e) => {
|
|
@@ -14075,7 +14097,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14075
14097
|
} catch {}
|
|
14076
14098
|
else console.log("[FlowEngage] auto-nav — skipping the arrival acknowledgment turn");
|
|
14077
14099
|
try {
|
|
14078
|
-
R.current?.sendContextualUpdate?.(
|
|
14100
|
+
R.current?.sendContextualUpdate?.(j_(l, f));
|
|
14079
14101
|
} catch {}
|
|
14080
14102
|
return;
|
|
14081
14103
|
}
|
|
@@ -14090,7 +14112,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14090
14112
|
R.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${h}" page (${l}). Page title: "${u}". Sections: ${JSON.stringify(d)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${h} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call fwh-navigate-mvp, do NOT call fwh-highlight-mvp, the visitor will navigate themselves if needed. IF I want to hear about this page: call fwh-highlight-mvp for sections of "${h}" only.]`);
|
|
14091
14113
|
} catch {}
|
|
14092
14114
|
try {
|
|
14093
|
-
R.current?.sendContextualUpdate?.(
|
|
14115
|
+
R.current?.sendContextualUpdate?.(j_(l, f));
|
|
14094
14116
|
} catch {}
|
|
14095
14117
|
};
|
|
14096
14118
|
c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
|
|
@@ -14302,7 +14324,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14302
14324
|
},
|
|
14303
14325
|
children: "Muted"
|
|
14304
14326
|
}),
|
|
14305
|
-
/* @__PURE__ */ g(
|
|
14327
|
+
/* @__PURE__ */ g(z_, {
|
|
14306
14328
|
size: 72,
|
|
14307
14329
|
voiceState: D,
|
|
14308
14330
|
isMuted: k,
|
|
@@ -14374,7 +14396,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14374
14396
|
y2: "23"
|
|
14375
14397
|
})
|
|
14376
14398
|
]
|
|
14377
|
-
}) : /* @__PURE__ */ g(
|
|
14399
|
+
}) : /* @__PURE__ */ g(lg, {
|
|
14378
14400
|
size: 16,
|
|
14379
14401
|
color: "currentColor"
|
|
14380
14402
|
})
|
|
@@ -14396,7 +14418,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14396
14418
|
padding: 0,
|
|
14397
14419
|
flexShrink: 0
|
|
14398
14420
|
},
|
|
14399
|
-
children: /* @__PURE__ */ g(
|
|
14421
|
+
children: /* @__PURE__ */ g(_g, {
|
|
14400
14422
|
size: 16,
|
|
14401
14423
|
color: "currentColor"
|
|
14402
14424
|
})
|
|
@@ -14445,7 +14467,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14445
14467
|
onMouseLeave: (e) => {
|
|
14446
14468
|
e.currentTarget.style.background = "none";
|
|
14447
14469
|
},
|
|
14448
|
-
children: [/* @__PURE__ */ g(
|
|
14470
|
+
children: [/* @__PURE__ */ g(vg, {}), T]
|
|
14449
14471
|
}),
|
|
14450
14472
|
i && /* @__PURE__ */ _("button", {
|
|
14451
14473
|
onClick: () => M(),
|
|
@@ -14549,7 +14571,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14549
14571
|
onMouseLeave: (e) => {
|
|
14550
14572
|
e.currentTarget.style.background = "none";
|
|
14551
14573
|
},
|
|
14552
|
-
children: [/* @__PURE__ */ g(
|
|
14574
|
+
children: [/* @__PURE__ */ g(yg, {}), E]
|
|
14553
14575
|
}),
|
|
14554
14576
|
/* @__PURE__ */ g("button", {
|
|
14555
14577
|
onClick: () => te(!1),
|
|
@@ -14601,7 +14623,7 @@ function B_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14601
14623
|
]
|
|
14602
14624
|
});
|
|
14603
14625
|
}
|
|
14604
|
-
function
|
|
14626
|
+
function U_({ orbColors: e }) {
|
|
14605
14627
|
let t = Array.isArray(e) && e.length > 0 ? e : [
|
|
14606
14628
|
"#135bd8",
|
|
14607
14629
|
"#ef334b",
|
|
@@ -14620,7 +14642,7 @@ function V_({ orbColors: e }) {
|
|
|
14620
14642
|
`.replace(/\s+/g, " ").trim()
|
|
14621
14643
|
} });
|
|
14622
14644
|
}
|
|
14623
|
-
var
|
|
14645
|
+
var W_ = () => /* @__PURE__ */ g("div", {
|
|
14624
14646
|
style: {
|
|
14625
14647
|
display: "flex",
|
|
14626
14648
|
marginBottom: "12px",
|
|
@@ -14650,7 +14672,7 @@ var H_ = () => /* @__PURE__ */ g("div", {
|
|
|
14650
14672
|
} }, e))
|
|
14651
14673
|
})
|
|
14652
14674
|
});
|
|
14653
|
-
function
|
|
14675
|
+
function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: N, webRTCError: oe, micError: P, setMicError: se, dismissCallError: F, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: _e, onCollapse: ve, onStartVoice: ye, voiceEnabled: be, headerBgColor: xe, onNewChat: I, showPoweredBy: L, privacyPolicyUrl: R, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: we, isClosing: Te }) {
|
|
14654
14676
|
let Ee = l.length > 0, De = T || E || w, Oe = !!ue, [ke, Ae] = m(!1), { resolvedConfig: je } = kn(), Me = je?.siteId || null, [Ne, Pe] = m(() => ce(Me) === "auto"), Fe = () => {
|
|
14655
14677
|
let e = Ne ? "ask" : "auto";
|
|
14656
14678
|
le(Me, e), Pe(e === "auto");
|
|
@@ -14793,7 +14815,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14793
14815
|
justifyContent: "center",
|
|
14794
14816
|
height: "40px"
|
|
14795
14817
|
},
|
|
14796
|
-
children: i ? /* @__PURE__ */ g(
|
|
14818
|
+
children: i ? /* @__PURE__ */ g(I_, {
|
|
14797
14819
|
logo: i,
|
|
14798
14820
|
style: {
|
|
14799
14821
|
height: "34px",
|
|
@@ -14806,7 +14828,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14806
14828
|
height: "40px",
|
|
14807
14829
|
flexShrink: 0
|
|
14808
14830
|
},
|
|
14809
|
-
children: /* @__PURE__ */ g(
|
|
14831
|
+
children: /* @__PURE__ */ g(L_, { title: e.chatTitle })
|
|
14810
14832
|
})
|
|
14811
14833
|
}), o && /* @__PURE__ */ g("div", {
|
|
14812
14834
|
style: {
|
|
@@ -15170,7 +15192,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15170
15192
|
})
|
|
15171
15193
|
]
|
|
15172
15194
|
}),
|
|
15173
|
-
/* @__PURE__ */ g(
|
|
15195
|
+
/* @__PURE__ */ g(Hg, {
|
|
15174
15196
|
webRTCError: oe,
|
|
15175
15197
|
micError: P,
|
|
15176
15198
|
setMicError: se,
|
|
@@ -15178,7 +15200,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15178
15200
|
isRateLimited: E,
|
|
15179
15201
|
rateLimitMessage: D
|
|
15180
15202
|
}),
|
|
15181
|
-
ge && /* @__PURE__ */ g(
|
|
15203
|
+
ge && /* @__PURE__ */ g(a_, {
|
|
15182
15204
|
agentName: v,
|
|
15183
15205
|
agentHeadshot: y,
|
|
15184
15206
|
fallbackAgentName: b,
|
|
@@ -15312,17 +15334,17 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15312
15334
|
children: "No previous chats found."
|
|
15313
15335
|
})
|
|
15314
15336
|
})]
|
|
15315
|
-
}) : null, Ee ? /* @__PURE__ */ g(
|
|
15337
|
+
}) : null, Ee ? /* @__PURE__ */ g(zg, {
|
|
15316
15338
|
chatHistory: l,
|
|
15317
15339
|
isAiTyping: u,
|
|
15318
15340
|
isLoading: T,
|
|
15319
15341
|
isAgentTyping: d,
|
|
15320
15342
|
setReplyContext: N,
|
|
15321
|
-
TypingDots:
|
|
15343
|
+
TypingDots: W_,
|
|
15322
15344
|
primaryColor: n,
|
|
15323
15345
|
agentHeadshot: y,
|
|
15324
15346
|
agentDisplayName: v || b,
|
|
15325
|
-
botAvatarNode: /* @__PURE__ */ g(
|
|
15347
|
+
botAvatarNode: /* @__PURE__ */ g(U_, { orbColors: t })
|
|
15326
15348
|
}) : we ? /* @__PURE__ */ _("div", {
|
|
15327
15349
|
style: {
|
|
15328
15350
|
flex: 1,
|
|
@@ -15363,7 +15385,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15363
15385
|
padding: "28px 24px"
|
|
15364
15386
|
},
|
|
15365
15387
|
children: [
|
|
15366
|
-
/* @__PURE__ */ g(
|
|
15388
|
+
/* @__PURE__ */ g(z_, {
|
|
15367
15389
|
size: 94,
|
|
15368
15390
|
orbColors: t
|
|
15369
15391
|
}),
|
|
@@ -15454,7 +15476,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15454
15476
|
zIndex: 1,
|
|
15455
15477
|
padding: ne ? "6px 0 0" : "12px 0 0"
|
|
15456
15478
|
},
|
|
15457
|
-
children: /* @__PURE__ */ g(
|
|
15479
|
+
children: /* @__PURE__ */ g(Vg, {
|
|
15458
15480
|
input: x,
|
|
15459
15481
|
setInput: S,
|
|
15460
15482
|
onSubmit: C,
|
|
@@ -15528,7 +15550,7 @@ function U_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15528
15550
|
]
|
|
15529
15551
|
});
|
|
15530
15552
|
}
|
|
15531
|
-
function
|
|
15553
|
+
function K_() {
|
|
15532
15554
|
let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, beaconSyncVoiceTranscript: j, sendMessage: M, uploadChatFile: re, openWidget: ie, captureVisitorEmail: ae, setVoiceMode: N, endConversation: se, startNewChat: F, acceptCall: ce, rejectCall: le, endWebRTCCall: ue, toggleCallMute: de, dismissCallError: fe, startTyping: pe, stopTyping: me, updateTypingDraft: he, getVisitorChatHistory: ge, resumeChat: _e, isSessionRestoring: ve, openToChatCounter: ye, voiceEndCounter: be } = kn();
|
|
15533
15555
|
c(() => {
|
|
15534
15556
|
try {
|
|
@@ -15550,7 +15572,7 @@ function W_() {
|
|
|
15550
15572
|
small: 50,
|
|
15551
15573
|
medium: 64,
|
|
15552
15574
|
large: 80
|
|
15553
|
-
}, ke = Oe[R.orbSize] || Oe.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", Pe =
|
|
15575
|
+
}, ke = Oe[R.orbSize] || Oe.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", Pe = N_(we ?? R.chatBgColors), Fe = L.logo || L.logoUrl || null, Ie = A || "en", Le = xe.recommendations?.[Ie] || [], z = (I.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
15554
15576
|
id: e.key || `qr-${t}`,
|
|
15555
15577
|
label: e.label,
|
|
15556
15578
|
message: e.label,
|
|
@@ -15641,7 +15663,7 @@ function W_() {
|
|
|
15641
15663
|
let kt = o(() => {
|
|
15642
15664
|
ht(null), _t("");
|
|
15643
15665
|
}, []), At = o((e) => {
|
|
15644
|
-
let t =
|
|
15666
|
+
let t = Ng(e);
|
|
15645
15667
|
if (t) {
|
|
15646
15668
|
ht(null), _t(t);
|
|
15647
15669
|
return;
|
|
@@ -15747,7 +15769,7 @@ function W_() {
|
|
|
15747
15769
|
if (mt) {
|
|
15748
15770
|
try {
|
|
15749
15771
|
yt(!0), _t("");
|
|
15750
|
-
let e = await re(mt), n = e?.data || e, r = tt.trim() || `Shared file: ${
|
|
15772
|
+
let e = await re(mt), n = e?.data || e, r = tt.trim() || `Shared file: ${Fg(mt)}`;
|
|
15751
15773
|
nt(""), it(null), kt(), await M(r, "", t, {
|
|
15752
15774
|
type: "file",
|
|
15753
15775
|
metadata: {
|
|
@@ -15840,7 +15862,7 @@ function W_() {
|
|
|
15840
15862
|
onWheel: (e) => e.stopPropagation(),
|
|
15841
15863
|
onTouchMove: (e) => e.stopPropagation(),
|
|
15842
15864
|
children: [
|
|
15843
|
-
W === "entry_prompt" && /* @__PURE__ */ g(
|
|
15865
|
+
W === "entry_prompt" && /* @__PURE__ */ g(B_, {
|
|
15844
15866
|
copy: qe,
|
|
15845
15867
|
orbColors: we,
|
|
15846
15868
|
primaryColor: Te,
|
|
@@ -15923,13 +15945,13 @@ function W_() {
|
|
|
15923
15945
|
children: E === "connected" ? `${It(ut)} with ${Ze}` : `Tap to return to ${Ze}`
|
|
15924
15946
|
})]
|
|
15925
15947
|
})]
|
|
15926
|
-
}), /* @__PURE__ */ g(
|
|
15948
|
+
}), /* @__PURE__ */ g(z_, {
|
|
15927
15949
|
size: ke,
|
|
15928
15950
|
orbColors: we,
|
|
15929
15951
|
onClick: T ? jt : Ce ? Bt : Ht
|
|
15930
15952
|
})]
|
|
15931
15953
|
}),
|
|
15932
|
-
W === "connection_modal" && /* @__PURE__ */ g(
|
|
15954
|
+
W === "connection_modal" && /* @__PURE__ */ g(V_, {
|
|
15933
15955
|
copy: qe,
|
|
15934
15956
|
orbColors: we,
|
|
15935
15957
|
primaryColor: Te,
|
|
@@ -15939,7 +15961,7 @@ function W_() {
|
|
|
15939
15961
|
isMobile: Dt,
|
|
15940
15962
|
isClosing: St
|
|
15941
15963
|
}),
|
|
15942
|
-
W === "voice_mode" && /* @__PURE__ */ g(
|
|
15964
|
+
W === "voice_mode" && /* @__PURE__ */ g(H_, {
|
|
15943
15965
|
orbColors: we,
|
|
15944
15966
|
onEnterChat: Ht,
|
|
15945
15967
|
onEndChat: Ut,
|
|
@@ -15962,7 +15984,7 @@ function W_() {
|
|
|
15962
15984
|
enterChatModeLabel: L.voiceEnterChatLabel || "Enter Chat Mode",
|
|
15963
15985
|
endConversationLabel: L.voiceEndConversationLabel || "End Conversation"
|
|
15964
15986
|
}, "voice"),
|
|
15965
|
-
W === "call_screen" && /* @__PURE__ */ g(
|
|
15987
|
+
W === "call_screen" && /* @__PURE__ */ g(i_, {
|
|
15966
15988
|
incomingCall: w,
|
|
15967
15989
|
activeCallId: T,
|
|
15968
15990
|
callConnectionState: E,
|
|
@@ -15981,7 +16003,7 @@ function W_() {
|
|
|
15981
16003
|
orbColors: we,
|
|
15982
16004
|
chatHistory: r
|
|
15983
16005
|
}),
|
|
15984
|
-
W === "text_chat" && /* @__PURE__ */ g(
|
|
16006
|
+
W === "text_chat" && /* @__PURE__ */ g(G_, {
|
|
15985
16007
|
isClosing: St,
|
|
15986
16008
|
copy: qe,
|
|
15987
16009
|
orbColors: we,
|
|
@@ -16047,7 +16069,7 @@ function W_() {
|
|
|
16047
16069
|
}
|
|
16048
16070
|
//#endregion
|
|
16049
16071
|
//#region src/components/ErrorBoundary.jsx
|
|
16050
|
-
var
|
|
16072
|
+
var q_ = class extends e.Component {
|
|
16051
16073
|
constructor(e) {
|
|
16052
16074
|
super(e), this.state = { hasError: !1 };
|
|
16053
16075
|
}
|
|
@@ -16062,4 +16084,4 @@ var G_ = class extends e.Component {
|
|
|
16062
16084
|
}
|
|
16063
16085
|
};
|
|
16064
16086
|
//#endregion
|
|
16065
|
-
export {
|
|
16087
|
+
export { Zg as AnimatedOrb, q_ as ErrorBoundary, yi as FlowEngageProvider, K_ as FlowEngageWidget, kn as useFlowEngage };
|