@flowengage/react-chatbot 8.0.108 → 8.0.109
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.
|
@@ -42,38 +42,38 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
42
42
|
if (j) try {
|
|
43
43
|
window.localStorage.removeItem(A.chatId);
|
|
44
44
|
} catch {}
|
|
45
|
-
},
|
|
45
|
+
}, N = () => j ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", P = (e) => e ? `flowengage.entrySeen.${e}` : null, ae = (e) => {
|
|
46
46
|
if (!j || !e) return !1;
|
|
47
47
|
try {
|
|
48
|
-
let t =
|
|
48
|
+
let t = P(e);
|
|
49
49
|
return t ? window.localStorage.getItem(t) === "1" : !1;
|
|
50
50
|
} catch {
|
|
51
51
|
return !1;
|
|
52
52
|
}
|
|
53
|
-
},
|
|
53
|
+
}, oe = (e) => {
|
|
54
54
|
if (!(!j || !e)) try {
|
|
55
|
-
let t =
|
|
55
|
+
let t = P(e);
|
|
56
56
|
t && window.localStorage.setItem(t, "1");
|
|
57
57
|
} catch {}
|
|
58
|
-
},
|
|
58
|
+
}, se = (e) => e ? `flowengage.persistedChatId.${e}` : null, ce = (e) => {
|
|
59
59
|
if (!j || !e) return null;
|
|
60
60
|
try {
|
|
61
|
-
let t =
|
|
61
|
+
let t = se(e), n = t ? window.localStorage.getItem(t) : null;
|
|
62
62
|
return n && String(n).trim() ? String(n).trim() : null;
|
|
63
63
|
} catch {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, le = (e) => {
|
|
67
67
|
if (!(!j || !e)) try {
|
|
68
|
-
let t =
|
|
68
|
+
let t = se(e);
|
|
69
69
|
t && window.localStorage.removeItem(t);
|
|
70
70
|
} catch {}
|
|
71
|
-
},
|
|
71
|
+
}, ue = (e, t) => {
|
|
72
72
|
if (!(!j || !e || !t)) try {
|
|
73
|
-
let n =
|
|
73
|
+
let n = se(e);
|
|
74
74
|
n && window.localStorage.setItem(n, String(t).trim());
|
|
75
75
|
} catch {}
|
|
76
|
-
},
|
|
76
|
+
}, de = () => j ? {
|
|
77
77
|
isOpen: !1,
|
|
78
78
|
activeScreen: window.sessionStorage.getItem(A.activeScreen) || "ai",
|
|
79
79
|
isHumanHandled: window.sessionStorage.getItem(A.isHumanHandled) === "true",
|
|
@@ -87,7 +87,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
87
87
|
agentName: null,
|
|
88
88
|
agentHeadshot: null,
|
|
89
89
|
visitorEmail: ""
|
|
90
|
-
},
|
|
90
|
+
}, fe = (e) => {
|
|
91
91
|
j && Object.entries(e).forEach(([e, t]) => {
|
|
92
92
|
let n = A[e];
|
|
93
93
|
if (n) {
|
|
@@ -98,7 +98,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
98
98
|
window.sessionStorage.setItem(n, String(t));
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
|
-
},
|
|
101
|
+
}, pe = (e) => {
|
|
102
102
|
if (!j || !e) return "";
|
|
103
103
|
let t = M(e), n = window.localStorage.getItem(t);
|
|
104
104
|
if (!n) {
|
|
@@ -106,7 +106,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
106
106
|
e && (window.localStorage.setItem(t, e), window.sessionStorage.removeItem(A.visitorEmail), n = e);
|
|
107
107
|
}
|
|
108
108
|
return n || "";
|
|
109
|
-
},
|
|
109
|
+
}, me = (e, t) => {
|
|
110
110
|
if (!j) return;
|
|
111
111
|
let n = M(t);
|
|
112
112
|
if (!n) return;
|
|
@@ -116,91 +116,91 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
window.localStorage.setItem(n, r), window.sessionStorage.removeItem(A.visitorEmail);
|
|
119
|
-
},
|
|
119
|
+
}, he = (e) => e ? `flowengage.visitorId.${e}` : null, ge = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, F = (e) => {
|
|
120
120
|
if (!j || !e) return null;
|
|
121
121
|
try {
|
|
122
|
-
let t =
|
|
122
|
+
let t = he(e), n = t ? window.localStorage.getItem(t) : null;
|
|
123
123
|
return n && String(n).trim() ? String(n).trim() : null;
|
|
124
124
|
} catch {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
},
|
|
127
|
+
}, _e = (e) => {
|
|
128
128
|
if (!j || !e) return null;
|
|
129
129
|
try {
|
|
130
|
-
let t =
|
|
130
|
+
let t = F(e);
|
|
131
131
|
if (t) return t;
|
|
132
|
-
let n =
|
|
132
|
+
let n = ge(), r = he(e);
|
|
133
133
|
return r && window.localStorage.setItem(r, n), n;
|
|
134
134
|
} catch {
|
|
135
|
-
return
|
|
135
|
+
return ge();
|
|
136
136
|
}
|
|
137
|
-
},
|
|
137
|
+
}, ve = "flowengage.tabId", ye = () => {
|
|
138
138
|
if (!j) return "default";
|
|
139
139
|
try {
|
|
140
|
-
let e = window.sessionStorage.getItem(
|
|
141
|
-
return e || (e = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 12) : Math.random().toString(36).slice(2, 14), window.sessionStorage.setItem(
|
|
140
|
+
let e = window.sessionStorage.getItem(ve);
|
|
141
|
+
return e || (e = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 12) : Math.random().toString(36).slice(2, 14), window.sessionStorage.setItem(ve, e)), e;
|
|
142
142
|
} catch {
|
|
143
143
|
return "default";
|
|
144
144
|
}
|
|
145
|
-
},
|
|
145
|
+
}, I = (e) => e ? `flowengage.voice.transcript.${e}.${ye()}` : null, be = 600 * 1e3, L = (e, t, n = {}) => {
|
|
146
146
|
if (!j || !e) return;
|
|
147
147
|
let r = typeof t == "string" ? t.trim() : "";
|
|
148
148
|
if (!r) return;
|
|
149
|
-
let i = Number.isFinite(n.ttlMs) ? n.ttlMs :
|
|
149
|
+
let i = Number.isFinite(n.ttlMs) ? n.ttlMs : be, a = {
|
|
150
150
|
transcript: r,
|
|
151
151
|
expiresAt: Date.now() + i
|
|
152
152
|
};
|
|
153
153
|
try {
|
|
154
|
-
let t =
|
|
154
|
+
let t = I(e);
|
|
155
155
|
t && window.localStorage.setItem(t, JSON.stringify(a));
|
|
156
156
|
} catch {}
|
|
157
|
-
},
|
|
157
|
+
}, xe = (e) => {
|
|
158
158
|
if (!j || !e) return null;
|
|
159
159
|
try {
|
|
160
|
-
let t =
|
|
160
|
+
let t = I(e), n = t ? window.localStorage.getItem(t) : null;
|
|
161
161
|
if (!n) return null;
|
|
162
162
|
let r = JSON.parse(n);
|
|
163
163
|
return !r || typeof r.transcript != "string" ? null : Number.isFinite(r.expiresAt) && Date.now() > r.expiresAt ? (window.localStorage.removeItem(t), null) : r;
|
|
164
164
|
} catch {
|
|
165
165
|
return null;
|
|
166
166
|
}
|
|
167
|
-
},
|
|
167
|
+
}, Se = (e) => {
|
|
168
168
|
if (!(!j || !e)) try {
|
|
169
|
-
let t =
|
|
169
|
+
let t = I(e);
|
|
170
170
|
t && window.localStorage.removeItem(t);
|
|
171
171
|
} catch {}
|
|
172
|
-
},
|
|
172
|
+
}, R = "flowengage.voice.pendingResume", Ce = () => {
|
|
173
173
|
if (j) try {
|
|
174
|
-
window.sessionStorage.setItem(
|
|
174
|
+
window.sessionStorage.setItem(R, "1");
|
|
175
175
|
} catch {}
|
|
176
|
-
},
|
|
176
|
+
}, we = () => {
|
|
177
177
|
if (!j) return !1;
|
|
178
178
|
try {
|
|
179
|
-
return window.sessionStorage.getItem(
|
|
179
|
+
return window.sessionStorage.getItem(R) === "1" ? (window.sessionStorage.removeItem(R), !0) : !1;
|
|
180
180
|
} catch {
|
|
181
181
|
return !1;
|
|
182
182
|
}
|
|
183
|
-
},
|
|
183
|
+
}, Te = "flowengage.chat.pendingReopen", Ee = () => {
|
|
184
184
|
if (j) try {
|
|
185
|
-
window.sessionStorage.setItem(
|
|
185
|
+
window.sessionStorage.setItem(Te, "1");
|
|
186
186
|
} catch {}
|
|
187
|
-
},
|
|
187
|
+
}, De = () => {
|
|
188
188
|
if (!j) return !1;
|
|
189
189
|
try {
|
|
190
|
-
return window.sessionStorage.getItem(
|
|
190
|
+
return window.sessionStorage.getItem(Te) === "1" ? (window.sessionStorage.removeItem(Te), !0) : !1;
|
|
191
191
|
} catch {
|
|
192
192
|
return !1;
|
|
193
193
|
}
|
|
194
|
-
},
|
|
194
|
+
}, Oe = () => {
|
|
195
195
|
if (!j) return !1;
|
|
196
196
|
try {
|
|
197
|
-
return window.sessionStorage.getItem(
|
|
197
|
+
return window.sessionStorage.getItem(R) === "1";
|
|
198
198
|
} catch {
|
|
199
199
|
return !1;
|
|
200
200
|
}
|
|
201
|
-
},
|
|
201
|
+
}, ke = (e) => e ? `flowengage.voice.navState.${e}.${ye()}` : null, Ae = (e, t, n, r) => {
|
|
202
202
|
if (!(!j || !e || !t)) try {
|
|
203
|
-
let i =
|
|
203
|
+
let i = ke(e);
|
|
204
204
|
i && window.sessionStorage.setItem(i, JSON.stringify({
|
|
205
205
|
previousPage: String(t),
|
|
206
206
|
targetPath: n ? new URL(String(n), window.location.href).pathname : null,
|
|
@@ -208,10 +208,10 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
208
208
|
ts: Date.now()
|
|
209
209
|
}));
|
|
210
210
|
} catch {}
|
|
211
|
-
},
|
|
211
|
+
}, je = (e) => {
|
|
212
212
|
if (!j || !e) return null;
|
|
213
213
|
try {
|
|
214
|
-
let t =
|
|
214
|
+
let t = ke(e);
|
|
215
215
|
if (!t) return null;
|
|
216
216
|
let n = window.sessionStorage.getItem(t);
|
|
217
217
|
if (!n) return null;
|
|
@@ -224,7 +224,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
224
224
|
} catch {
|
|
225
225
|
return null;
|
|
226
226
|
}
|
|
227
|
-
},
|
|
227
|
+
}, Me = async (e) => {
|
|
228
228
|
let t = await e.json().catch(() => ({}));
|
|
229
229
|
if (!e.ok) {
|
|
230
230
|
let n = Error(t.message || t.error || `Request failed with status ${e.status}`);
|
|
@@ -243,7 +243,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
243
243
|
}
|
|
244
244
|
}, Ne = async ({ apiBaseUrl: e, userId: t, siteId: n, priorChatId: r = null, forceNew: i = !1, resumeChatId: a = null, visitorId: o = null }) => {
|
|
245
245
|
let s = `${e}/api/visitors/resolve-session`, c = { siteId: n };
|
|
246
|
-
return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o),
|
|
246
|
+
return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), Me(await z(s, {
|
|
247
247
|
method: "POST",
|
|
248
248
|
mode: "cors",
|
|
249
249
|
headers: {
|
|
@@ -256,7 +256,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
256
256
|
}));
|
|
257
257
|
}, Pe = async ({ apiBaseUrl: e, siteId: t }) => {
|
|
258
258
|
let n = typeof window < "u" ? window.location.origin : "http://localhost";
|
|
259
|
-
return (await
|
|
259
|
+
return (await Me(await z(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
|
|
260
260
|
siteId: t,
|
|
261
261
|
origin: n
|
|
262
262
|
}).toString()}`, { method: "GET" }))).data;
|
|
@@ -274,7 +274,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
274
274
|
headers: { "Content-Type": "application/json" },
|
|
275
275
|
body: i
|
|
276
276
|
}).catch(() => {}), !0) : !1;
|
|
277
|
-
}, a = async (i, a = {}) =>
|
|
277
|
+
}, a = async (i, a = {}) => Me(await z(`${e}${i}`, {
|
|
278
278
|
...a,
|
|
279
279
|
headers: {
|
|
280
280
|
"Content-Type": "application/json",
|
|
@@ -289,7 +289,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
289
289
|
...n ? { "x-site-id": n } : {},
|
|
290
290
|
...a.headers || {}
|
|
291
291
|
};
|
|
292
|
-
return
|
|
292
|
+
return Me(await z(`${e}${r}`, {
|
|
293
293
|
...a,
|
|
294
294
|
body: i,
|
|
295
295
|
headers: o
|
|
@@ -333,7 +333,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
333
333
|
stream: !0
|
|
334
334
|
})
|
|
335
335
|
});
|
|
336
|
-
if (!(p.headers.get("content-type") || "").includes("text/event-stream")) return
|
|
336
|
+
if (!(p.headers.get("content-type") || "").includes("text/event-stream")) return Me(p);
|
|
337
337
|
let m = p.body.getReader(), h = new TextDecoder(), g = "", _ = null, v = (e) => {
|
|
338
338
|
let t = e.split("\n").find((e) => e.startsWith("data: "));
|
|
339
339
|
if (t) try {
|
|
@@ -449,7 +449,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
449
449
|
});
|
|
450
450
|
},
|
|
451
451
|
async getIceServersConfig() {
|
|
452
|
-
return
|
|
452
|
+
return Me(await z(`${e}/api/calls/ice-config`, {
|
|
453
453
|
method: "GET",
|
|
454
454
|
headers: {
|
|
455
455
|
"x-user-id": t,
|
|
@@ -2855,7 +2855,7 @@ async function wr(e, t = {}) {
|
|
|
2855
2855
|
reason: "already-on-page"
|
|
2856
2856
|
};
|
|
2857
2857
|
let a = i.pathname + i.search + i.hash;
|
|
2858
|
-
if (window.Shopify) return n && mr(n), r ||
|
|
2858
|
+
if (window.Shopify) return n && mr(n), r || Ee(), r ? Cr().then(() => window.location.assign(i.href)) : window.location.assign(i.href), { navigated: !0 };
|
|
2859
2859
|
let o = window.next?.router;
|
|
2860
2860
|
if (o?.push) return new Promise((e) => {
|
|
2861
2861
|
let t = () => {
|
|
@@ -2874,11 +2874,11 @@ async function wr(e, t = {}) {
|
|
|
2874
2874
|
try {
|
|
2875
2875
|
window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate", { state: {} }));
|
|
2876
2876
|
} catch {}
|
|
2877
|
-
return n && mr(n), r ||
|
|
2877
|
+
return n && mr(n), r || Ee(), window.location.assign(i.href), { navigated: !0 };
|
|
2878
2878
|
}
|
|
2879
2879
|
return { navigated: !0 };
|
|
2880
2880
|
}
|
|
2881
|
-
return n && mr(n), r ||
|
|
2881
|
+
return n && mr(n), r || Ee(), window.location.assign(i.href), { navigated: !0 };
|
|
2882
2882
|
} catch (t) {
|
|
2883
2883
|
console.warn("[FlowEngage] shadowNavigate error:", t), n && mr(n);
|
|
2884
2884
|
try {
|
|
@@ -3296,7 +3296,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3296
3296
|
message: "Looks like you're already on this page!",
|
|
3297
3297
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3298
3298
|
}]);
|
|
3299
|
-
}, []), [D, O] = m(
|
|
3299
|
+
}, []), [D, O] = m(de().isOpen), [k, A] = m(de().activeScreen), [j, M] = m(de().isHumanHandled), [P, ae] = m(de().agentName), [oe, se] = m(de().agentHeadshot), [he, ge] = m(() => pe(i?.siteId)), [F, ve] = m(!1), [ye, I] = m(!1), [be, L] = m("idle"), [xe, Se] = m(!1), [R, we] = m(!1), [Te, Ee] = m(""), [De, Oe] = m(!1), [ke, Ae] = m(0), [je, Me] = m(0), [z, B] = m(!1), [V, Ie] = m(null), [Le, Re] = m(null), [ze, Be] = m("idle"), [Ve, He] = m(null), [Ue, We] = m(!1), [Ge, Ke] = m(""), [qe, Je] = m(!1), H = p(null), U = p(null), Ye = p(""), Xe = p(!1), Ze = p(null), Qe = p(null), W = p(null), $e = p(null), et = p(null), tt = p(null), nt = p(null), G = p(!1), rt = p({
|
|
3300
3300
|
url: null,
|
|
3301
3301
|
at: 0
|
|
3302
3302
|
}), it = o((e, t) => {
|
|
@@ -3313,12 +3313,12 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3313
3313
|
url: n,
|
|
3314
3314
|
at: Date.now()
|
|
3315
3315
|
}, wr(e, t));
|
|
3316
|
-
}, []), at = p([]), ot = p(null), st = p(null), ct = p(null), lt = p(!1), ut = p(!1), dt = p(""), ft = p(null), pt = p(null), mt = p([]), ht = p(0), gt = p(
|
|
3316
|
+
}, []), at = p([]), ot = p(null), st = p(null), ct = p(null), lt = p(!1), ut = p(!1), dt = p(""), ft = p(null), pt = p(null), mt = p([]), ht = p(0), gt = p(P), _t = p([]), vt = p(!1), yt = p(!1), bt = p(i), xt = p({
|
|
3317
3317
|
notifyRouteChange: () => {},
|
|
3318
3318
|
cleanup: () => {}
|
|
3319
3319
|
}), St = o((e = {}) => {
|
|
3320
3320
|
let t = !!e.is_human_handled;
|
|
3321
|
-
return M(t), t ? (A("agent"), e.agent_info?.name &&
|
|
3321
|
+
return M(t), t ? (A("agent"), e.agent_info?.name && ae(e.agent_info.name), e.agent_info?.headshot && se(e.agent_info.headshot), t) : (A("ai"), t);
|
|
3322
3322
|
}, []), Ct = f(() => {
|
|
3323
3323
|
let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
|
|
3324
3324
|
return Number.isFinite(t) && t > 0 ? t : te;
|
|
@@ -3326,10 +3326,10 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3326
3326
|
c(() => {
|
|
3327
3327
|
Qe.current = V;
|
|
3328
3328
|
}, [V]), c(() => {
|
|
3329
|
-
gt.current =
|
|
3330
|
-
}, [
|
|
3331
|
-
yt.current =
|
|
3332
|
-
}, [
|
|
3329
|
+
gt.current = P;
|
|
3330
|
+
}, [P]), c(() => {
|
|
3331
|
+
yt.current = De;
|
|
3332
|
+
}, [De]), c(() => {
|
|
3333
3333
|
bt.current = i;
|
|
3334
3334
|
}, [i]);
|
|
3335
3335
|
let wt = () => {
|
|
@@ -3338,17 +3338,17 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3338
3338
|
ct.current &&= (window.clearTimeout(ct.current), null);
|
|
3339
3339
|
}, []), Et = (e) => {
|
|
3340
3340
|
let t = typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
3341
|
-
return
|
|
3341
|
+
return ge(t), me(t, i?.siteId), t;
|
|
3342
3342
|
};
|
|
3343
3343
|
c(() => {
|
|
3344
3344
|
let e = i?.siteId;
|
|
3345
3345
|
if (!e) return;
|
|
3346
|
-
let t =
|
|
3346
|
+
let t = pe(e);
|
|
3347
3347
|
if (t) {
|
|
3348
|
-
|
|
3348
|
+
ge(t);
|
|
3349
3349
|
return;
|
|
3350
3350
|
}
|
|
3351
|
-
|
|
3351
|
+
ge((t) => (t && me(t, e), t));
|
|
3352
3352
|
}, [i?.siteId]);
|
|
3353
3353
|
let Dt = (e = "unspecified") => {
|
|
3354
3354
|
let t = ot.current || tt.current?.callId, n = ht.current, r = ft.current;
|
|
@@ -3478,19 +3478,19 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3478
3478
|
});
|
|
3479
3479
|
};
|
|
3480
3480
|
c(() => {
|
|
3481
|
-
|
|
3481
|
+
fe({
|
|
3482
3482
|
isOpen: D,
|
|
3483
3483
|
activeScreen: k,
|
|
3484
3484
|
isHumanHandled: j,
|
|
3485
|
-
agentName:
|
|
3486
|
-
agentHeadshot:
|
|
3485
|
+
agentName: P,
|
|
3486
|
+
agentHeadshot: oe
|
|
3487
3487
|
});
|
|
3488
3488
|
}, [
|
|
3489
3489
|
D,
|
|
3490
3490
|
k,
|
|
3491
3491
|
j,
|
|
3492
|
-
|
|
3493
|
-
|
|
3492
|
+
P,
|
|
3493
|
+
oe
|
|
3494
3494
|
]), c(() => {
|
|
3495
3495
|
let e = !0;
|
|
3496
3496
|
return (async () => {
|
|
@@ -3498,7 +3498,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3498
3498
|
try {
|
|
3499
3499
|
let t = E(i), n = await Pe(t);
|
|
3500
3500
|
if (!e) return;
|
|
3501
|
-
let a = t.siteId, o =
|
|
3501
|
+
let a = t.siteId, o = ce(a), s = _e(a), c = "";
|
|
3502
3502
|
try {
|
|
3503
3503
|
let e = Xe.current, r = Ze.current;
|
|
3504
3504
|
if (Xe.current = !1, Ze.current = null, c = (await Ne({
|
|
@@ -3510,9 +3510,9 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3510
3510
|
resumeChatId: r,
|
|
3511
3511
|
visitorId: s
|
|
3512
3512
|
}))?.data?.chatId, !c) throw Error("resolve-session returned no chatId");
|
|
3513
|
-
ie(),
|
|
3513
|
+
ie(), ue(a, c);
|
|
3514
3514
|
} catch (e) {
|
|
3515
|
-
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o ||
|
|
3515
|
+
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || N(), ue(a, c);
|
|
3516
3516
|
}
|
|
3517
3517
|
Ye.current = c;
|
|
3518
3518
|
let l = Fe({
|
|
@@ -3532,23 +3532,23 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3532
3532
|
siteId: t.siteId
|
|
3533
3533
|
});
|
|
3534
3534
|
H.current = f, f.on("connect", async () => {
|
|
3535
|
-
|
|
3535
|
+
L("connected");
|
|
3536
3536
|
let e = Ye.current;
|
|
3537
3537
|
if (e && U.current) try {
|
|
3538
3538
|
St(await U.current.checkHumanHandled(e));
|
|
3539
3539
|
} catch {}
|
|
3540
3540
|
}), f.on("disconnect", () => {
|
|
3541
|
-
|
|
3541
|
+
L("disconnected");
|
|
3542
3542
|
}), f.on("aiTyping", () => {
|
|
3543
|
-
|
|
3543
|
+
I(!0);
|
|
3544
3544
|
}), f.on("ai:typing", () => {
|
|
3545
|
-
|
|
3545
|
+
I(!0);
|
|
3546
3546
|
}), f.on("messageReceived", (e) => {
|
|
3547
3547
|
let t = e.message || e, n = {
|
|
3548
3548
|
...t,
|
|
3549
3549
|
message: oi(t.message)
|
|
3550
3550
|
};
|
|
3551
|
-
|
|
3551
|
+
I(!1), ve(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
|
|
3552
3552
|
...n,
|
|
3553
3553
|
isPending: !1,
|
|
3554
3554
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -3566,7 +3566,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3566
3566
|
...t,
|
|
3567
3567
|
message: oi(t.message)
|
|
3568
3568
|
};
|
|
3569
|
-
|
|
3569
|
+
I(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && ((n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && ve(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
|
|
3570
3570
|
...n,
|
|
3571
3571
|
isPending: !1,
|
|
3572
3572
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -3578,11 +3578,11 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3578
3578
|
...n,
|
|
3579
3579
|
isPending: !1,
|
|
3580
3580
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
3581
|
-
}]), (n.sender === "agent" || n.agent_name) && (M(!0), A("agent"),
|
|
3581
|
+
}]), (n.sender === "agent" || n.agent_name) && (M(!0), A("agent"), ae(di([
|
|
3582
3582
|
n.agent_name,
|
|
3583
3583
|
n.agentName,
|
|
3584
3584
|
n.metadata?.agentName
|
|
3585
|
-
], d)), n.sender_headshot &&
|
|
3585
|
+
], d)), n.sender_headshot && se(n.sender_headshot), O(!0), Ae((e) => e + 1)));
|
|
3586
3586
|
});
|
|
3587
3587
|
let p = (e = {}) => {
|
|
3588
3588
|
let t = di([
|
|
@@ -3591,7 +3591,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3591
3591
|
e.agent_name,
|
|
3592
3592
|
gt.current
|
|
3593
3593
|
], d);
|
|
3594
|
-
M(!0), A("agent"),
|
|
3594
|
+
M(!0), A("agent"), ae(t), se(e.agent?.headshot || null), O(!0), Ae((e) => e + 1), S((e) => fi(e, {
|
|
3595
3595
|
id: `agent-joined-${Date.now()}`,
|
|
3596
3596
|
sender: "system",
|
|
3597
3597
|
message: `${t} has joined the chat.`,
|
|
@@ -3625,15 +3625,15 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3625
3625
|
}]);
|
|
3626
3626
|
}), f.on("chat:history_update", (e) => {
|
|
3627
3627
|
let t = si(e.chat_history || []);
|
|
3628
|
-
S(t), t.length === 0 && (B(!1), M(!1), A("ai"),
|
|
3628
|
+
S(t), t.length === 0 && (B(!1), M(!1), A("ai"), I(!1), ve(!1));
|
|
3629
3629
|
}), f.on("conversation:reset", () => {
|
|
3630
|
-
S([]), B(!1), M(!1), A("ai"),
|
|
3630
|
+
S([]), B(!1), M(!1), A("ai"), I(!1), ve(!1);
|
|
3631
3631
|
}), f.on("voice:end_session", (e = {}) => {
|
|
3632
|
-
console.log("[FlowEngageProvider] voice:end_session received — ending voice session"),
|
|
3632
|
+
console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Me((e) => e + 1), O(!0), Ae((e) => e + 1);
|
|
3633
3633
|
}), f.on("typing:start", (e) => {
|
|
3634
|
-
e.sender === "agent" &&
|
|
3634
|
+
e.sender === "agent" && ve(!0);
|
|
3635
3635
|
}), f.on("typing:stop", (e) => {
|
|
3636
|
-
e.sender === "agent" &&
|
|
3636
|
+
e.sender === "agent" && ve(!1);
|
|
3637
3637
|
}), f.on("call:incoming", (e = {}) => {
|
|
3638
3638
|
let t = di([
|
|
3639
3639
|
e.agentName,
|
|
@@ -3646,7 +3646,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3646
3646
|
from: e.from || "owner",
|
|
3647
3647
|
agentId: e.agentId || null,
|
|
3648
3648
|
agentName: t
|
|
3649
|
-
}),
|
|
3649
|
+
}), ae((e) => di([t, e], "Agent")), Be("incoming"), He(null), O(!0);
|
|
3650
3650
|
}), f.on("call:offer", async (e = {}) => {
|
|
3651
3651
|
tt.current = e;
|
|
3652
3652
|
try {
|
|
@@ -3739,11 +3739,11 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3739
3739
|
r,
|
|
3740
3740
|
a
|
|
3741
3741
|
]), c(() => () => {
|
|
3742
|
-
if (
|
|
3742
|
+
if (De && !vt.current && _t.current.length > 0) {
|
|
3743
3743
|
let e = Ye.current, t = _t.current, n = U.current;
|
|
3744
3744
|
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), vt.current = !0);
|
|
3745
3745
|
}
|
|
3746
|
-
}, [
|
|
3746
|
+
}, [De, _]);
|
|
3747
3747
|
let Mt = p(null);
|
|
3748
3748
|
c(() => {
|
|
3749
3749
|
let e = U.current;
|
|
@@ -3998,17 +3998,17 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3998
3998
|
chatId: y,
|
|
3999
3999
|
content: e,
|
|
4000
4000
|
sender: "user",
|
|
4001
|
-
email:
|
|
4001
|
+
email: he || void 0,
|
|
4002
4002
|
type: i?.type || "text",
|
|
4003
4003
|
metadata: i?.metadata || {},
|
|
4004
4004
|
...n || {}
|
|
4005
4005
|
});
|
|
4006
4006
|
return;
|
|
4007
4007
|
}
|
|
4008
|
-
|
|
4008
|
+
Se(!0);
|
|
4009
4009
|
try {
|
|
4010
4010
|
let o = await Lr(), s = Fr(), l = `stream-preview-${Date.now().toString(36)}`, u = (e) => {
|
|
4011
|
-
|
|
4011
|
+
I(!1), S((t) => {
|
|
4012
4012
|
let n = t.findIndex((e) => e.id === l);
|
|
4013
4013
|
if (n === -1) return [...t, {
|
|
4014
4014
|
id: l,
|
|
@@ -4025,7 +4025,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4025
4025
|
});
|
|
4026
4026
|
}, d = await U.current.sendAiMessage(y, e, r, t, {
|
|
4027
4027
|
...n || {},
|
|
4028
|
-
...
|
|
4028
|
+
...he ? { email: he } : {}
|
|
4029
4029
|
}, {
|
|
4030
4030
|
...i,
|
|
4031
4031
|
currentPageUrl: typeof window < "u" ? window.location.href : void 0,
|
|
@@ -4102,10 +4102,10 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4102
4102
|
});
|
|
4103
4103
|
}
|
|
4104
4104
|
}
|
|
4105
|
-
S(si(f)), Array.isArray(d.cart_actions) && d.cart_actions.length && w(d.cart_actions), M(!!d.is_human_handled), A(d.is_human_handled ? "agent" : "ai"),
|
|
4105
|
+
S(si(f)), Array.isArray(d.cart_actions) && d.cart_actions.length && w(d.cart_actions), M(!!d.is_human_handled), A(d.is_human_handled ? "agent" : "ai"), I(!1), Se(!1), await U.current.updateChatStatus(y, "messageSent");
|
|
4106
4106
|
} catch (e) {
|
|
4107
|
-
S((e) => e.filter((e) => e.id !== u && !e.isStreaming)),
|
|
4108
|
-
|
|
4107
|
+
S((e) => e.filter((e) => e.id !== u && !e.isStreaming)), I(!1), Se(!1), e.status === 429 ? (we(!0), Ee(e.message), window.setTimeout(() => {
|
|
4108
|
+
we(!1), Ee("");
|
|
4109
4109
|
}, ee)) : h(e);
|
|
4110
4110
|
}
|
|
4111
4111
|
}, Gt = async (e) => {
|
|
@@ -4117,12 +4117,12 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4117
4117
|
let t = e ? "voice" : "text";
|
|
4118
4118
|
await U.current.setChatMode(y, t);
|
|
4119
4119
|
} catch {}
|
|
4120
|
-
|
|
4120
|
+
Oe(e), e && (vt.current = !1);
|
|
4121
4121
|
}
|
|
4122
4122
|
}, qt = async (e) => {
|
|
4123
4123
|
if (vt.current) return;
|
|
4124
4124
|
if (vt.current = !0, !U.current || !y || !e?.length) {
|
|
4125
|
-
|
|
4125
|
+
Oe(!1);
|
|
4126
4126
|
return;
|
|
4127
4127
|
}
|
|
4128
4128
|
let t = () => {
|
|
@@ -4146,11 +4146,11 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4146
4146
|
} catch {
|
|
4147
4147
|
t();
|
|
4148
4148
|
} finally {
|
|
4149
|
-
|
|
4149
|
+
Oe(!1);
|
|
4150
4150
|
}
|
|
4151
4151
|
}, Jt = async () => {
|
|
4152
4152
|
if (!(!U.current || !y)) {
|
|
4153
|
-
|
|
4153
|
+
De && !vt.current && _t.current.length > 0 && await qt(_t.current);
|
|
4154
4154
|
try {
|
|
4155
4155
|
await U.current.endConversation(y);
|
|
4156
4156
|
} catch {
|
|
@@ -4184,7 +4184,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4184
4184
|
let e = () => {
|
|
4185
4185
|
let e = Ye.current, t = U.current;
|
|
4186
4186
|
if (!t || !e) return;
|
|
4187
|
-
if (yt.current && _t.current.length > 0 &&
|
|
4187
|
+
if (yt.current && _t.current.length > 0 && Ce(), !vt.current && _t.current.length > 0 && (t.beaconSyncVoice(e, _t.current) || t.syncVoice(e, _t.current).catch(() => {}), vt.current = !0), ot.current) {
|
|
4188
4188
|
t.beaconEndWebRTCCall(ot.current, e);
|
|
4189
4189
|
return;
|
|
4190
4190
|
}
|
|
@@ -4197,9 +4197,9 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4197
4197
|
}, []);
|
|
4198
4198
|
let Yt = o(() => {
|
|
4199
4199
|
let e = i?.siteId;
|
|
4200
|
-
|
|
4200
|
+
le(e), Xe.current = !0, Ze.current = null, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1), ae(null), se(null), Je(!0), s((e) => e + 1);
|
|
4201
4201
|
}, [i?.siteId]), Xt = o((e) => {
|
|
4202
|
-
i?.siteId, Xe.current = !1, Ze.current = e, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1),
|
|
4202
|
+
i?.siteId, Xe.current = !1, Ze.current = e, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1), ae(null), se(null), Je(!0), s((e) => e + 1);
|
|
4203
4203
|
}, [i?.siteId]), Zt = f(() => ({
|
|
4204
4204
|
status: l,
|
|
4205
4205
|
error: d,
|
|
@@ -4210,20 +4210,20 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4210
4210
|
isOpen: D,
|
|
4211
4211
|
activeScreen: k,
|
|
4212
4212
|
isHumanHandled: j,
|
|
4213
|
-
agentName:
|
|
4214
|
-
agentHeadshot:
|
|
4215
|
-
visitorEmail:
|
|
4216
|
-
isAgentTyping:
|
|
4217
|
-
isAiTyping:
|
|
4218
|
-
connectionStatus:
|
|
4219
|
-
isLoading:
|
|
4220
|
-
isVoiceMode:
|
|
4221
|
-
isRateLimited:
|
|
4222
|
-
rateLimitMessage:
|
|
4213
|
+
agentName: P,
|
|
4214
|
+
agentHeadshot: oe,
|
|
4215
|
+
visitorEmail: he,
|
|
4216
|
+
isAgentTyping: F,
|
|
4217
|
+
isAiTyping: ye,
|
|
4218
|
+
connectionStatus: be,
|
|
4219
|
+
isLoading: xe,
|
|
4220
|
+
isVoiceMode: De,
|
|
4221
|
+
isRateLimited: R,
|
|
4222
|
+
rateLimitMessage: Te,
|
|
4223
4223
|
isConversationEnded: z,
|
|
4224
4224
|
isSessionRestoring: qe,
|
|
4225
|
-
openToChatCounter:
|
|
4226
|
-
voiceEndCounter:
|
|
4225
|
+
openToChatCounter: ke,
|
|
4226
|
+
voiceEndCounter: je,
|
|
4227
4227
|
incomingCall: V,
|
|
4228
4228
|
activeCallId: Le,
|
|
4229
4229
|
callConnectionState: ze,
|
|
@@ -4271,20 +4271,20 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4271
4271
|
D,
|
|
4272
4272
|
k,
|
|
4273
4273
|
j,
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4274
|
+
P,
|
|
4275
|
+
oe,
|
|
4276
|
+
he,
|
|
4277
|
+
F,
|
|
4278
|
+
ye,
|
|
4278
4279
|
be,
|
|
4279
4280
|
xe,
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
Ee,
|
|
4281
|
+
De,
|
|
4282
|
+
R,
|
|
4283
|
+
Te,
|
|
4284
4284
|
z,
|
|
4285
4285
|
qe,
|
|
4286
|
-
|
|
4287
|
-
|
|
4286
|
+
ke,
|
|
4287
|
+
je,
|
|
4288
4288
|
V,
|
|
4289
4289
|
Le,
|
|
4290
4290
|
ze,
|
|
@@ -9269,7 +9269,7 @@ function _h(e, t, n) {
|
|
|
9269
9269
|
try {
|
|
9270
9270
|
n.gain.cancelScheduledValues(t), n.gain.setValueAtTime(n.gain.value, t), n.gain.linearRampToValueAtTime(0, t + gh), e.stop(t + gh);
|
|
9271
9271
|
} catch {}
|
|
9272
|
-
}), a = [], r = 0;
|
|
9272
|
+
}), a = [], r = 0, i = 0;
|
|
9273
9273
|
}, s = () => r > e.currentTime;
|
|
9274
9274
|
return {
|
|
9275
9275
|
enqueue: (o) => {
|
|
@@ -9279,14 +9279,14 @@ function _h(e, t, n) {
|
|
|
9279
9279
|
u.buffer = l;
|
|
9280
9280
|
let d = e.createGain();
|
|
9281
9281
|
u.connect(d), d.connect(e.destination), n && d.connect(n);
|
|
9282
|
-
let f =
|
|
9283
|
-
|
|
9284
|
-
let
|
|
9282
|
+
let f = s() ? r : e.currentTime + fh;
|
|
9283
|
+
i ||= f, u.start(f), r = f + l.duration;
|
|
9284
|
+
let p = {
|
|
9285
9285
|
source: u,
|
|
9286
9286
|
gain: d
|
|
9287
9287
|
};
|
|
9288
|
-
a.push(
|
|
9289
|
-
a = a.filter((e) => e !==
|
|
9288
|
+
a.push(p), u.onended = () => {
|
|
9289
|
+
a = a.filter((e) => e !== p), !a.length && !s() && t?.();
|
|
9290
9290
|
};
|
|
9291
9291
|
},
|
|
9292
9292
|
stop: o,
|
|
@@ -9354,58 +9354,58 @@ async function yh(e) {
|
|
|
9354
9354
|
}
|
|
9355
9355
|
}, O = (e, t, n) => {
|
|
9356
9356
|
t && (T.role && T.role !== e && D(), T.role = e, T.text = T.text ? `${T.text} ${t}`.replace(/\s+/g, " ") : t, n && (T.debug = n), T.timer && clearTimeout(T.timer), T.timer = setTimeout(D, rh));
|
|
9357
|
-
}, k = !1, A = !1, ee = !1, te = !1, ne = !0, j = 0, M = !1, re = !1, ie = ih,
|
|
9358
|
-
|
|
9357
|
+
}, k = !1, A = !1, ee = !1, te = !1, ne = !0, j = 0, M = !1, re = !1, ie = ih, N = ah, P = null, ae = !1, oe = !1, se = () => {
|
|
9358
|
+
P && clearTimeout(P);
|
|
9359
9359
|
let e = () => {
|
|
9360
9360
|
if (!k) {
|
|
9361
|
-
if (
|
|
9362
|
-
|
|
9361
|
+
if (ce.isPlaying()) {
|
|
9362
|
+
P = setTimeout(e, 150);
|
|
9363
9363
|
return;
|
|
9364
9364
|
}
|
|
9365
|
-
if (
|
|
9365
|
+
if (P = null, ae) {
|
|
9366
9366
|
p?.();
|
|
9367
9367
|
return;
|
|
9368
9368
|
}
|
|
9369
|
-
!k && C.readyState === WebSocket.OPEN && C.send(JSON.stringify({ type: "PlaybackDrained" })),
|
|
9369
|
+
!k && C.readyState === WebSocket.OPEN && C.send(JSON.stringify({ type: "PlaybackDrained" })), oe && (oe = !1, d?.());
|
|
9370
9370
|
}
|
|
9371
9371
|
};
|
|
9372
|
-
|
|
9373
|
-
},
|
|
9372
|
+
P = setTimeout(e, 150);
|
|
9373
|
+
}, ce = _h(_, () => {
|
|
9374
9374
|
te && (te = !1, c?.({ mode: "listening" }));
|
|
9375
9375
|
}, v);
|
|
9376
|
-
typeof window < "u" && (window.__fe_agentAudioPlaying = () =>
|
|
9377
|
-
let
|
|
9378
|
-
|
|
9379
|
-
let
|
|
9380
|
-
|
|
9376
|
+
typeof window < "u" && (window.__fe_agentAudioPlaying = () => ce.isPlaying());
|
|
9377
|
+
let le = _.createMediaStreamSource(g);
|
|
9378
|
+
le.connect(v);
|
|
9379
|
+
let ue = _.createScriptProcessor(nh, 1, 1), de = !1, fe = 0, pe = 0;
|
|
9380
|
+
ue.onaudioprocess = (e) => {
|
|
9381
9381
|
if (k || C.readyState !== WebSocket.OPEN) return;
|
|
9382
9382
|
let t = e.inputBuffer.getChannelData(0), n = () => C.send(new Int16Array(t.length).buffer);
|
|
9383
9383
|
if (A) {
|
|
9384
|
-
ee || (ee = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")),
|
|
9384
|
+
ee || (ee = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), de = !1, fe = 0, pe = 0, n();
|
|
9385
9385
|
return;
|
|
9386
9386
|
}
|
|
9387
9387
|
let r = lh(t);
|
|
9388
|
-
if (
|
|
9388
|
+
if (ce.isPlaying() || re ? (de = !1, fe = 0, pe = 0) : r >= oh ? (pe = 0, fe += 1, !de && fe >= sh && (de = !0, c?.({ mode: "user-speaking" }))) : (fe = 0, de && ++pe >= ch && (de = !1, pe = 0, c?.({
|
|
9389
9389
|
mode: "thinking",
|
|
9390
9390
|
tentative: !0
|
|
9391
|
-
}))), (
|
|
9391
|
+
}))), (ce.isPlaying() || re) && !M) {
|
|
9392
9392
|
if (r < ie) j = 0;
|
|
9393
|
-
else if (++j >=
|
|
9393
|
+
else if (++j >= N) {
|
|
9394
9394
|
M = !0, j = 0;
|
|
9395
|
-
let e =
|
|
9396
|
-
|
|
9395
|
+
let e = ce.playedMs();
|
|
9396
|
+
ce.stop(), ne = !1, re = !1, P && !ae && (clearTimeout(P), P = null), oe = !1, C.send(JSON.stringify({
|
|
9397
9397
|
type: "VisitorInterrupted",
|
|
9398
9398
|
played_ms: Math.round(e)
|
|
9399
9399
|
})), console.debug("[FlowEngage] barge-in — visitor spoke over the agent");
|
|
9400
9400
|
}
|
|
9401
9401
|
}
|
|
9402
9402
|
C.send(uh(t).buffer);
|
|
9403
|
-
},
|
|
9404
|
-
let
|
|
9403
|
+
}, le.connect(ue), ue.connect(_.destination);
|
|
9404
|
+
let me = () => {
|
|
9405
9405
|
if (!k) {
|
|
9406
|
-
k = !0,
|
|
9406
|
+
k = !0, P &&= (clearTimeout(P), null), D(), ce.stop(), typeof window < "u" && delete window.__fe_agentAudioPlaying;
|
|
9407
9407
|
try {
|
|
9408
|
-
|
|
9408
|
+
ue.disconnect(), le.disconnect();
|
|
9409
9409
|
} catch {}
|
|
9410
9410
|
if (g.getTracks().forEach((e) => e.stop()), x && x.state !== "inactive") {
|
|
9411
9411
|
x.onstop = () => hh(t, n, S, b, y);
|
|
@@ -9417,7 +9417,7 @@ async function yh(e) {
|
|
|
9417
9417
|
} else b.length && hh(t, n, S, b, y);
|
|
9418
9418
|
_.close().catch(() => {}), (C.readyState === WebSocket.OPEN || C.readyState === WebSocket.CONNECTING) && C.close();
|
|
9419
9419
|
}
|
|
9420
|
-
},
|
|
9420
|
+
}, he = async (e) => {
|
|
9421
9421
|
let t = i[e.name];
|
|
9422
9422
|
if (!t) return u?.({ tool_name: e.name }), { error: `Unknown tool ${e.name}` };
|
|
9423
9423
|
let n = {};
|
|
@@ -9429,10 +9429,10 @@ async function yh(e) {
|
|
|
9429
9429
|
} catch (e) {
|
|
9430
9430
|
return { error: e?.message || "Tool execution failed" };
|
|
9431
9431
|
}
|
|
9432
|
-
},
|
|
9432
|
+
}, ge = async (e) => {
|
|
9433
9433
|
for (let t of e.functions || []) {
|
|
9434
9434
|
if (!t.client_side) continue;
|
|
9435
|
-
let e = await
|
|
9435
|
+
let e = await he(t);
|
|
9436
9436
|
if (k || C.readyState !== WebSocket.OPEN) return;
|
|
9437
9437
|
C.send(JSON.stringify({
|
|
9438
9438
|
type: "FunctionCallResponse",
|
|
@@ -9441,10 +9441,10 @@ async function yh(e) {
|
|
|
9441
9441
|
content: typeof e == "string" ? e : JSON.stringify(e ?? {})
|
|
9442
9442
|
}));
|
|
9443
9443
|
}
|
|
9444
|
-
},
|
|
9444
|
+
}, F = (e) => {
|
|
9445
9445
|
switch (e.type) {
|
|
9446
9446
|
case "Welcome":
|
|
9447
|
-
Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (ie = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && (
|
|
9447
|
+
Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (ie = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && (N = e.barge_in_frames), S = e.session_id || r || n || null, a?.({ conversationId: S });
|
|
9448
9448
|
break;
|
|
9449
9449
|
case "ConversationText": {
|
|
9450
9450
|
let t = String(e.content || "");
|
|
@@ -9463,25 +9463,25 @@ async function yh(e) {
|
|
|
9463
9463
|
break;
|
|
9464
9464
|
}
|
|
9465
9465
|
case "UserStartedSpeaking":
|
|
9466
|
-
D(),
|
|
9466
|
+
D(), ce.stop(), re = !1, ne = !1, te = !1, P && !ae && (clearTimeout(P), P = null), oe = !1, c?.({ mode: "listening" });
|
|
9467
9467
|
break;
|
|
9468
9468
|
case "AgentStartedSpeaking":
|
|
9469
9469
|
ne = !0, te = !0, M = !1, j = 0, c?.({ mode: "speaking" });
|
|
9470
9470
|
break;
|
|
9471
9471
|
case "AgentAudioDone":
|
|
9472
|
-
re = !1, D(),
|
|
9472
|
+
re = !1, D(), se(), ce.isPlaying() || (te = !1, c?.({ mode: "listening" }));
|
|
9473
9473
|
break;
|
|
9474
9474
|
case "FunctionCallRequest":
|
|
9475
|
-
|
|
9475
|
+
ge(e);
|
|
9476
9476
|
break;
|
|
9477
9477
|
case "AgentPreparing":
|
|
9478
9478
|
re = !0;
|
|
9479
9479
|
break;
|
|
9480
9480
|
case "AgentTurnComplete":
|
|
9481
|
-
|
|
9481
|
+
oe = !0, se();
|
|
9482
9482
|
break;
|
|
9483
9483
|
case "SessionEnding":
|
|
9484
|
-
console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"),
|
|
9484
|
+
console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), ae = !0;
|
|
9485
9485
|
break;
|
|
9486
9486
|
case "AgentThinking":
|
|
9487
9487
|
c?.({ mode: "thinking" });
|
|
@@ -9498,16 +9498,16 @@ async function yh(e) {
|
|
|
9498
9498
|
};
|
|
9499
9499
|
return C.onopen = () => C.send(JSON.stringify(h)), C.onmessage = (e) => {
|
|
9500
9500
|
if (e.data instanceof ArrayBuffer) {
|
|
9501
|
-
ne &&
|
|
9501
|
+
ne && ce.enqueue(new Int16Array(e.data));
|
|
9502
9502
|
return;
|
|
9503
9503
|
}
|
|
9504
9504
|
try {
|
|
9505
|
-
|
|
9505
|
+
F(JSON.parse(e.data));
|
|
9506
9506
|
} catch {}
|
|
9507
9507
|
}, C.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), C.onclose = () => {
|
|
9508
|
-
|
|
9508
|
+
me(), o?.();
|
|
9509
9509
|
}, {
|
|
9510
|
-
endSession: async () =>
|
|
9510
|
+
endSession: async () => me(),
|
|
9511
9511
|
sendContextualUpdate: (e) => {
|
|
9512
9512
|
k || C.readyState !== WebSocket.OPEN || !e || C.send(JSON.stringify({
|
|
9513
9513
|
type: "UpdatePrompt",
|
|
@@ -12530,10 +12530,10 @@ function r_(e) {
|
|
|
12530
12530
|
sender: "user",
|
|
12531
12531
|
message: e
|
|
12532
12532
|
}]);
|
|
12533
|
-
n &&
|
|
12533
|
+
n && L(t, n);
|
|
12534
12534
|
}
|
|
12535
12535
|
} catch {}
|
|
12536
|
-
|
|
12536
|
+
Ce();
|
|
12537
12537
|
let e = a;
|
|
12538
12538
|
try {
|
|
12539
12539
|
e = new URL(a, typeof window < "u" ? window.location.href : "").href;
|
|
@@ -12543,7 +12543,7 @@ function r_(e) {
|
|
|
12543
12543
|
let e = new URL(a, window.location.href).pathname.split("/").filter(Boolean).pop() || "";
|
|
12544
12544
|
n = e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) : "Home";
|
|
12545
12545
|
} catch {}
|
|
12546
|
-
t && typeof window < "u" &&
|
|
12546
|
+
t && typeof window < "u" && Ae(t, window.location.href, e, n), gr(e);
|
|
12547
12547
|
try {
|
|
12548
12548
|
window.__fe_agent_nav = {
|
|
12549
12549
|
path: new URL(e, window.location.href).pathname,
|
|
@@ -12908,7 +12908,7 @@ function r_(e) {
|
|
|
12908
12908
|
try {
|
|
12909
12909
|
r = new URL(e, window.location.href).href;
|
|
12910
12910
|
} catch {}
|
|
12911
|
-
return t &&
|
|
12911
|
+
return t && Ae(t, window.location.href, r, n), gr(r), Cr().then(() => {
|
|
12912
12912
|
window.location.assign(r);
|
|
12913
12913
|
}), `OK_NAVIGATING to ${n}. The page is loading — say one short phrase like "Here you go." and nothing more.`;
|
|
12914
12914
|
}
|
|
@@ -13366,87 +13366,92 @@ function v_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
13366
13366
|
}
|
|
13367
13367
|
function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", thinkingLabel: S = "Thinking...", enterChatModeLabel: C = "Enter Chat Mode", endConversationLabel: w = "End Conversation" }) {
|
|
13368
13368
|
c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
|
|
13369
|
-
let [T, E] = m("idle"), [D, O] = m(!1), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(""), [M, re] = m(""), ie = p(!1),
|
|
13370
|
-
|
|
13369
|
+
let [T, E] = m("idle"), [D, O] = m(!1), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(""), [M, re] = m(""), ie = p(!1), N = p(!1), P = p(null), ae = p(0), oe = p(""), se = p(!1), ce = p(0), le = p(!1), ue = p(!1), de = p(!1), fe = p([]), pe = p(null), me = p(null), he = (e) => {
|
|
13370
|
+
le.current = e, e || (ue.current = !1), F.current?.setWalkthroughActive?.(e);
|
|
13371
13371
|
};
|
|
13372
13372
|
me.current = async () => {
|
|
13373
|
-
if (
|
|
13374
|
-
let e =
|
|
13373
|
+
if (ue.current) return;
|
|
13374
|
+
let e = typeof window < "u" ? window.location.pathname : null;
|
|
13375
|
+
if (e && pe.current && e !== pe.current) {
|
|
13376
|
+
console.log("[FlowEngage] walkthrough ended — visitor left " + pe.current), pe.current = null, fe.current = [], he(!1);
|
|
13377
|
+
return;
|
|
13378
|
+
}
|
|
13379
|
+
let t = fe.current;
|
|
13375
13380
|
ge.current += 1;
|
|
13376
|
-
let
|
|
13377
|
-
if (!
|
|
13378
|
-
if (he(!1),
|
|
13379
|
-
else if (
|
|
13381
|
+
let n = ge.current, r = t[n];
|
|
13382
|
+
if (!r) {
|
|
13383
|
+
if (he(!1), t.length) F.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
|
|
13384
|
+
else if (n === 0) {
|
|
13380
13385
|
let e = "";
|
|
13381
13386
|
try {
|
|
13382
13387
|
let t = await _e.current?.["fwh-read-content-mvp"]?.({});
|
|
13383
13388
|
typeof t == "string" && t && !/^Could not/i.test(t) && (e = t.slice(0, 2800));
|
|
13384
13389
|
} catch {}
|
|
13385
|
-
|
|
13390
|
+
F.current?.sendUserMessage?.(e ? `Give the visitor a complete spoken overview of this page in 4-6 sentences, based ONLY on this page content:\n"""${e}"""\nThen ask which part they'd like to hear more about. Do not call any tool.` : "Give the visitor a complete spoken overview of this page in 4-6 sentences based on what you know about it, then ask which part they'd like to hear more about. Do not call any tool.", { suppressQuestion: !0 });
|
|
13386
13391
|
}
|
|
13387
13392
|
return;
|
|
13388
13393
|
}
|
|
13389
13394
|
try {
|
|
13390
|
-
await _e.current?.highlightOnPage?.({ section_text:
|
|
13395
|
+
await _e.current?.highlightOnPage?.({ section_text: r });
|
|
13391
13396
|
} catch (e) {
|
|
13392
13397
|
console.warn("[FlowEngage] walkthrough highlight failed:", e?.message || e);
|
|
13393
13398
|
}
|
|
13394
|
-
console.debug(`[FlowEngage] walkthrough step ${
|
|
13395
|
-
let
|
|
13399
|
+
console.debug(`[FlowEngage] walkthrough step ${n + 1}/${t.length}: ${r}`);
|
|
13400
|
+
let i = "";
|
|
13396
13401
|
try {
|
|
13397
|
-
let e = await _e.current?.["fwh-read-content-mvp"]?.({ section_text:
|
|
13398
|
-
typeof e == "string" && e && !/^Could not/i.test(e) && (
|
|
13402
|
+
let e = await _e.current?.["fwh-read-content-mvp"]?.({ section_text: r });
|
|
13403
|
+
typeof e == "string" && e && !/^Could not/i.test(e) && (i = e.slice(0, 2500));
|
|
13399
13404
|
} catch {}
|
|
13400
|
-
let
|
|
13401
|
-
|
|
13405
|
+
let a = i ? `Here is this section's full content — describe it from THIS text only, and do not call any tool:\n"""${i}"""\n` : "read the section's content silently first (fwh-read-content-mvp) if you don't already have it. ";
|
|
13406
|
+
F.current?.sendUserMessage?.(`Describe the section titled "${r}" in 3-4 sentences, starting with ${n === 0 ? "Starting with" : "Next —"} ${r}. Describe ONLY this section. If this section contains named sub-items (steps, checklist entries, cards, plans, FAQs, team members), name EVERY one of them in order with a short phrase each — never skip or collapse them into a summary; ` + a + "This section is ON THE PAGE THE VISITOR IS ALREADY ON — do NOT call fwh-navigate-mvp, do not go to a product/detail page, and do not offer to, even if this section's name also matches a page name. Do not mention any other section, do not ask whether to continue, then stop.", { suppressQuestion: !0 });
|
|
13402
13407
|
};
|
|
13403
|
-
let ge = p(0),
|
|
13408
|
+
let ge = p(0), F = p(null), _e = p(null), ve = p(""), ye = p(async () => {}), I = p(!1), be = p(!1), R = p(!1), we = p(!1), Te = p("minimized"), Ee = p(null), De = p(null), ke = p(null), Ae = p(0), Me = p(!1), z = p("idle"), Ne = p(null), Pe = p(!1), Fe = p(null), B = o((e = "minimized") => {
|
|
13404
13409
|
console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
|
|
13405
13410
|
destination: e,
|
|
13406
13411
|
stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
|
|
13407
|
-
}), Te.current = e,
|
|
13408
|
-
|
|
13412
|
+
}), Te.current = e, we.current = !0, queueMicrotask(() => {
|
|
13413
|
+
I.current || (I.current = !0, ye.current?.());
|
|
13409
13414
|
});
|
|
13410
|
-
}, [l]),
|
|
13411
|
-
|
|
13415
|
+
}, [l]), V = o(() => {
|
|
13416
|
+
P.current &&= (clearTimeout(P.current), null);
|
|
13412
13417
|
}, []);
|
|
13413
13418
|
c(() => {
|
|
13414
13419
|
if (y) {
|
|
13415
13420
|
ie.current = !1;
|
|
13416
13421
|
return;
|
|
13417
13422
|
}
|
|
13418
|
-
if (ie.current = !0,
|
|
13419
|
-
|
|
13420
|
-
let e =
|
|
13421
|
-
|
|
13422
|
-
}
|
|
13423
|
-
|
|
13424
|
-
}, [y,
|
|
13425
|
-
let
|
|
13426
|
-
|
|
13427
|
-
if (!(!
|
|
13428
|
-
|
|
13423
|
+
if (ie.current = !0, N.current = !1, te(!1), V(), se.current) {
|
|
13424
|
+
se.current = !1, F.current?.setMicMuted?.(!1);
|
|
13425
|
+
let e = oe.current;
|
|
13426
|
+
oe.current = "", F.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && F.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
|
|
13427
|
+
}
|
|
13428
|
+
F.current?.sendContextualUpdate?.("EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.");
|
|
13429
|
+
}, [y, V]);
|
|
13430
|
+
let Ie = /(walk\s*(me\s*)?through|walkthrough|take me through|(complete|full|detailed) (overview|understanding|walkthrough|picture|breakdown|explanation)|give me (a|an|the) (overview|tour|walk)|tell me about (each|all)|go through (it|them|each|all)|overview of|one by one|tell me everything|explain (me )?(this|the) (whole |entire |full )?page|everything (about|on) this page|show me (each|all|around))/i, Le = /(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i, Re = /^((uh+|um+|so|well|okay|ok|yeah)[,.\s]+)*(yes|yeah|yep|yup|sure|ok(ay)?|please|continue|go on|next|keep going|carry on|go ahead|resume|back to the tour)[\s.!,]*$/i, ze = /^((uh+|um+|oh|ah|so|well)[,.\s]+)*(cool|nice|great|awesome|wow|lovely|perfect|got it|gotcha|i see|understood|makes sense|interesting|right|alright|sounds good|mm+-?hmm+|hmm+|k)[\s.!,]*$/i, Be = (e) => String(e || "").replace(/[\s.,!?]*((uh+|um+|er+|hmm+|mm+)[\s.,!?]*)+$/i, "").trim(), Ve = o(() => {
|
|
13431
|
+
V(), P.current = setTimeout(() => {
|
|
13432
|
+
if (!(!N.current || ie.current)) if (ae.current < 3) {
|
|
13433
|
+
ae.current += 1;
|
|
13429
13434
|
try {
|
|
13430
|
-
|
|
13435
|
+
F.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
|
|
13431
13436
|
} catch {}
|
|
13432
|
-
|
|
13437
|
+
Ve();
|
|
13433
13438
|
} else {
|
|
13434
13439
|
try {
|
|
13435
|
-
|
|
13440
|
+
F.current?.injectAgentSpeech?.("Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!", "queue");
|
|
13436
13441
|
} catch {}
|
|
13437
|
-
|
|
13442
|
+
N.current = !1, te(!1), V(), Me.current = !0;
|
|
13438
13443
|
}
|
|
13439
13444
|
}, 1e4);
|
|
13440
|
-
}, [
|
|
13441
|
-
|
|
13445
|
+
}, [V]), He = o(async (e) => {
|
|
13446
|
+
we.current = !0;
|
|
13442
13447
|
try {
|
|
13443
13448
|
On();
|
|
13444
13449
|
} catch {}
|
|
13445
13450
|
if (i) try {
|
|
13446
|
-
|
|
13451
|
+
je(i);
|
|
13447
13452
|
} catch {}
|
|
13448
13453
|
try {
|
|
13449
|
-
await
|
|
13454
|
+
await F.current?.endSession?.();
|
|
13450
13455
|
} catch {}
|
|
13451
13456
|
let t = Ee.current, n = De.current;
|
|
13452
13457
|
if (t && s && a) {
|
|
@@ -13462,8 +13467,8 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13462
13467
|
})
|
|
13463
13468
|
}).catch((e) => console.warn("[FlowEngage] save-chat-recording failed:", e.message));
|
|
13464
13469
|
}
|
|
13465
|
-
if (Ee.current = null, De.current = null,
|
|
13466
|
-
|
|
13470
|
+
if (Ee.current = null, De.current = null, F.current = null, E("idle"), O(!1), I.current = !1, Or(), i) try {
|
|
13471
|
+
Se(i);
|
|
13467
13472
|
} catch {}
|
|
13468
13473
|
typeof u == "function" && await u(l.current), e?.();
|
|
13469
13474
|
}, [
|
|
@@ -13473,10 +13478,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13473
13478
|
s,
|
|
13474
13479
|
a
|
|
13475
13480
|
]);
|
|
13476
|
-
ye.current = () =>
|
|
13477
|
-
|
|
13481
|
+
ye.current = () => He(Te.current === "chat" ? t : n), c(() => {
|
|
13482
|
+
be.current = D;
|
|
13478
13483
|
}, [D]), c(() => {
|
|
13479
|
-
d &&
|
|
13484
|
+
d && B("chat");
|
|
13480
13485
|
}, [d]), c(() => {
|
|
13481
13486
|
let e = !1, o = null, c = null, d = null;
|
|
13482
13487
|
return (async () => {
|
|
@@ -13486,10 +13491,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13486
13491
|
}
|
|
13487
13492
|
try {
|
|
13488
13493
|
if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
|
|
13489
|
-
l.current = [], ve.current = "",
|
|
13494
|
+
l.current = [], ve.current = "", I.current = !1, R.current = !1, we.current = !1, Te.current = "minimized", Dr({ onBeforeNavigate: () => {
|
|
13490
13495
|
if (i && l.current.length > 0) try {
|
|
13491
13496
|
let e = _g(l.current);
|
|
13492
|
-
e &&
|
|
13497
|
+
e && L(i, e);
|
|
13493
13498
|
} catch {}
|
|
13494
13499
|
if (!qn()) {
|
|
13495
13500
|
let e = Ee.current, t = De.current;
|
|
@@ -13508,21 +13513,21 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13508
13513
|
}).catch(() => {}), Ee.current = null, De.current = null;
|
|
13509
13514
|
} catch {}
|
|
13510
13515
|
}
|
|
13511
|
-
|
|
13516
|
+
Ce();
|
|
13512
13517
|
} });
|
|
13513
13518
|
let t = o_(r_({
|
|
13514
13519
|
siteId: i || null,
|
|
13515
13520
|
apiBaseUrl: a || null,
|
|
13516
13521
|
chatId: s || null,
|
|
13517
13522
|
getLastUserVoiceText: () => ve.current,
|
|
13518
|
-
isWalkthroughActive: () =>
|
|
13523
|
+
isWalkthroughActive: () => le.current && !ue.current,
|
|
13519
13524
|
requestEndSession: () => {
|
|
13520
|
-
|
|
13525
|
+
Me.current = !0;
|
|
13521
13526
|
},
|
|
13522
13527
|
requestEmailCollection: () => {
|
|
13523
|
-
b && (ie.current ||
|
|
13528
|
+
b && (ie.current || N.current || (N.current = !0, ae.current = 0, te(!0), Ve()));
|
|
13524
13529
|
}
|
|
13525
|
-
})), n = i ?
|
|
13530
|
+
})), n = i ? xe(i) : null, r = !!n?.transcript, u = i ? je(i) : null, p = !!u, m = typeof window < "u" ? window.location.pathname : "/", g = typeof document < "u" ? document.title : "", _ = m.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i, "") || "/", v = _ === "/" || _ === "", x = {
|
|
13526
13531
|
apiBaseUrl: a,
|
|
13527
13532
|
siteId: i,
|
|
13528
13533
|
chatId: s,
|
|
@@ -13555,123 +13560,123 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13555
13560
|
let e = f || "";
|
|
13556
13561
|
x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to ${T}! How may I help you?`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
|
|
13557
13562
|
}
|
|
13558
|
-
let A = !1, ee = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, ne = !1, j = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, M = r && !p, re = !1,
|
|
13563
|
+
let A = !1, ee = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, ne = !1, j = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, M = r && !p, re = !1, P = M ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, ye = !1, Se = !1, ke = b && !!y && !de.current, He = await bh.startSession({
|
|
13559
13564
|
...x,
|
|
13560
13565
|
onConnect: ({ conversationId: e }) => {
|
|
13561
13566
|
Ee.current = e, De.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
13562
13567
|
},
|
|
13563
13568
|
onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
|
|
13564
13569
|
onSessionInfo: ({ emailOnFile: e }) => {
|
|
13565
|
-
|
|
13570
|
+
de.current = !!e, e && (ie.current = !0, N.current = !1, te(!1), V(), console.log("[FlowEngage] email already on file per server — gate disabled"));
|
|
13566
13571
|
},
|
|
13567
13572
|
onAgentTurnEnd: () => {
|
|
13568
|
-
e ||
|
|
13573
|
+
e || le.current && (ue.current || se.current || setTimeout(() => me.current?.(), 250));
|
|
13569
13574
|
},
|
|
13570
13575
|
onSessionEnding: () => {
|
|
13571
|
-
e ||
|
|
13576
|
+
e || B("minimized");
|
|
13572
13577
|
},
|
|
13573
13578
|
onModeChange: ({ mode: t, tentative: n }) => {
|
|
13574
13579
|
if (!e) {
|
|
13575
13580
|
if (t === "speaking") {
|
|
13576
|
-
|
|
13581
|
+
Ne.current &&= (clearTimeout(Ne.current), null), Fe.current &&= (clearTimeout(Fe.current), null), E("speaking"), z.current = "speaking", Pe.current = !1;
|
|
13577
13582
|
return;
|
|
13578
13583
|
}
|
|
13579
13584
|
if (t === "user-speaking") {
|
|
13580
|
-
if (
|
|
13585
|
+
if (N.current && !ie.current && Ve(), Fe.current &&= (clearTimeout(Fe.current), null), z.current === "speaking") return;
|
|
13581
13586
|
try {
|
|
13582
13587
|
On();
|
|
13583
13588
|
} catch {}
|
|
13584
|
-
|
|
13589
|
+
Ne.current &&= (clearTimeout(Ne.current), null), z.current !== "listening" && (E("listening"), z.current = "listening");
|
|
13585
13590
|
return;
|
|
13586
13591
|
}
|
|
13587
13592
|
if (t === "thinking") {
|
|
13588
|
-
if (
|
|
13589
|
-
E("thinking"),
|
|
13590
|
-
|
|
13593
|
+
if (Ne.current &&= (clearTimeout(Ne.current), null), Fe.current &&= (clearTimeout(Fe.current), null), z.current === "speaking") return;
|
|
13594
|
+
E("thinking"), z.current = "thinking", n && (Fe.current = setTimeout(() => {
|
|
13595
|
+
Fe.current = null, !(e || z.current !== "thinking") && (z.current = "listening", E("listening"));
|
|
13591
13596
|
}, 4e3));
|
|
13592
13597
|
return;
|
|
13593
13598
|
}
|
|
13594
|
-
if (
|
|
13595
|
-
|
|
13599
|
+
if (z.current = "listening", Me.current) {
|
|
13600
|
+
Me.current = !1, B();
|
|
13596
13601
|
return;
|
|
13597
13602
|
}
|
|
13598
|
-
if (
|
|
13599
|
-
|
|
13603
|
+
if (ke && !Se && !ie.current && !de.current) {
|
|
13604
|
+
Se = !0, A = !0, ne = !0;
|
|
13600
13605
|
try {
|
|
13601
|
-
|
|
13606
|
+
F.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. The app itself speaks the email request out loud — you must NOT say it, and you must NOT answer. Stay completely silent from now until you receive an EMAIL_SAVED message: produce no speech and call no tools, no matter what the visitor says. Remember their question. On EMAIL_SAVED, thank them briefly and answer that remembered question in full.");
|
|
13602
13607
|
} catch {}
|
|
13603
13608
|
}
|
|
13604
13609
|
if (ee && !A) {
|
|
13605
13610
|
A = !0;
|
|
13606
13611
|
try {
|
|
13607
|
-
|
|
13612
|
+
F.current?.sendContextualUpdate?.(ee);
|
|
13608
13613
|
} catch {}
|
|
13609
13614
|
}
|
|
13610
|
-
if (
|
|
13615
|
+
if (P && !re) {
|
|
13611
13616
|
re = !0;
|
|
13612
13617
|
try {
|
|
13613
|
-
|
|
13618
|
+
F.current?.sendContextualUpdate?.(P);
|
|
13614
13619
|
} catch {}
|
|
13615
13620
|
}
|
|
13616
13621
|
if (j && !ne) {
|
|
13617
13622
|
ne = !0;
|
|
13618
13623
|
try {
|
|
13619
|
-
|
|
13624
|
+
F.current?.sendContextualUpdate?.(j);
|
|
13620
13625
|
} catch {}
|
|
13621
13626
|
}
|
|
13622
|
-
|
|
13623
|
-
e ||
|
|
13627
|
+
Ne.current && clearTimeout(Ne.current), Ne.current = setTimeout(() => {
|
|
13628
|
+
e || z.current !== "speaking" && (Pe.current || (Ne.current = null, z.current = "listening", E("listening")));
|
|
13624
13629
|
}, 1200);
|
|
13625
13630
|
}
|
|
13626
13631
|
},
|
|
13627
13632
|
onMessage: (t) => {
|
|
13628
|
-
if (e ||
|
|
13633
|
+
if (e || se.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
|
|
13629
13634
|
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()), r = /\b(?:this|that|the)\s+(?:case\s*stud(?:y|ies)|product|article|blog|post|item|service)\b/i.test(String(t.message || ""));
|
|
13630
|
-
if (!n && !r && t.role === "user" &&
|
|
13631
|
-
else if (!n && t.role === "user" &&
|
|
13632
|
-
let e = String(t.message || "").trim();
|
|
13633
|
-
|
|
13635
|
+
if (!n && !r && t.role === "user" && Ie.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), he(!0), ue.current = !1, ce.current = 0, ge.current = -1, fe.current = a_(), pe.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${fe.current.length} sections on this page`);
|
|
13636
|
+
else if (!n && t.role === "user" && le.current) {
|
|
13637
|
+
let e = String(t.message || "").trim(), n = Be(e), r = (e) => !!e && (Re.test(e) || ze.test(e));
|
|
13638
|
+
!n || r(e) || r(n) ? ue.current && (ue.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => me.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), pe.current = null, fe.current = [], he(!1));
|
|
13634
13639
|
}
|
|
13635
|
-
if (t.role !== "user" &&
|
|
13636
|
-
let e =
|
|
13640
|
+
if (t.role !== "user" && Le.test(String(t.message || ""))) {
|
|
13641
|
+
let e = fe.current.length;
|
|
13637
13642
|
!e || ge.current >= e - 1 ? he(!1) : console.debug(`[FlowEngage] agent claimed completion at step ${ge.current + 1}/${e} — ignoring, tour continues`);
|
|
13638
13643
|
}
|
|
13639
13644
|
let a = t.role === "user" ? "user" : "bot", o = t.message || t.text || t.content || "";
|
|
13640
13645
|
if (o) {
|
|
13641
|
-
if (a === "user" && (ve.current = o, typeof window < "u" && (window.__fe_user_nav_during_speech = null),
|
|
13646
|
+
if (a === "user" && (ve.current = o, typeof window < "u" && (window.__fe_user_nav_during_speech = null), Pe.current = !0, Ne.current &&= (clearTimeout(Ne.current), null), z.current !== "speaking" && (E("thinking"), z.current = "thinking"), ke && !ye && !ie.current && !de.current && (ye = !0, oe.current = o, se.current = !0, F.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), F.current?.setMicMuted?.(!0), N.current || (N.current = !0, ae.current = 0, te(!0), Ve()))), l.current = [...l.current, {
|
|
13642
13647
|
sender: a,
|
|
13643
13648
|
message: o,
|
|
13644
13649
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13645
13650
|
debug: t.debug
|
|
13646
13651
|
}], i) try {
|
|
13647
13652
|
let e = _g(l.current);
|
|
13648
|
-
e &&
|
|
13653
|
+
e && L(i, e);
|
|
13649
13654
|
} catch {}
|
|
13650
13655
|
if (h_(a, o)) {
|
|
13651
|
-
|
|
13656
|
+
Me.current = !0;
|
|
13652
13657
|
return;
|
|
13653
13658
|
}
|
|
13654
|
-
if (
|
|
13655
|
-
|
|
13659
|
+
if (be.current && a === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(o)) if (Ae.current += 1, Ae.current === 2) try {
|
|
13660
|
+
F.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.");
|
|
13656
13661
|
} catch {}
|
|
13657
|
-
else Ae.current >= 5 &&
|
|
13662
|
+
else Ae.current >= 5 && B("minimized");
|
|
13658
13663
|
}
|
|
13659
13664
|
},
|
|
13660
13665
|
onError: (t) => {
|
|
13661
|
-
if (!e && !
|
|
13662
|
-
|
|
13666
|
+
if (!e && !we.current && !R.current && !Oe()) {
|
|
13667
|
+
R.current = !0, console.error("[FlowEngageVoiceCall] session:error", {
|
|
13663
13668
|
message: t?.message,
|
|
13664
13669
|
name: t?.name,
|
|
13665
13670
|
raw: t
|
|
13666
13671
|
});
|
|
13667
13672
|
try {
|
|
13668
|
-
|
|
13673
|
+
F.current?.setMicMuted?.(!0);
|
|
13669
13674
|
} catch {}
|
|
13670
|
-
O(!0), E("error"),
|
|
13675
|
+
O(!0), E("error"), B("chat");
|
|
13671
13676
|
}
|
|
13672
13677
|
},
|
|
13673
13678
|
onDisconnect: (t) => {
|
|
13674
|
-
if (e ||
|
|
13679
|
+
if (e || we.current || R.current || Oe()) return;
|
|
13675
13680
|
let n = l.current?.length || 0;
|
|
13676
13681
|
console.warn("[FlowEngageVoiceCall] session:disconnected", {
|
|
13677
13682
|
historyCount: n,
|
|
@@ -13679,21 +13684,21 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13679
13684
|
closeCode: t?.context?.code,
|
|
13680
13685
|
closeReason: t?.context?.reason || t?.message,
|
|
13681
13686
|
lastUserText: ve.current || "",
|
|
13682
|
-
wasMuted:
|
|
13683
|
-
}),
|
|
13687
|
+
wasMuted: be.current
|
|
13688
|
+
}), R.current = !0;
|
|
13684
13689
|
try {
|
|
13685
|
-
|
|
13690
|
+
F.current?.setMicMuted?.(!0);
|
|
13686
13691
|
} catch {}
|
|
13687
|
-
O(!0),
|
|
13692
|
+
O(!0), B("chat");
|
|
13688
13693
|
}
|
|
13689
13694
|
});
|
|
13690
13695
|
if (e) {
|
|
13691
|
-
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"),
|
|
13696
|
+
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), He.endSession().catch(() => {});
|
|
13692
13697
|
return;
|
|
13693
13698
|
}
|
|
13694
|
-
o =
|
|
13699
|
+
o = He, F.current = He, E("listening");
|
|
13695
13700
|
try {
|
|
13696
|
-
sessionStorage.setItem(`el_conv_${i}`,
|
|
13701
|
+
sessionStorage.setItem(`el_conv_${i}`, He.getId());
|
|
13697
13702
|
} catch {}
|
|
13698
13703
|
parent.postMessage({ type: "AGENT_EXPAND" }, "*");
|
|
13699
13704
|
try {
|
|
@@ -13707,7 +13712,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13707
13712
|
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(" | "));
|
|
13708
13713
|
} catch {}
|
|
13709
13714
|
let s = r && !p ? `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` : "";
|
|
13710
|
-
|
|
13715
|
+
He.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${y ? "" : "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.`), He.sendContextualUpdate(c_(e, o, a));
|
|
13711
13716
|
} catch {}
|
|
13712
13717
|
if (typeof window < "u") {
|
|
13713
13718
|
let t = window.location.pathname, n = Date.now(), r = (e) => {
|
|
@@ -13740,10 +13745,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13740
13745
|
if (o) {
|
|
13741
13746
|
typeof window < "u" && (window.__fe_agent_nav = null), console.log(`[FlowEngage] agent-driven navigation settled: "${s}" → "${i}"`);
|
|
13742
13747
|
try {
|
|
13743
|
-
|
|
13748
|
+
F.current?.sendUserMessage?.(`[SYSTEM: YOU just navigated the visitor to the "${m}" page (${c}) at their request — this was YOUR action, not theirs. Page title: "${l}". Sections: ${JSON.stringify(u)}. Say: "Here we are on the ${m} page." Then introduce this page in 2-3 sentences, and finish by asking: "Would you like me to walk you through it section by section?" NEVER say "I see you've navigated" — the visitor did not navigate, you did. Do NOT call fwh-navigate-mvp again. Wait for their answer before describing sections.]`, { suppressQuestion: !0 });
|
|
13744
13749
|
} catch {}
|
|
13745
13750
|
try {
|
|
13746
|
-
|
|
13751
|
+
F.current?.sendContextualUpdate?.(c_(c, d));
|
|
13747
13752
|
} catch {}
|
|
13748
13753
|
return;
|
|
13749
13754
|
}
|
|
@@ -13755,10 +13760,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13755
13760
|
ts: Date.now()
|
|
13756
13761
|
}), console.log(`[FlowEngage] visitor navigation detected: "${s}" → "${i}" (agent target: ${k || "none"})`);
|
|
13757
13762
|
try {
|
|
13758
|
-
|
|
13763
|
+
F.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${m}" page (${c}). Page title: "${l}". Sections: ${JSON.stringify(u)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${m} 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 "${m}" only.]`);
|
|
13759
13764
|
} catch {}
|
|
13760
13765
|
try {
|
|
13761
|
-
|
|
13766
|
+
F.current?.sendContextualUpdate?.(c_(c, d));
|
|
13762
13767
|
} catch {}
|
|
13763
13768
|
};
|
|
13764
13769
|
c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
|
|
@@ -13775,15 +13780,15 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13775
13780
|
agentId: r,
|
|
13776
13781
|
siteId: i,
|
|
13777
13782
|
apiBaseUrl: a
|
|
13778
|
-
}), e = !0,
|
|
13783
|
+
}), e = !0, we.current = !0;
|
|
13779
13784
|
try {
|
|
13780
13785
|
On();
|
|
13781
13786
|
} catch {}
|
|
13782
13787
|
if (i) try {
|
|
13783
|
-
|
|
13788
|
+
je(i);
|
|
13784
13789
|
} catch {}
|
|
13785
|
-
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Or(),
|
|
13786
|
-
let t = o ||
|
|
13790
|
+
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Or(), Ne.current &&= (clearTimeout(Ne.current), null), Fe.current &&= (clearTimeout(Fe.current), null), P.current &&= (clearTimeout(P.current), null), Pe.current = !1, z.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
|
|
13791
|
+
let t = o || F.current, n = Ee.current, f = De.current;
|
|
13787
13792
|
if (t?.endSession?.().catch(() => {}), n && s && a) {
|
|
13788
13793
|
let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
|
|
13789
13794
|
chatId: s,
|
|
@@ -13804,53 +13809,53 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13804
13809
|
r,
|
|
13805
13810
|
i,
|
|
13806
13811
|
a,
|
|
13807
|
-
|
|
13812
|
+
B
|
|
13808
13813
|
]), c(() => {
|
|
13809
13814
|
if (!k) return;
|
|
13810
13815
|
let e = (e) => {
|
|
13811
13816
|
let t = e.composedPath?.()?.[0] || e.target;
|
|
13812
|
-
|
|
13817
|
+
ke.current && !ke.current.contains(t) && A(!1);
|
|
13813
13818
|
};
|
|
13814
13819
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
13815
13820
|
}, [k]);
|
|
13816
|
-
let
|
|
13817
|
-
if (
|
|
13821
|
+
let Ue = async () => {
|
|
13822
|
+
if (F.current) try {
|
|
13818
13823
|
if (D) {
|
|
13819
|
-
Ae.current = 0, await
|
|
13824
|
+
Ae.current = 0, await F.current.setMicMuted?.(!1), O(!1);
|
|
13820
13825
|
try {
|
|
13821
|
-
|
|
13826
|
+
F.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
|
|
13822
13827
|
} catch {}
|
|
13823
13828
|
} else {
|
|
13824
|
-
Ae.current = 0, await
|
|
13829
|
+
Ae.current = 0, await F.current.setMicMuted?.(!0), O(!0);
|
|
13825
13830
|
try {
|
|
13826
|
-
|
|
13831
|
+
F.current.sendContextualUpdate?.("The visitor has muted their microphone. Do NOT speak, ask if they are there, or prompt them in any way. Stay completely silent until they unmute.");
|
|
13827
13832
|
} catch {}
|
|
13828
13833
|
}
|
|
13829
13834
|
} catch {}
|
|
13830
|
-
},
|
|
13835
|
+
}, We = o(async (e) => {
|
|
13831
13836
|
e?.preventDefault?.();
|
|
13832
13837
|
let t = ne.trim().toLowerCase();
|
|
13833
13838
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
|
|
13834
13839
|
re("Please enter a valid email address.");
|
|
13835
13840
|
return;
|
|
13836
13841
|
}
|
|
13837
|
-
re(""), ie.current = !0,
|
|
13842
|
+
re(""), ie.current = !0, N.current = !1, V(), te(!1), j(""), se.current = !1;
|
|
13838
13843
|
try {
|
|
13839
13844
|
typeof v == "function" && await v(t);
|
|
13840
13845
|
} catch {}
|
|
13841
|
-
|
|
13842
|
-
let n =
|
|
13843
|
-
|
|
13846
|
+
F.current?.setMicMuted?.(!1);
|
|
13847
|
+
let n = oe.current;
|
|
13848
|
+
oe.current = "";
|
|
13844
13849
|
try {
|
|
13845
|
-
|
|
13850
|
+
F.current?.injectAgentSpeech?.("Thank you for submitting your email."), F.current?.sendUserMessage?.(n || "The visitor's email is on file. Carry on helping them and never ask for it again.");
|
|
13846
13851
|
} catch {}
|
|
13847
13852
|
}, [
|
|
13848
13853
|
ne,
|
|
13849
13854
|
v,
|
|
13850
|
-
|
|
13851
|
-
]),
|
|
13855
|
+
V
|
|
13856
|
+
]), Ge = Array.isArray(e) && e[0] || "#3B82F6";
|
|
13852
13857
|
return /* @__PURE__ */ _("div", {
|
|
13853
|
-
ref:
|
|
13858
|
+
ref: ke,
|
|
13854
13859
|
style: {
|
|
13855
13860
|
position: "relative",
|
|
13856
13861
|
display: "flex",
|
|
@@ -13861,7 +13866,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13861
13866
|
},
|
|
13862
13867
|
children: [
|
|
13863
13868
|
ee && /* @__PURE__ */ _("form", {
|
|
13864
|
-
onSubmit:
|
|
13869
|
+
onSubmit: We,
|
|
13865
13870
|
style: {
|
|
13866
13871
|
width: "270px",
|
|
13867
13872
|
maxWidth: "calc(100vw - 40px)",
|
|
@@ -13924,7 +13929,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13924
13929
|
padding: "10px 12px",
|
|
13925
13930
|
borderRadius: "10px",
|
|
13926
13931
|
border: "none",
|
|
13927
|
-
background: ne.trim() ?
|
|
13932
|
+
background: ne.trim() ? Ge : "#374151",
|
|
13928
13933
|
color: "white",
|
|
13929
13934
|
fontSize: "14px",
|
|
13930
13935
|
fontWeight: 600,
|
|
@@ -13993,7 +13998,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13993
13998
|
alignItems: "center"
|
|
13994
13999
|
},
|
|
13995
14000
|
children: [/* @__PURE__ */ g("button", {
|
|
13996
|
-
onClick:
|
|
14001
|
+
onClick: Ue,
|
|
13997
14002
|
title: D ? "Unmute" : "Mute",
|
|
13998
14003
|
style: {
|
|
13999
14004
|
width: "24px",
|
|
@@ -14088,7 +14093,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14088
14093
|
children: [
|
|
14089
14094
|
/* @__PURE__ */ _("button", {
|
|
14090
14095
|
onClick: () => {
|
|
14091
|
-
A(!1), Te.current = "chat",
|
|
14096
|
+
A(!1), Te.current = "chat", He(t);
|
|
14092
14097
|
},
|
|
14093
14098
|
style: {
|
|
14094
14099
|
display: "flex",
|
|
@@ -14117,7 +14122,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14117
14122
|
}),
|
|
14118
14123
|
/* @__PURE__ */ _("button", {
|
|
14119
14124
|
onClick: () => {
|
|
14120
|
-
A(!1), Te.current = "minimized",
|
|
14125
|
+
A(!1), Te.current = "minimized", He(n);
|
|
14121
14126
|
},
|
|
14122
14127
|
style: {
|
|
14123
14128
|
display: "flex",
|
|
@@ -14243,8 +14248,8 @@ var x_ = () => /* @__PURE__ */ g("div", {
|
|
|
14243
14248
|
} }, e))
|
|
14244
14249
|
})
|
|
14245
14250
|
});
|
|
14246
|
-
function S_({ 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:
|
|
14247
|
-
let
|
|
14251
|
+
function S_({ 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: N, setReplyContext: P, webRTCError: ae, micError: oe, setMicError: se, dismissCallError: ce, activeCallId: le, isCallMuted: ue, toggleCallMute: de, endWebRTCCall: fe, formatCallDuration: pe, callDurationSeconds: me, isCallMinimized: he, onExpand: ge, onCollapse: F, onStartVoice: _e, voiceEnabled: ve, headerBgColor: ye, onNewChat: I, showPoweredBy: be, privacyPolicyUrl: L, getVisitorChatHistory: xe, resumeChat: Se, isSessionRestoring: R, isClosing: Ce }) {
|
|
14252
|
+
let we = l.length > 0, Te = T || E || w, Ee = !!le, [De, Oe] = m(!1), [ke, Ae] = m(!1), [je, Me] = m([]), [z, Ne] = m(!1), Pe = p(null), [Fe, B] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [V, Ie] = m(0);
|
|
14248
14253
|
c(() => {
|
|
14249
14254
|
if (!s) return;
|
|
14250
14255
|
let e = window.visualViewport;
|
|
@@ -14257,26 +14262,26 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14257
14262
|
};
|
|
14258
14263
|
}, [s]);
|
|
14259
14264
|
let Le = s && window.innerHeight - Fe > 150, Re = async () => {
|
|
14260
|
-
|
|
14265
|
+
Oe(!1), Ae(!0), Ne(!0);
|
|
14261
14266
|
try {
|
|
14262
|
-
let e = await
|
|
14263
|
-
e?.data &&
|
|
14267
|
+
let e = await xe();
|
|
14268
|
+
e?.data && Me(e.data);
|
|
14264
14269
|
} catch (e) {
|
|
14265
14270
|
console.error(e);
|
|
14266
14271
|
} finally {
|
|
14267
14272
|
Ne(!1);
|
|
14268
14273
|
}
|
|
14269
14274
|
}, ze = async (e) => {
|
|
14270
|
-
|
|
14275
|
+
Ae(!1), Se?.(e.chatId);
|
|
14271
14276
|
};
|
|
14272
14277
|
return c(() => {
|
|
14273
|
-
if (!
|
|
14278
|
+
if (!De) return;
|
|
14274
14279
|
let e = (e) => {
|
|
14275
14280
|
let t = e.composedPath?.()?.[0] || e.target;
|
|
14276
|
-
Pe.current && !Pe.current.contains(t) &&
|
|
14281
|
+
Pe.current && !Pe.current.contains(t) && Oe(!1);
|
|
14277
14282
|
};
|
|
14278
14283
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
14279
|
-
}, [
|
|
14284
|
+
}, [De]), /* @__PURE__ */ _("div", {
|
|
14280
14285
|
style: s ? {
|
|
14281
14286
|
"--flowengage-primary": n,
|
|
14282
14287
|
"--flowengage-accent": n,
|
|
@@ -14290,7 +14295,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14290
14295
|
display: "flex",
|
|
14291
14296
|
flexDirection: "column",
|
|
14292
14297
|
overflow: "hidden",
|
|
14293
|
-
animation:
|
|
14298
|
+
animation: Ce ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)"
|
|
14294
14299
|
} : {
|
|
14295
14300
|
"--flowengage-primary": n,
|
|
14296
14301
|
"--flowengage-accent": n,
|
|
@@ -14303,7 +14308,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14303
14308
|
flexDirection: "column",
|
|
14304
14309
|
overflow: "hidden",
|
|
14305
14310
|
position: "relative",
|
|
14306
|
-
animation:
|
|
14311
|
+
animation: Ce ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)"
|
|
14307
14312
|
},
|
|
14308
14313
|
children: [
|
|
14309
14314
|
/* @__PURE__ */ _("div", {
|
|
@@ -14313,7 +14318,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14313
14318
|
alignItems: "center",
|
|
14314
14319
|
columnGap: "14px",
|
|
14315
14320
|
padding: "16px 10px 14px",
|
|
14316
|
-
background:
|
|
14321
|
+
background: ye || "transparent",
|
|
14317
14322
|
flexShrink: 0,
|
|
14318
14323
|
position: "relative",
|
|
14319
14324
|
zIndex: 30
|
|
@@ -14326,7 +14331,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14326
14331
|
alignItems: "center"
|
|
14327
14332
|
},
|
|
14328
14333
|
children: /* @__PURE__ */ g("button", {
|
|
14329
|
-
onClick:
|
|
14334
|
+
onClick: F,
|
|
14330
14335
|
style: {
|
|
14331
14336
|
width: "40px",
|
|
14332
14337
|
height: "40px",
|
|
@@ -14431,7 +14436,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14431
14436
|
ref: Pe,
|
|
14432
14437
|
children: [/* @__PURE__ */ g("button", {
|
|
14433
14438
|
type: "button",
|
|
14434
|
-
onClick: () =>
|
|
14439
|
+
onClick: () => Oe((e) => !e),
|
|
14435
14440
|
style: {
|
|
14436
14441
|
width: "40px",
|
|
14437
14442
|
height: "40px",
|
|
@@ -14477,7 +14482,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14477
14482
|
})
|
|
14478
14483
|
]
|
|
14479
14484
|
})
|
|
14480
|
-
}),
|
|
14485
|
+
}), De && /* @__PURE__ */ _("div", {
|
|
14481
14486
|
style: {
|
|
14482
14487
|
position: "absolute",
|
|
14483
14488
|
top: "34px",
|
|
@@ -14493,10 +14498,10 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14493
14498
|
animation: "fe-orb-fade-in 0.18s ease"
|
|
14494
14499
|
},
|
|
14495
14500
|
children: [
|
|
14496
|
-
|
|
14501
|
+
ve && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
|
|
14497
14502
|
type: "button",
|
|
14498
14503
|
onClick: () => {
|
|
14499
|
-
|
|
14504
|
+
Oe(!1), _e?.();
|
|
14500
14505
|
},
|
|
14501
14506
|
style: {
|
|
14502
14507
|
display: "flex",
|
|
@@ -14538,7 +14543,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14538
14543
|
/* @__PURE__ */ _("button", {
|
|
14539
14544
|
type: "button",
|
|
14540
14545
|
onClick: () => {
|
|
14541
|
-
|
|
14546
|
+
Oe(!1), I?.();
|
|
14542
14547
|
},
|
|
14543
14548
|
style: {
|
|
14544
14549
|
display: "flex",
|
|
@@ -14573,7 +14578,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14573
14578
|
children: [/* @__PURE__ */ g("path", { d: "M12 5H5a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-7" }), /* @__PURE__ */ g("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })]
|
|
14574
14579
|
}), "Start new chat"]
|
|
14575
14580
|
}),
|
|
14576
|
-
|
|
14581
|
+
xe && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", { style: {
|
|
14577
14582
|
height: "1px",
|
|
14578
14583
|
background: "rgba(255,255,255,0.07)",
|
|
14579
14584
|
margin: "0 14px"
|
|
@@ -14621,7 +14626,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14621
14626
|
/* @__PURE__ */ _("button", {
|
|
14622
14627
|
type: "button",
|
|
14623
14628
|
onClick: () => {
|
|
14624
|
-
|
|
14629
|
+
Oe(!1), F?.();
|
|
14625
14630
|
},
|
|
14626
14631
|
style: {
|
|
14627
14632
|
display: "flex",
|
|
@@ -14680,23 +14685,23 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14680
14685
|
]
|
|
14681
14686
|
}),
|
|
14682
14687
|
/* @__PURE__ */ g($h, {
|
|
14683
|
-
webRTCError:
|
|
14684
|
-
micError:
|
|
14685
|
-
setMicError:
|
|
14686
|
-
dismissCallError:
|
|
14688
|
+
webRTCError: ae,
|
|
14689
|
+
micError: oe,
|
|
14690
|
+
setMicError: se,
|
|
14691
|
+
dismissCallError: ce,
|
|
14687
14692
|
isRateLimited: E,
|
|
14688
14693
|
rateLimitMessage: D
|
|
14689
14694
|
}),
|
|
14690
|
-
|
|
14695
|
+
he && /* @__PURE__ */ g(gg, {
|
|
14691
14696
|
agentName: v,
|
|
14692
14697
|
agentHeadshot: y,
|
|
14693
14698
|
fallbackAgentName: b,
|
|
14694
|
-
callDurationSeconds:
|
|
14695
|
-
isCallMuted:
|
|
14696
|
-
formatCallDuration:
|
|
14697
|
-
toggleCallMute:
|
|
14698
|
-
endWebRTCCall:
|
|
14699
|
-
onExpand:
|
|
14699
|
+
callDurationSeconds: me,
|
|
14700
|
+
isCallMuted: ue,
|
|
14701
|
+
formatCallDuration: pe,
|
|
14702
|
+
toggleCallMute: de,
|
|
14703
|
+
endWebRTCCall: fe,
|
|
14704
|
+
onExpand: ge,
|
|
14700
14705
|
primaryColor: n
|
|
14701
14706
|
}),
|
|
14702
14707
|
/* @__PURE__ */ _("div", {
|
|
@@ -14708,7 +14713,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14708
14713
|
background: "transparent",
|
|
14709
14714
|
position: "relative"
|
|
14710
14715
|
},
|
|
14711
|
-
children: [
|
|
14716
|
+
children: [ke ? /* @__PURE__ */ _("div", {
|
|
14712
14717
|
style: {
|
|
14713
14718
|
position: "absolute",
|
|
14714
14719
|
inset: 0,
|
|
@@ -14727,7 +14732,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14727
14732
|
flexShrink: 0
|
|
14728
14733
|
},
|
|
14729
14734
|
children: /* @__PURE__ */ _("button", {
|
|
14730
|
-
onClick: () =>
|
|
14735
|
+
onClick: () => Ae(!1),
|
|
14731
14736
|
style: {
|
|
14732
14737
|
background: "none",
|
|
14733
14738
|
border: "none",
|
|
@@ -14769,7 +14774,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14769
14774
|
fontSize: "14px"
|
|
14770
14775
|
},
|
|
14771
14776
|
children: "Loading past conversations..."
|
|
14772
|
-
}) :
|
|
14777
|
+
}) : je.length > 0 ? /* @__PURE__ */ g("div", { children: je.map((e) => /* @__PURE__ */ _("div", {
|
|
14773
14778
|
onClick: () => ze(e),
|
|
14774
14779
|
style: {
|
|
14775
14780
|
padding: "16px 20px",
|
|
@@ -14821,18 +14826,18 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14821
14826
|
children: "No previous chats found."
|
|
14822
14827
|
})
|
|
14823
14828
|
})]
|
|
14824
|
-
}) : null,
|
|
14829
|
+
}) : null, we ? /* @__PURE__ */ g(Xh, {
|
|
14825
14830
|
chatHistory: l,
|
|
14826
14831
|
isAiTyping: u,
|
|
14827
14832
|
isLoading: T,
|
|
14828
14833
|
isAgentTyping: d,
|
|
14829
|
-
setReplyContext:
|
|
14834
|
+
setReplyContext: P,
|
|
14830
14835
|
TypingDots: x_,
|
|
14831
14836
|
primaryColor: n,
|
|
14832
14837
|
agentHeadshot: y,
|
|
14833
14838
|
agentDisplayName: v || b,
|
|
14834
14839
|
botAvatarNode: /* @__PURE__ */ g(b_, { orbColors: t })
|
|
14835
|
-
}) :
|
|
14840
|
+
}) : R ? /* @__PURE__ */ _("div", {
|
|
14836
14841
|
style: {
|
|
14837
14842
|
flex: 1,
|
|
14838
14843
|
display: "flex",
|
|
@@ -14968,13 +14973,13 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14968
14973
|
setInput: S,
|
|
14969
14974
|
onSubmit: C,
|
|
14970
14975
|
isConversationEnded: w,
|
|
14971
|
-
callUiActive:
|
|
14972
|
-
handleToggleVoice:
|
|
14976
|
+
callUiActive: Ee,
|
|
14977
|
+
handleToggleVoice: _e,
|
|
14973
14978
|
showVoiceToggle: f === "agent",
|
|
14974
14979
|
activeScreen: f,
|
|
14975
|
-
inputDisabled:
|
|
14976
|
-
replyContext:
|
|
14977
|
-
clearReplyContext: () =>
|
|
14980
|
+
inputDisabled: Te,
|
|
14981
|
+
replyContext: N,
|
|
14982
|
+
clearReplyContext: () => P(null),
|
|
14978
14983
|
onFileSelect: k,
|
|
14979
14984
|
selectedFile: O,
|
|
14980
14985
|
onRemoveSelectedFile: A,
|
|
@@ -14995,7 +15000,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14995
15000
|
paddingBottom: "max(12px, env(safe-area-inset-bottom, 12px))",
|
|
14996
15001
|
pointerEvents: "none"
|
|
14997
15002
|
},
|
|
14998
|
-
children: [
|
|
15003
|
+
children: [L && /* @__PURE__ */ _("p", {
|
|
14999
15004
|
style: {
|
|
15000
15005
|
margin: "0 0 4px",
|
|
15001
15006
|
fontSize: "10px",
|
|
@@ -15008,7 +15013,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15008
15013
|
"This conversation is recorded for quality assurance purposes.",
|
|
15009
15014
|
" ",
|
|
15010
15015
|
/* @__PURE__ */ g("a", {
|
|
15011
|
-
href:
|
|
15016
|
+
href: L,
|
|
15012
15017
|
target: "_blank",
|
|
15013
15018
|
rel: "noopener noreferrer",
|
|
15014
15019
|
style: {
|
|
@@ -15018,7 +15023,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15018
15023
|
children: "See our privacy policy"
|
|
15019
15024
|
})
|
|
15020
15025
|
]
|
|
15021
|
-
}),
|
|
15026
|
+
}), be && /* @__PURE__ */ _("span", {
|
|
15022
15027
|
style: {
|
|
15023
15028
|
fontSize: "11px",
|
|
15024
15029
|
color: "#9ca3af",
|
|
@@ -15038,33 +15043,33 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15038
15043
|
});
|
|
15039
15044
|
}
|
|
15040
15045
|
function C_() {
|
|
15041
|
-
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, sendMessage: j, uploadChatFile: M, openWidget: re, captureVisitorEmail: ie, setVoiceMode:
|
|
15046
|
+
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, sendMessage: j, uploadChatFile: M, openWidget: re, captureVisitorEmail: ie, setVoiceMode: N, endConversation: P, startNewChat: se, acceptCall: ce, rejectCall: le, endWebRTCCall: ue, toggleCallMute: de, dismissCallError: fe, startTyping: pe, stopTyping: me, updateTypingDraft: he, getVisitorChatHistory: ge, resumeChat: F, isSessionRestoring: _e, openToChatCounter: ve, voiceEndCounter: ye } = Cn();
|
|
15042
15047
|
c(() => {
|
|
15043
15048
|
try {
|
|
15044
15049
|
or();
|
|
15045
15050
|
} catch {}
|
|
15046
15051
|
}, []), c(() => {
|
|
15047
|
-
|
|
15048
|
-
}, [
|
|
15049
|
-
let
|
|
15050
|
-
...
|
|
15051
|
-
...
|
|
15052
|
-
},
|
|
15053
|
-
...
|
|
15054
|
-
...
|
|
15055
|
-
},
|
|
15056
|
-
...
|
|
15057
|
-
...
|
|
15058
|
-
},
|
|
15052
|
+
ve && W !== "voice_mode" && W !== "text_chat" && W !== "call_screen" && (N?.(!1), $e("text_chat"));
|
|
15053
|
+
}, [ve]);
|
|
15054
|
+
let I = t?.widgetSettings || {}, be = n?.widgetSettings || {}, L = {
|
|
15055
|
+
...I.branding || {},
|
|
15056
|
+
...be.branding || {}
|
|
15057
|
+
}, R = {
|
|
15058
|
+
...I.theme || {},
|
|
15059
|
+
...be.theme || {}
|
|
15060
|
+
}, Ce = {
|
|
15061
|
+
...I.features || {},
|
|
15062
|
+
...be.features || {}
|
|
15063
|
+
}, Te = Ce.voice !== !1, Ee = Array.isArray(R.orbColors) && R.orbColors.length > 0 ? R.orbColors : null, Oe = R.buttonColor || R.primaryColor || Ee?.[0] || "#3B82F6", ke = {
|
|
15059
15064
|
small: 50,
|
|
15060
15065
|
medium: 64,
|
|
15061
15066
|
large: 80
|
|
15062
|
-
},
|
|
15067
|
+
}, Ae = ke[R.orbSize] || ke.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", z = u_(Ee ?? R.chatBgColors), Ne = L.logo || L.logoUrl || null, Pe = A || "en", Fe = I.recommendations?.[Pe] || [], B = (be.recommendations?.[Pe] ?? Fe).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
15063
15068
|
id: e.key || `qr-${t}`,
|
|
15064
15069
|
label: e.label,
|
|
15065
15070
|
message: e.label,
|
|
15066
15071
|
text: e.label
|
|
15067
|
-
})), V = Array.isArray(
|
|
15072
|
+
})), V = Array.isArray(L.quickChatOptions) && L.quickChatOptions.length > 0 ? L.quickChatOptions : B, Ie = L.hideWatermark === !0 ? !1 : L.showPoweredBy !== !1, Le = L.headerBgColor || null, Re = R.bottomPosition == null ? "1.5rem" : `${R.bottomPosition}px`, ze = L.privacyPolicyUrl || null, Be = L.chatbotEnabled !== !1 && R.chatbotEnabled !== !1, [Ve, He] = m(() => typeof window < "u" ? window.location.pathname : "/");
|
|
15068
15073
|
c(() => {
|
|
15069
15074
|
if (typeof window > "u") return;
|
|
15070
15075
|
let e = () => He(window.location.pathname), t = window.history.pushState.bind(window.history);
|
|
@@ -15076,24 +15081,24 @@ function C_() {
|
|
|
15076
15081
|
}, []);
|
|
15077
15082
|
let Ue = (() => {
|
|
15078
15083
|
let e = {
|
|
15079
|
-
...
|
|
15080
|
-
...
|
|
15084
|
+
...I.pageVisibility || {},
|
|
15085
|
+
...be.pageVisibility || {}
|
|
15081
15086
|
};
|
|
15082
15087
|
return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
|
|
15083
|
-
})(), We = Ue.length === 0 || Ue.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ve.startsWith(e.slice(0, -1)) : Ve.replace(/\/$/, "") === e.replace(/\/$/, "")), Ge =
|
|
15084
|
-
entryPrompt:
|
|
15085
|
-
yesLabel:
|
|
15086
|
-
laterLabel:
|
|
15087
|
-
connectionTitle:
|
|
15088
|
-
connectionSubtitle:
|
|
15089
|
-
voiceLabel:
|
|
15090
|
-
textLabel:
|
|
15091
|
-
chatTitle:
|
|
15092
|
-
hasCustomTitle: !!(
|
|
15088
|
+
})(), We = Ue.length === 0 || Ue.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ve.startsWith(e.slice(0, -1)) : Ve.replace(/\/$/, "") === e.replace(/\/$/, "")), Ge = I.greetings?.[A] || be.greetings?.[A] || L.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ke = {
|
|
15089
|
+
entryPrompt: L.entryPrompt || "Do you want to explore in a new way?",
|
|
15090
|
+
yesLabel: L.yesLabel || "Yes",
|
|
15091
|
+
laterLabel: L.laterLabel || "Later",
|
|
15092
|
+
connectionTitle: L.connectionTitle || "How would you like to connect?",
|
|
15093
|
+
connectionSubtitle: L.connectionSubtitle || "",
|
|
15094
|
+
voiceLabel: L.voiceLabel || "Voice",
|
|
15095
|
+
textLabel: L.textLabel || "Text",
|
|
15096
|
+
chatTitle: L.headerName || "Chat with FlowEngage",
|
|
15097
|
+
hasCustomTitle: !!(L.headerName && String(L.headerName).trim()),
|
|
15093
15098
|
introGreeting: Ge,
|
|
15094
|
-
inputPlaceholder:
|
|
15095
|
-
analysingLabel:
|
|
15096
|
-
}, qe =
|
|
15099
|
+
inputPlaceholder: L.inputPlaceholder || "Type your message",
|
|
15100
|
+
analysingLabel: L.analysingLabel || "analysing..."
|
|
15101
|
+
}, qe = be.elevenLabsAgentId || t?.elevenLabsAgentId || null, Je = t?.siteId || n?.siteId || null, H = t?.apiBaseUrl || "";
|
|
15097
15102
|
c(() => {
|
|
15098
15103
|
Kn(t?.siteType || null);
|
|
15099
15104
|
}, [t?.siteType]);
|
|
@@ -15104,10 +15109,10 @@ function C_() {
|
|
|
15104
15109
|
]), Ye = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, Xe = r.some((e) => e.sender === "user"), Ze = f(() => {
|
|
15105
15110
|
let e = r.findIndex((e) => e.sender === "user");
|
|
15106
15111
|
return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
15107
|
-
}, [r]), Qe = !!(
|
|
15112
|
+
}, [r]), Qe = !!(be._dashboardLivePreview || I._dashboardLivePreview), [W, $e] = m(() => Qe ? "text_chat" : "entry_prompt"), [et, tt] = m(""), [nt, G] = m(null), [rt, it] = m(h || ""), [at, ot] = m(""), [st, ct] = m(!1), [lt, ut] = m(0), [dt, ft] = m(null), [pt, mt] = m(null), [ht, gt] = m(""), [_t, vt] = m(!1), [yt, bt] = m(!1), [xt, St] = m(!1), Ct = p(null), wt = p(!1), Tt = !h && Xe && Ze && W !== "voice_mode";
|
|
15108
15113
|
d(() => {
|
|
15109
15114
|
if (e !== "ready" || wt.current) return;
|
|
15110
|
-
if (wt.current = !0, !
|
|
15115
|
+
if (wt.current = !0, !Te) {
|
|
15111
15116
|
$e("minimized_orb");
|
|
15112
15117
|
return;
|
|
15113
15118
|
}
|
|
@@ -15115,12 +15120,12 @@ function C_() {
|
|
|
15115
15120
|
try {
|
|
15116
15121
|
t = vr().shouldResumeVoice;
|
|
15117
15122
|
} catch {}
|
|
15118
|
-
let n =
|
|
15123
|
+
let n = we(), r = Je ? xe(Je) : null, i = n || !!r?.transcript;
|
|
15119
15124
|
if (t) {
|
|
15120
|
-
re?.({ notifyChatInitiated: !0 }),
|
|
15125
|
+
re?.({ notifyChatInitiated: !0 }), N?.(!0), $e("voice_mode");
|
|
15121
15126
|
return;
|
|
15122
15127
|
}
|
|
15123
|
-
if (
|
|
15128
|
+
if (De()) {
|
|
15124
15129
|
re?.({ notifyChatInitiated: !1 }), $e("text_chat");
|
|
15125
15130
|
return;
|
|
15126
15131
|
}
|
|
@@ -15129,13 +15134,13 @@ function C_() {
|
|
|
15129
15134
|
$e("minimized_orb");
|
|
15130
15135
|
return;
|
|
15131
15136
|
}
|
|
15132
|
-
re?.({ notifyChatInitiated: !0 }),
|
|
15137
|
+
re?.({ notifyChatInitiated: !0 }), N?.(!0), $e("voice_mode");
|
|
15133
15138
|
return;
|
|
15134
15139
|
}
|
|
15135
15140
|
if (Je) try {
|
|
15136
|
-
|
|
15141
|
+
Se(Je);
|
|
15137
15142
|
} catch {}
|
|
15138
|
-
if (
|
|
15143
|
+
if (ae(Je)) {
|
|
15139
15144
|
$e("minimized_orb");
|
|
15140
15145
|
return;
|
|
15141
15146
|
}
|
|
@@ -15193,7 +15198,7 @@ function C_() {
|
|
|
15193
15198
|
hasIncomingCall: !!w?.callId,
|
|
15194
15199
|
activeCallId: T,
|
|
15195
15200
|
callConnectionState: E
|
|
15196
|
-
}), Ct.current = e, W === "voice_mode" &&
|
|
15201
|
+
}), Ct.current = e, W === "voice_mode" && N?.(!1), re?.(), At());
|
|
15197
15202
|
}
|
|
15198
15203
|
}, [
|
|
15199
15204
|
T,
|
|
@@ -15202,7 +15207,7 @@ function C_() {
|
|
|
15202
15207
|
w?.callId,
|
|
15203
15208
|
i,
|
|
15204
15209
|
re,
|
|
15205
|
-
|
|
15210
|
+
N,
|
|
15206
15211
|
W
|
|
15207
15212
|
]), c(() => {
|
|
15208
15213
|
!w && !T && W === "call_screen" && $e("text_chat");
|
|
@@ -15214,16 +15219,16 @@ function C_() {
|
|
|
15214
15219
|
!T && yt && bt(!1);
|
|
15215
15220
|
}, [T, yt]), c(() => {
|
|
15216
15221
|
if (!s || C) {
|
|
15217
|
-
|
|
15222
|
+
he?.(""), me?.();
|
|
15218
15223
|
return;
|
|
15219
15224
|
}
|
|
15220
15225
|
if (!et.trim() || pt) {
|
|
15221
|
-
|
|
15222
|
-
let e = window.setTimeout(() =>
|
|
15226
|
+
he?.("");
|
|
15227
|
+
let e = window.setTimeout(() => me?.(), 100);
|
|
15223
15228
|
return () => window.clearTimeout(e);
|
|
15224
15229
|
}
|
|
15225
|
-
|
|
15226
|
-
let e = window.setTimeout(() =>
|
|
15230
|
+
pe?.();
|
|
15231
|
+
let e = window.setTimeout(() => he?.(et), 120), t = window.setTimeout(() => me?.(), 1200);
|
|
15227
15232
|
return () => {
|
|
15228
15233
|
window.clearTimeout(e), window.clearTimeout(t);
|
|
15229
15234
|
};
|
|
@@ -15232,9 +15237,9 @@ function C_() {
|
|
|
15232
15237
|
pt,
|
|
15233
15238
|
s,
|
|
15234
15239
|
C,
|
|
15240
|
+
pe,
|
|
15235
15241
|
me,
|
|
15236
|
-
he
|
|
15237
|
-
ge
|
|
15242
|
+
he
|
|
15238
15243
|
]);
|
|
15239
15244
|
let Mt = (e) => e ? {
|
|
15240
15245
|
replyTo: e.messageId || e.id || null,
|
|
@@ -15276,8 +15281,8 @@ function C_() {
|
|
|
15276
15281
|
let n = et.trim();
|
|
15277
15282
|
tt(""), G(null), await j(n, "", t);
|
|
15278
15283
|
}, Pt = o(() => {
|
|
15279
|
-
r.length !== 0 &&
|
|
15280
|
-
}, [r.length,
|
|
15284
|
+
r.length !== 0 && se?.();
|
|
15285
|
+
}, [r.length, se]), Ft = (e) => {
|
|
15281
15286
|
let t = Math.floor(e / 60);
|
|
15282
15287
|
return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
|
|
15283
15288
|
}, It = o(async (e) => {
|
|
@@ -15308,14 +15313,14 @@ function C_() {
|
|
|
15308
15313
|
height: "min(640px, calc(100vh - 120px))",
|
|
15309
15314
|
borderRadius: "22px",
|
|
15310
15315
|
overflow: "hidden",
|
|
15311
|
-
...
|
|
15316
|
+
...je === "bottom-left" ? {
|
|
15312
15317
|
left: "1.5rem",
|
|
15313
15318
|
bottom: Re
|
|
15314
15319
|
} : {
|
|
15315
15320
|
right: "1.5rem",
|
|
15316
15321
|
bottom: Re
|
|
15317
15322
|
}
|
|
15318
|
-
} :
|
|
15323
|
+
} : je === "bottom-left" ? {
|
|
15319
15324
|
left: "1.5rem",
|
|
15320
15325
|
bottom: Re
|
|
15321
15326
|
} : {
|
|
@@ -15333,13 +15338,13 @@ function C_() {
|
|
|
15333
15338
|
t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
|
|
15334
15339
|
}
|
|
15335
15340
|
} catch {}
|
|
15336
|
-
re({ notifyChatInitiated: !0 }),
|
|
15341
|
+
re({ notifyChatInitiated: !0 }), N?.(!0), $e("voice_mode");
|
|
15337
15342
|
}, Vt = () => {
|
|
15338
|
-
re({ notifyChatInitiated: !0 }),
|
|
15343
|
+
re({ notifyChatInitiated: !0 }), N?.(!1), $e("text_chat");
|
|
15339
15344
|
}, Ht = () => {
|
|
15340
|
-
|
|
15345
|
+
N?.(!1), Rt();
|
|
15341
15346
|
};
|
|
15342
|
-
return e !== "ready" || !Be ||
|
|
15347
|
+
return e !== "ready" || !Be || Ce.chat === !1 || !We ? null : /* @__PURE__ */ _("div", {
|
|
15343
15348
|
className: "flowengage-widget-root",
|
|
15344
15349
|
style: {
|
|
15345
15350
|
position: "fixed",
|
|
@@ -15351,13 +15356,13 @@ function C_() {
|
|
|
15351
15356
|
children: [
|
|
15352
15357
|
W === "entry_prompt" && /* @__PURE__ */ g(__, {
|
|
15353
15358
|
copy: Ke,
|
|
15354
|
-
orbColors:
|
|
15355
|
-
primaryColor:
|
|
15359
|
+
orbColors: Ee,
|
|
15360
|
+
primaryColor: Oe,
|
|
15356
15361
|
onYes: () => {
|
|
15357
|
-
|
|
15362
|
+
oe(Je), Bt();
|
|
15358
15363
|
},
|
|
15359
15364
|
onLater: () => {
|
|
15360
|
-
|
|
15365
|
+
oe(Je), Rt();
|
|
15361
15366
|
},
|
|
15362
15367
|
isMobile: Et,
|
|
15363
15368
|
isClosing: xt
|
|
@@ -15381,7 +15386,7 @@ function C_() {
|
|
|
15381
15386
|
transformOrigin: "bottom right",
|
|
15382
15387
|
display: "inline-flex",
|
|
15383
15388
|
flexDirection: "column",
|
|
15384
|
-
alignItems:
|
|
15389
|
+
alignItems: je === "bottom-left" ? "flex-start" : "flex-end",
|
|
15385
15390
|
gap: "10px"
|
|
15386
15391
|
},
|
|
15387
15392
|
children: [T && /* @__PURE__ */ _("button", {
|
|
@@ -15433,15 +15438,15 @@ function C_() {
|
|
|
15433
15438
|
})]
|
|
15434
15439
|
})]
|
|
15435
15440
|
}), /* @__PURE__ */ g(g_, {
|
|
15436
|
-
size:
|
|
15437
|
-
orbColors:
|
|
15438
|
-
onClick: T ? At :
|
|
15441
|
+
size: Ae,
|
|
15442
|
+
orbColors: Ee,
|
|
15443
|
+
onClick: T ? At : Te ? zt : Vt
|
|
15439
15444
|
})]
|
|
15440
15445
|
}),
|
|
15441
15446
|
W === "connection_modal" && /* @__PURE__ */ g(v_, {
|
|
15442
15447
|
copy: Ke,
|
|
15443
|
-
orbColors:
|
|
15444
|
-
primaryColor:
|
|
15448
|
+
orbColors: Ee,
|
|
15449
|
+
primaryColor: Oe,
|
|
15445
15450
|
onVoice: Bt,
|
|
15446
15451
|
onText: Vt,
|
|
15447
15452
|
onClose: Rt,
|
|
@@ -15449,7 +15454,7 @@ function C_() {
|
|
|
15449
15454
|
isClosing: xt
|
|
15450
15455
|
}),
|
|
15451
15456
|
W === "voice_mode" && /* @__PURE__ */ g(y_, {
|
|
15452
|
-
orbColors:
|
|
15457
|
+
orbColors: Ee,
|
|
15453
15458
|
onEnterChat: Vt,
|
|
15454
15459
|
onEndChat: Ht,
|
|
15455
15460
|
agentId: qe,
|
|
@@ -15458,16 +15463,16 @@ function C_() {
|
|
|
15458
15463
|
chatId: ee,
|
|
15459
15464
|
historyRef: te,
|
|
15460
15465
|
onMessageSync: ne,
|
|
15461
|
-
voiceEndCounter:
|
|
15466
|
+
voiceEndCounter: ye,
|
|
15462
15467
|
websiteName: t?.websiteName,
|
|
15463
|
-
voiceFirstMessage:
|
|
15468
|
+
voiceFirstMessage: I.voiceFirstMessage || null,
|
|
15464
15469
|
captureVisitorEmail: ie,
|
|
15465
15470
|
emailRequired: !h,
|
|
15466
|
-
emailCaptureEnabled:
|
|
15467
|
-
listeningLabel:
|
|
15468
|
-
thinkingLabel:
|
|
15469
|
-
enterChatModeLabel:
|
|
15470
|
-
endConversationLabel:
|
|
15471
|
+
emailCaptureEnabled: Ce.emailCapture !== !1 && L.disableEmailCapture !== !0,
|
|
15472
|
+
listeningLabel: L.voiceListeningLabel || "Listening...",
|
|
15473
|
+
thinkingLabel: L.voiceThinkingLabel || "Thinking...",
|
|
15474
|
+
enterChatModeLabel: L.voiceEnterChatLabel || "Enter Chat Mode",
|
|
15475
|
+
endConversationLabel: L.voiceEndConversationLabel || "End Conversation"
|
|
15471
15476
|
}, "voice"),
|
|
15472
15477
|
W === "call_screen" && /* @__PURE__ */ g(hg, {
|
|
15473
15478
|
incomingCall: w,
|
|
@@ -15477,22 +15482,22 @@ function C_() {
|
|
|
15477
15482
|
isCallMuted: O,
|
|
15478
15483
|
agentName: U,
|
|
15479
15484
|
agentHeadshot: Ye,
|
|
15480
|
-
fallbackAgentName:
|
|
15481
|
-
acceptCall:
|
|
15482
|
-
rejectCall:
|
|
15483
|
-
endWebRTCCall:
|
|
15484
|
-
toggleCallMute:
|
|
15485
|
+
fallbackAgentName: Me,
|
|
15486
|
+
acceptCall: ce,
|
|
15487
|
+
rejectCall: le,
|
|
15488
|
+
endWebRTCCall: ue,
|
|
15489
|
+
toggleCallMute: de,
|
|
15485
15490
|
formatCallDuration: Ft,
|
|
15486
15491
|
onMinimize: jt,
|
|
15487
|
-
primaryColor:
|
|
15488
|
-
orbColors:
|
|
15492
|
+
primaryColor: Oe,
|
|
15493
|
+
orbColors: Ee,
|
|
15489
15494
|
chatHistory: r
|
|
15490
15495
|
}),
|
|
15491
15496
|
W === "text_chat" && /* @__PURE__ */ g(S_, {
|
|
15492
15497
|
isClosing: xt,
|
|
15493
15498
|
copy: Ke,
|
|
15494
|
-
orbColors:
|
|
15495
|
-
primaryColor:
|
|
15499
|
+
orbColors: Ee,
|
|
15500
|
+
primaryColor: Oe,
|
|
15496
15501
|
chatBgGradient: z,
|
|
15497
15502
|
logo: Ne,
|
|
15498
15503
|
quickChatOptions: V,
|
|
@@ -15504,7 +15509,7 @@ function C_() {
|
|
|
15504
15509
|
activeScreen: a,
|
|
15505
15510
|
agentName: U,
|
|
15506
15511
|
agentHeadshot: Ye,
|
|
15507
|
-
fallbackAgentName:
|
|
15512
|
+
fallbackAgentName: Me,
|
|
15508
15513
|
input: et,
|
|
15509
15514
|
setInput: tt,
|
|
15510
15515
|
onSubmit: Nt,
|
|
@@ -15527,16 +15532,16 @@ function C_() {
|
|
|
15527
15532
|
webRTCError: k,
|
|
15528
15533
|
micError: dt,
|
|
15529
15534
|
setMicError: ft,
|
|
15530
|
-
dismissCallError:
|
|
15535
|
+
dismissCallError: fe,
|
|
15531
15536
|
activeCallId: T,
|
|
15532
15537
|
isCallMuted: O,
|
|
15533
|
-
toggleCallMute:
|
|
15534
|
-
endWebRTCCall:
|
|
15538
|
+
toggleCallMute: de,
|
|
15539
|
+
endWebRTCCall: ue,
|
|
15535
15540
|
formatCallDuration: Ft,
|
|
15536
15541
|
callDurationSeconds: lt,
|
|
15537
15542
|
onCollapse: Rt,
|
|
15538
15543
|
onStartVoice: Bt,
|
|
15539
|
-
voiceEnabled:
|
|
15544
|
+
voiceEnabled: Te,
|
|
15540
15545
|
onNewChat: Pt,
|
|
15541
15546
|
onMinimize: jt,
|
|
15542
15547
|
onExpand: At,
|
|
@@ -15544,9 +15549,9 @@ function C_() {
|
|
|
15544
15549
|
showPoweredBy: Ie,
|
|
15545
15550
|
privacyPolicyUrl: ze,
|
|
15546
15551
|
headerBgColor: Le,
|
|
15547
|
-
getVisitorChatHistory:
|
|
15548
|
-
resumeChat:
|
|
15549
|
-
isSessionRestoring:
|
|
15552
|
+
getVisitorChatHistory: ge,
|
|
15553
|
+
resumeChat: F,
|
|
15554
|
+
isSessionRestoring: _e
|
|
15550
15555
|
}),
|
|
15551
15556
|
/* @__PURE__ */ g("style", { children: "\n /* Force any SVG (or img) inside LogoSlot to fill the container height\n regardless of whether the component forwards its style prop. */\n .fe-logo-slot svg,\n .fe-logo-slot img { height: 100%; width: auto; display: block; }\n\n @keyframes fe-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }\n @keyframes fe-orb-breathe-subtle { 0%,100%{transform:scale(1)} 50%{transform:scale(1.025)} }\n @keyframes fe-orb-pulse { 0%{transform:scale(1);opacity:.65} 50%{transform:scale(1.28);opacity:.1} 100%{transform:scale(1);opacity:.65} }\n @keyframes fe-orb-glow { from{opacity:.35} to{opacity:.75} }\n @keyframes fe-orb-fade-in { from{opacity:0} to{opacity:1} }\n @keyframes fe-orb-slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }\n @keyframes fe-orb-slide-down { from{opacity:1;transform:translateY(0)} to{opacity:0;transform:translateY(24px)} }\n @keyframes fe-orb-bar-0 { from{height:6px} to{height:18px} }\n @keyframes fe-orb-bar-1 { from{height:10px} to{height:22px} }\n @keyframes fe-orb-bar-2 { from{height:14px} to{height:26px} }\n @keyframes fe-orb-bar-3 { from{height:8px} to{height:20px} }\n @keyframes fe-orb-bar-4 { from{height:6px} to{height:16px} }\n @keyframes fe-dot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-5px);opacity:1} }\n " })
|
|
15552
15557
|
]
|