@flowengage/react-chatbot 8.0.80 → 8.0.82
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 (A) try {
|
|
43
43
|
window.localStorage.removeItem(k.chatId);
|
|
44
44
|
} catch {}
|
|
45
|
-
},
|
|
45
|
+
}, j = () => A ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", M = (e) => e ? `flowengage.entrySeen.${e}` : null, se = (e) => {
|
|
46
46
|
if (!A || !e) return !1;
|
|
47
47
|
try {
|
|
48
|
-
let t =
|
|
48
|
+
let t = M(e);
|
|
49
49
|
return t ? window.localStorage.getItem(t) === "1" : !1;
|
|
50
50
|
} catch {
|
|
51
51
|
return !1;
|
|
52
52
|
}
|
|
53
|
-
},
|
|
53
|
+
}, ce = (e) => {
|
|
54
54
|
if (!(!A || !e)) try {
|
|
55
|
-
let t =
|
|
55
|
+
let t = M(e);
|
|
56
56
|
t && window.localStorage.setItem(t, "1");
|
|
57
57
|
} catch {}
|
|
58
|
-
},
|
|
58
|
+
}, N = (e) => e ? `flowengage.persistedChatId.${e}` : null, le = (e) => {
|
|
59
59
|
if (!A || !e) return null;
|
|
60
60
|
try {
|
|
61
|
-
let t =
|
|
61
|
+
let t = N(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
|
+
}, ue = (e) => {
|
|
67
67
|
if (!(!A || !e)) try {
|
|
68
|
-
let t =
|
|
68
|
+
let t = N(e);
|
|
69
69
|
t && window.localStorage.removeItem(t);
|
|
70
70
|
} catch {}
|
|
71
|
-
},
|
|
71
|
+
}, de = (e, t) => {
|
|
72
72
|
if (!(!A || !e || !t)) try {
|
|
73
|
-
let n =
|
|
73
|
+
let n = N(e);
|
|
74
74
|
n && window.localStorage.setItem(n, String(t).trim());
|
|
75
75
|
} catch {}
|
|
76
|
-
},
|
|
76
|
+
}, fe = () => A ? {
|
|
77
77
|
isOpen: !1,
|
|
78
78
|
activeScreen: window.sessionStorage.getItem(k.activeScreen) || "ai",
|
|
79
79
|
isHumanHandled: window.sessionStorage.getItem(k.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
|
+
}, pe = (e) => {
|
|
91
91
|
A && Object.entries(e).forEach(([e, t]) => {
|
|
92
92
|
let n = k[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
|
+
}, me = (e) => {
|
|
102
102
|
if (!A || !e) return "";
|
|
103
103
|
let t = ie(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(k.visitorEmail), n = e);
|
|
107
107
|
}
|
|
108
108
|
return n || "";
|
|
109
|
-
},
|
|
109
|
+
}, he = (e, t) => {
|
|
110
110
|
if (!A) return;
|
|
111
111
|
let n = ie(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(k.visitorEmail);
|
|
119
|
-
},
|
|
119
|
+
}, ge = (e) => e ? `flowengage.visitorId.${e}` : null, P = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, _e = (e) => {
|
|
120
120
|
if (!A || !e) return null;
|
|
121
121
|
try {
|
|
122
|
-
let t =
|
|
122
|
+
let t = ge(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
|
+
}, ve = (e) => {
|
|
128
128
|
if (!A || !e) return null;
|
|
129
129
|
try {
|
|
130
|
-
let t =
|
|
130
|
+
let t = _e(e);
|
|
131
131
|
if (t) return t;
|
|
132
|
-
let n =
|
|
132
|
+
let n = P(), r = ge(e);
|
|
133
133
|
return r && window.localStorage.setItem(r, n), n;
|
|
134
134
|
} catch {
|
|
135
|
-
return
|
|
135
|
+
return P();
|
|
136
136
|
}
|
|
137
|
-
},
|
|
137
|
+
}, ye = "flowengage.tabId", be = () => {
|
|
138
138
|
if (!A) 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(ye);
|
|
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(ye, e)), e;
|
|
142
142
|
} catch {
|
|
143
143
|
return "default";
|
|
144
144
|
}
|
|
145
|
-
},
|
|
145
|
+
}, xe = (e) => e ? `flowengage.voice.transcript.${e}.${be()}` : null, Se = 600 * 1e3, F = (e, t, n = {}) => {
|
|
146
146
|
if (!A || !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 : Se, a = {
|
|
150
150
|
transcript: r,
|
|
151
151
|
expiresAt: Date.now() + i
|
|
152
152
|
};
|
|
153
153
|
try {
|
|
154
|
-
let t =
|
|
154
|
+
let t = xe(e);
|
|
155
155
|
t && window.localStorage.setItem(t, JSON.stringify(a));
|
|
156
156
|
} catch {}
|
|
157
|
-
},
|
|
157
|
+
}, Ce = (e) => {
|
|
158
158
|
if (!A || !e) return null;
|
|
159
159
|
try {
|
|
160
|
-
let t =
|
|
160
|
+
let t = xe(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
|
+
}, we = (e) => {
|
|
168
168
|
if (!(!A || !e)) try {
|
|
169
|
-
let t =
|
|
169
|
+
let t = xe(e);
|
|
170
170
|
t && window.localStorage.removeItem(t);
|
|
171
171
|
} catch {}
|
|
172
|
-
},
|
|
172
|
+
}, I = "flowengage.voice.pendingResume", Te = () => {
|
|
173
173
|
if (A) try {
|
|
174
|
-
window.sessionStorage.setItem(
|
|
174
|
+
window.sessionStorage.setItem(I, "1");
|
|
175
175
|
} catch {}
|
|
176
|
-
},
|
|
176
|
+
}, Ee = () => {
|
|
177
177
|
if (!A) return !1;
|
|
178
178
|
try {
|
|
179
|
-
return window.sessionStorage.getItem(
|
|
179
|
+
return window.sessionStorage.getItem(I) === "1" ? (window.sessionStorage.removeItem(I), !0) : !1;
|
|
180
180
|
} catch {
|
|
181
181
|
return !1;
|
|
182
182
|
}
|
|
183
|
-
},
|
|
183
|
+
}, De = "flowengage.chat.pendingReopen", L = () => {
|
|
184
184
|
if (A) try {
|
|
185
|
-
window.sessionStorage.setItem(
|
|
185
|
+
window.sessionStorage.setItem(De, "1");
|
|
186
186
|
} catch {}
|
|
187
|
-
},
|
|
187
|
+
}, Oe = () => {
|
|
188
188
|
if (!A) return !1;
|
|
189
189
|
try {
|
|
190
|
-
return window.sessionStorage.getItem(
|
|
190
|
+
return window.sessionStorage.getItem(De) === "1" ? (window.sessionStorage.removeItem(De), !0) : !1;
|
|
191
191
|
} catch {
|
|
192
192
|
return !1;
|
|
193
193
|
}
|
|
194
|
-
},
|
|
194
|
+
}, ke = () => {
|
|
195
195
|
if (!A) return !1;
|
|
196
196
|
try {
|
|
197
|
-
return window.sessionStorage.getItem(
|
|
197
|
+
return window.sessionStorage.getItem(I) === "1";
|
|
198
198
|
} catch {
|
|
199
199
|
return !1;
|
|
200
200
|
}
|
|
201
|
-
},
|
|
201
|
+
}, Ae = (e) => e ? `flowengage.voice.navState.${e}.${be()}` : null, je = (e, t, n, r) => {
|
|
202
202
|
if (!(!A || !e || !t)) try {
|
|
203
|
-
let i =
|
|
203
|
+
let i = Ae(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,
|
|
@@ -211,7 +211,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
211
211
|
}, Me = (e) => {
|
|
212
212
|
if (!A || !e) return null;
|
|
213
213
|
try {
|
|
214
|
-
let t =
|
|
214
|
+
let t = Ae(e);
|
|
215
215
|
if (!t) return null;
|
|
216
216
|
let n = window.sessionStorage.getItem(t);
|
|
217
217
|
if (!n) return null;
|
|
@@ -2817,11 +2817,11 @@ async function br(e, t = {}) {
|
|
|
2817
2817
|
try {
|
|
2818
2818
|
window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate", { state: {} }));
|
|
2819
2819
|
} catch {}
|
|
2820
|
-
return n && mr(n), r ||
|
|
2820
|
+
return n && mr(n), r || L(), window.location.assign(i.href), { navigated: !0 };
|
|
2821
2821
|
}
|
|
2822
2822
|
return { navigated: !0 };
|
|
2823
2823
|
}
|
|
2824
|
-
return n && mr(n), r ||
|
|
2824
|
+
return n && mr(n), r || L(), window.location.assign(i.href), { navigated: !0 };
|
|
2825
2825
|
} catch (t) {
|
|
2826
2826
|
console.warn("[FlowEngage] shadowNavigate error:", t), n && mr(n);
|
|
2827
2827
|
try {
|
|
@@ -2919,7 +2919,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2919
2919
|
message: "Looks like you're already on this page!",
|
|
2920
2920
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2921
2921
|
}]);
|
|
2922
|
-
}, []), [T, D] = m(
|
|
2922
|
+
}, []), [T, D] = m(fe().isOpen), [ee, O] = m(fe().activeScreen), [k, A] = m(fe().isHumanHandled), [ie, M] = m(fe().agentName), [se, ce] = m(fe().agentHeadshot), [N, ge] = m(() => me(i?.siteId)), [P, _e] = m(!1), [ye, be] = m(!1), [xe, Se] = m("idle"), [F, Ce] = m(!1), [we, I] = m(!1), [Ee, De] = m(""), [L, Oe] = m(!1), [ke, Ae] = m(0), [je, Me] = m(0), [R, Ne] = m(!1), [z, Le] = m(null), [Re, ze] = m(null), [Be, Ve] = m("idle"), [He, Ue] = m(null), [We, Ge] = m(!1), [Ke, qe] = m(""), [Je, Ye] = m(!1), B = p(null), V = p(null), Xe = p(""), Ze = p(!1), Qe = p(null), $e = p(null), et = p(null), H = p(null), U = p(null), tt = p(null), nt = p(null), rt = p(!1), W = p({
|
|
2923
2923
|
url: null,
|
|
2924
2924
|
at: 0
|
|
2925
2925
|
}), it = o((e, t) => {
|
|
@@ -2940,7 +2940,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2940
2940
|
cleanup: () => {}
|
|
2941
2941
|
}), xt = o((e = {}) => {
|
|
2942
2942
|
let t = !!e.is_human_handled;
|
|
2943
|
-
return A(t), t ? (O("agent"), e.agent_info?.name &&
|
|
2943
|
+
return A(t), t ? (O("agent"), e.agent_info?.name && M(e.agent_info.name), e.agent_info?.headshot && ce(e.agent_info.headshot), t) : (O("ai"), t);
|
|
2944
2944
|
}, []), St = f(() => {
|
|
2945
2945
|
let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
|
|
2946
2946
|
return Number.isFinite(t) && t > 0 ? t : ne;
|
|
@@ -2950,8 +2950,8 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2950
2950
|
}, [z]), c(() => {
|
|
2951
2951
|
ht.current = ie;
|
|
2952
2952
|
}, [ie]), c(() => {
|
|
2953
|
-
vt.current =
|
|
2954
|
-
}, [
|
|
2953
|
+
vt.current = L;
|
|
2954
|
+
}, [L]), c(() => {
|
|
2955
2955
|
yt.current = i;
|
|
2956
2956
|
}, [i]);
|
|
2957
2957
|
let Ct = () => {
|
|
@@ -2960,17 +2960,17 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2960
2960
|
st.current &&= (window.clearTimeout(st.current), null);
|
|
2961
2961
|
}, []), Tt = (e) => {
|
|
2962
2962
|
let t = typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
2963
|
-
return
|
|
2963
|
+
return ge(t), he(t, i?.siteId), t;
|
|
2964
2964
|
};
|
|
2965
2965
|
c(() => {
|
|
2966
2966
|
let e = i?.siteId;
|
|
2967
2967
|
if (!e) return;
|
|
2968
|
-
let t =
|
|
2968
|
+
let t = me(e);
|
|
2969
2969
|
if (t) {
|
|
2970
|
-
|
|
2970
|
+
ge(t);
|
|
2971
2971
|
return;
|
|
2972
2972
|
}
|
|
2973
|
-
|
|
2973
|
+
ge((t) => (t && he(t, e), t));
|
|
2974
2974
|
}, [i?.siteId]);
|
|
2975
2975
|
let Et = (e = "unspecified") => {
|
|
2976
2976
|
let t = G.current || tt.current?.callId, n = mt.current, r = dt.current;
|
|
@@ -3100,19 +3100,19 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3100
3100
|
});
|
|
3101
3101
|
};
|
|
3102
3102
|
c(() => {
|
|
3103
|
-
|
|
3103
|
+
pe({
|
|
3104
3104
|
isOpen: T,
|
|
3105
3105
|
activeScreen: ee,
|
|
3106
3106
|
isHumanHandled: k,
|
|
3107
3107
|
agentName: ie,
|
|
3108
|
-
agentHeadshot:
|
|
3108
|
+
agentHeadshot: se
|
|
3109
3109
|
});
|
|
3110
3110
|
}, [
|
|
3111
3111
|
T,
|
|
3112
3112
|
ee,
|
|
3113
3113
|
k,
|
|
3114
3114
|
ie,
|
|
3115
|
-
|
|
3115
|
+
se
|
|
3116
3116
|
]), c(() => {
|
|
3117
3117
|
let e = !0;
|
|
3118
3118
|
return (async () => {
|
|
@@ -3120,7 +3120,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3120
3120
|
try {
|
|
3121
3121
|
let t = E(i), n = await Fe(t);
|
|
3122
3122
|
if (!e) return;
|
|
3123
|
-
let a = t.siteId, o =
|
|
3123
|
+
let a = t.siteId, o = le(a), s = ve(a), c = "";
|
|
3124
3124
|
try {
|
|
3125
3125
|
let e = Ze.current, r = Qe.current;
|
|
3126
3126
|
if (Ze.current = !1, Qe.current = null, c = (await Pe({
|
|
@@ -3132,9 +3132,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3132
3132
|
resumeChatId: r,
|
|
3133
3133
|
visitorId: s
|
|
3134
3134
|
}))?.data?.chatId, !c) throw Error("resolve-session returned no chatId");
|
|
3135
|
-
oe(),
|
|
3135
|
+
oe(), de(a, c);
|
|
3136
3136
|
} catch (e) {
|
|
3137
|
-
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o ||
|
|
3137
|
+
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || j(), de(a, c);
|
|
3138
3138
|
}
|
|
3139
3139
|
Xe.current = c;
|
|
3140
3140
|
let l = Ie({
|
|
@@ -3154,23 +3154,23 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3154
3154
|
siteId: t.siteId
|
|
3155
3155
|
});
|
|
3156
3156
|
B.current = f, f.on("connect", async () => {
|
|
3157
|
-
|
|
3157
|
+
Se("connected");
|
|
3158
3158
|
let e = Xe.current;
|
|
3159
3159
|
if (e && V.current) try {
|
|
3160
3160
|
xt(await V.current.checkHumanHandled(e));
|
|
3161
3161
|
} catch {}
|
|
3162
3162
|
}), f.on("disconnect", () => {
|
|
3163
|
-
|
|
3163
|
+
Se("disconnected");
|
|
3164
3164
|
}), f.on("aiTyping", () => {
|
|
3165
|
-
|
|
3165
|
+
be(!0);
|
|
3166
3166
|
}), f.on("ai:typing", () => {
|
|
3167
|
-
|
|
3167
|
+
be(!0);
|
|
3168
3168
|
}), f.on("messageReceived", (e) => {
|
|
3169
3169
|
let t = e.message || e, n = {
|
|
3170
3170
|
...t,
|
|
3171
3171
|
message: Tr(t.message)
|
|
3172
3172
|
};
|
|
3173
|
-
|
|
3173
|
+
be(!1), _e(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
|
|
3174
3174
|
...n,
|
|
3175
3175
|
isPending: !1,
|
|
3176
3176
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -3188,7 +3188,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3188
3188
|
...t,
|
|
3189
3189
|
message: Tr(t.message)
|
|
3190
3190
|
};
|
|
3191
|
-
|
|
3191
|
+
be(!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") && _e(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
|
|
3192
3192
|
...n,
|
|
3193
3193
|
isPending: !1,
|
|
3194
3194
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -3200,11 +3200,11 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3200
3200
|
...n,
|
|
3201
3201
|
isPending: !1,
|
|
3202
3202
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
3203
|
-
}]), (n.sender === "agent" || n.agent_name) && (A(!0), O("agent"),
|
|
3203
|
+
}]), (n.sender === "agent" || n.agent_name) && (A(!0), O("agent"), M(Ar([
|
|
3204
3204
|
n.agent_name,
|
|
3205
3205
|
n.agentName,
|
|
3206
3206
|
n.metadata?.agentName
|
|
3207
|
-
], d)), n.sender_headshot &&
|
|
3207
|
+
], d)), n.sender_headshot && ce(n.sender_headshot), D(!0), Ae((e) => e + 1)));
|
|
3208
3208
|
});
|
|
3209
3209
|
let p = (e = {}) => {
|
|
3210
3210
|
let t = Ar([
|
|
@@ -3213,7 +3213,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3213
3213
|
e.agent_name,
|
|
3214
3214
|
ht.current
|
|
3215
3215
|
], d);
|
|
3216
|
-
A(!0), O("agent"),
|
|
3216
|
+
A(!0), O("agent"), M(t), ce(e.agent?.headshot || null), D(!0), Ae((e) => e + 1), S((e) => jr(e, {
|
|
3217
3217
|
id: `agent-joined-${Date.now()}`,
|
|
3218
3218
|
sender: "system",
|
|
3219
3219
|
message: `${t} has joined the chat.`,
|
|
@@ -3247,15 +3247,15 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3247
3247
|
}]);
|
|
3248
3248
|
}), f.on("chat:history_update", (e) => {
|
|
3249
3249
|
let t = Er(e.chat_history || []);
|
|
3250
|
-
S(t), t.length === 0 && (Ne(!1), A(!1), O("ai"),
|
|
3250
|
+
S(t), t.length === 0 && (Ne(!1), A(!1), O("ai"), be(!1), _e(!1));
|
|
3251
3251
|
}), f.on("conversation:reset", () => {
|
|
3252
|
-
S([]), Ne(!1), A(!1), O("ai"),
|
|
3252
|
+
S([]), Ne(!1), A(!1), O("ai"), be(!1), _e(!1);
|
|
3253
3253
|
}), f.on("voice:end_session", (e = {}) => {
|
|
3254
|
-
console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Me((e) => e + 1), D(!0),
|
|
3254
|
+
console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Me((e) => e + 1), D(!0), Ae((e) => e + 1);
|
|
3255
3255
|
}), f.on("typing:start", (e) => {
|
|
3256
|
-
e.sender === "agent" &&
|
|
3256
|
+
e.sender === "agent" && _e(!0);
|
|
3257
3257
|
}), f.on("typing:stop", (e) => {
|
|
3258
|
-
e.sender === "agent" &&
|
|
3258
|
+
e.sender === "agent" && _e(!1);
|
|
3259
3259
|
}), f.on("call:incoming", (e = {}) => {
|
|
3260
3260
|
let t = Ar([
|
|
3261
3261
|
e.agentName,
|
|
@@ -3268,7 +3268,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3268
3268
|
from: e.from || "owner",
|
|
3269
3269
|
agentId: e.agentId || null,
|
|
3270
3270
|
agentName: t
|
|
3271
|
-
}),
|
|
3271
|
+
}), M((e) => Ar([t, e], "Agent")), Ve("incoming"), Ue(null), D(!0);
|
|
3272
3272
|
}), f.on("call:offer", async (e = {}) => {
|
|
3273
3273
|
tt.current = e;
|
|
3274
3274
|
try {
|
|
@@ -3361,11 +3361,11 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3361
3361
|
r,
|
|
3362
3362
|
a
|
|
3363
3363
|
]), c(() => () => {
|
|
3364
|
-
if (
|
|
3364
|
+
if (L && !_t.current && gt.current.length > 0) {
|
|
3365
3365
|
let e = Xe.current, t = gt.current, n = V.current;
|
|
3366
3366
|
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), _t.current = !0);
|
|
3367
3367
|
}
|
|
3368
|
-
}, [
|
|
3368
|
+
}, [L, _]);
|
|
3369
3369
|
let jt = p(null);
|
|
3370
3370
|
c(() => {
|
|
3371
3371
|
let e = V.current;
|
|
@@ -3620,18 +3620,18 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3620
3620
|
chatId: y,
|
|
3621
3621
|
content: e,
|
|
3622
3622
|
sender: "user",
|
|
3623
|
-
email:
|
|
3623
|
+
email: N || void 0,
|
|
3624
3624
|
type: i?.type || "text",
|
|
3625
3625
|
metadata: i?.metadata || {},
|
|
3626
3626
|
...n || {}
|
|
3627
3627
|
});
|
|
3628
3628
|
return;
|
|
3629
3629
|
}
|
|
3630
|
-
|
|
3630
|
+
Ce(!0);
|
|
3631
3631
|
try {
|
|
3632
3632
|
let o = await V.current.sendAiMessage(y, e, r, t, {
|
|
3633
3633
|
...n || {},
|
|
3634
|
-
...
|
|
3634
|
+
...N ? { email: N } : {}
|
|
3635
3635
|
}, {
|
|
3636
3636
|
...i,
|
|
3637
3637
|
currentPageUrl: typeof window < "u" ? window.location.href : void 0,
|
|
@@ -3706,10 +3706,10 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3706
3706
|
});
|
|
3707
3707
|
}
|
|
3708
3708
|
}
|
|
3709
|
-
S(Er(s)), A(!!o.is_human_handled), O(o.is_human_handled ? "agent" : "ai"),
|
|
3709
|
+
S(Er(s)), A(!!o.is_human_handled), O(o.is_human_handled ? "agent" : "ai"), be(!1), Ce(!1), await V.current.updateChatStatus(y, "messageSent");
|
|
3710
3710
|
} catch (e) {
|
|
3711
|
-
S((e) => e.filter((e) => e.id !== u)),
|
|
3712
|
-
|
|
3711
|
+
S((e) => e.filter((e) => e.id !== u)), be(!1), Ce(!1), e.status === 429 ? (I(!0), De(e.message), window.setTimeout(() => {
|
|
3712
|
+
I(!1), De("");
|
|
3713
3713
|
}, te)) : h(e);
|
|
3714
3714
|
}
|
|
3715
3715
|
}, Wt = async (e) => {
|
|
@@ -3721,12 +3721,12 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3721
3721
|
let t = e ? "voice" : "text";
|
|
3722
3722
|
await V.current.setChatMode(y, t);
|
|
3723
3723
|
} catch {}
|
|
3724
|
-
|
|
3724
|
+
Oe(e), e && (_t.current = !1);
|
|
3725
3725
|
}
|
|
3726
3726
|
}, Kt = async (e) => {
|
|
3727
3727
|
if (_t.current) return;
|
|
3728
3728
|
if (_t.current = !0, !V.current || !y || !e?.length) {
|
|
3729
|
-
|
|
3729
|
+
Oe(!1);
|
|
3730
3730
|
return;
|
|
3731
3731
|
}
|
|
3732
3732
|
let t = () => {
|
|
@@ -3750,11 +3750,11 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3750
3750
|
} catch {
|
|
3751
3751
|
t();
|
|
3752
3752
|
} finally {
|
|
3753
|
-
|
|
3753
|
+
Oe(!1);
|
|
3754
3754
|
}
|
|
3755
3755
|
}, qt = async () => {
|
|
3756
3756
|
if (!(!V.current || !y)) {
|
|
3757
|
-
|
|
3757
|
+
L && !_t.current && gt.current.length > 0 && await Kt(gt.current);
|
|
3758
3758
|
try {
|
|
3759
3759
|
await V.current.endConversation(y);
|
|
3760
3760
|
} catch {
|
|
@@ -3788,7 +3788,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3788
3788
|
let e = () => {
|
|
3789
3789
|
let e = Xe.current, t = V.current;
|
|
3790
3790
|
if (!t || !e) return;
|
|
3791
|
-
if (vt.current && gt.current.length > 0 &&
|
|
3791
|
+
if (vt.current && gt.current.length > 0 && Te(), !_t.current && gt.current.length > 0 && (t.beaconSyncVoice(e, gt.current) || t.syncVoice(e, gt.current).catch(() => {}), _t.current = !0), G.current) {
|
|
3792
3792
|
t.beaconEndWebRTCCall(G.current, e);
|
|
3793
3793
|
return;
|
|
3794
3794
|
}
|
|
@@ -3801,9 +3801,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3801
3801
|
}, []);
|
|
3802
3802
|
let Jt = o(() => {
|
|
3803
3803
|
let e = i?.siteId;
|
|
3804
|
-
|
|
3804
|
+
ue(e), Ze.current = !0, Qe.current = null, B.current?.disconnect(), S([]), b(""), Xe.current = "", Ne(!1), A(!1), M(null), ce(null), Ye(!0), s((e) => e + 1);
|
|
3805
3805
|
}, [i?.siteId]), Yt = o((e) => {
|
|
3806
|
-
i?.siteId, Ze.current = !1, Qe.current = e, B.current?.disconnect(), S([]), b(""), Xe.current = "", Ne(!1), A(!1),
|
|
3806
|
+
i?.siteId, Ze.current = !1, Qe.current = e, B.current?.disconnect(), S([]), b(""), Xe.current = "", Ne(!1), A(!1), M(null), ce(null), Ye(!0), s((e) => e + 1);
|
|
3807
3807
|
}, [i?.siteId]), Xt = f(() => ({
|
|
3808
3808
|
status: l,
|
|
3809
3809
|
error: d,
|
|
@@ -3815,19 +3815,19 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3815
3815
|
activeScreen: ee,
|
|
3816
3816
|
isHumanHandled: k,
|
|
3817
3817
|
agentName: ie,
|
|
3818
|
-
agentHeadshot:
|
|
3819
|
-
visitorEmail:
|
|
3820
|
-
isAgentTyping:
|
|
3821
|
-
isAiTyping:
|
|
3822
|
-
connectionStatus:
|
|
3823
|
-
isLoading:
|
|
3824
|
-
isVoiceMode:
|
|
3825
|
-
isRateLimited:
|
|
3826
|
-
rateLimitMessage:
|
|
3818
|
+
agentHeadshot: se,
|
|
3819
|
+
visitorEmail: N,
|
|
3820
|
+
isAgentTyping: P,
|
|
3821
|
+
isAiTyping: ye,
|
|
3822
|
+
connectionStatus: xe,
|
|
3823
|
+
isLoading: F,
|
|
3824
|
+
isVoiceMode: L,
|
|
3825
|
+
isRateLimited: we,
|
|
3826
|
+
rateLimitMessage: Ee,
|
|
3827
3827
|
isConversationEnded: R,
|
|
3828
3828
|
isSessionRestoring: Je,
|
|
3829
|
-
openToChatCounter:
|
|
3830
|
-
voiceEndCounter:
|
|
3829
|
+
openToChatCounter: ke,
|
|
3830
|
+
voiceEndCounter: je,
|
|
3831
3831
|
incomingCall: z,
|
|
3832
3832
|
activeCallId: Re,
|
|
3833
3833
|
callConnectionState: Be,
|
|
@@ -3876,19 +3876,19 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3876
3876
|
ee,
|
|
3877
3877
|
k,
|
|
3878
3878
|
ie,
|
|
3879
|
-
|
|
3880
|
-
M,
|
|
3879
|
+
se,
|
|
3881
3880
|
N,
|
|
3882
|
-
be,
|
|
3883
|
-
Se,
|
|
3884
3881
|
P,
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3882
|
+
ye,
|
|
3883
|
+
xe,
|
|
3884
|
+
F,
|
|
3885
|
+
L,
|
|
3886
|
+
we,
|
|
3887
|
+
Ee,
|
|
3888
3888
|
R,
|
|
3889
3889
|
Je,
|
|
3890
|
-
|
|
3891
|
-
|
|
3890
|
+
ke,
|
|
3891
|
+
je,
|
|
3892
3892
|
z,
|
|
3893
3893
|
Re,
|
|
3894
3894
|
Be,
|
|
@@ -8947,61 +8947,61 @@ async function Lm(e) {
|
|
|
8947
8947
|
}
|
|
8948
8948
|
}, ee = (e, t, n) => {
|
|
8949
8949
|
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, Sm));
|
|
8950
|
-
}, O = !1, k = !1, te = !1, ne = !1, re = !0, A = 0, ie = !1, ae = !1, oe = Cm,
|
|
8951
|
-
|
|
8952
|
-
let
|
|
8950
|
+
}, O = !1, k = !1, te = !1, ne = !1, re = !0, A = 0, ie = !1, ae = !1, oe = Cm, j = wm, M = null, se = !1, ce = (e = !0) => {
|
|
8951
|
+
M && clearTimeout(M);
|
|
8952
|
+
let t = () => {
|
|
8953
8953
|
if (!O) {
|
|
8954
|
-
if (
|
|
8955
|
-
|
|
8954
|
+
if (N.isPlaying()) {
|
|
8955
|
+
M = setTimeout(t, 150);
|
|
8956
8956
|
return;
|
|
8957
8957
|
}
|
|
8958
|
-
if (
|
|
8958
|
+
if (M = null, se) {
|
|
8959
8959
|
p?.();
|
|
8960
8960
|
return;
|
|
8961
8961
|
}
|
|
8962
|
-
!O && C.readyState === WebSocket.OPEN && C.send(JSON.stringify({ type: "PlaybackDrained" })), d?.();
|
|
8962
|
+
!O && C.readyState === WebSocket.OPEN && C.send(JSON.stringify({ type: "PlaybackDrained" })), e && d?.();
|
|
8963
8963
|
}
|
|
8964
8964
|
};
|
|
8965
|
-
|
|
8966
|
-
},
|
|
8965
|
+
M = setTimeout(t, 150);
|
|
8966
|
+
}, N = Fm(_, () => {
|
|
8967
8967
|
ne && (ne = !1, c?.({ mode: "listening" }));
|
|
8968
|
-
}, v),
|
|
8969
|
-
|
|
8970
|
-
let
|
|
8971
|
-
|
|
8968
|
+
}, v), le = _.createMediaStreamSource(g);
|
|
8969
|
+
le.connect(v);
|
|
8970
|
+
let ue = _.createScriptProcessor(xm, 1, 1), de = !1, fe = 0, pe = 0;
|
|
8971
|
+
ue.onaudioprocess = (e) => {
|
|
8972
8972
|
if (O || C.readyState !== WebSocket.OPEN) return;
|
|
8973
8973
|
let t = e.inputBuffer.getChannelData(0), n = () => C.send(new Int16Array(t.length).buffer);
|
|
8974
8974
|
if (k) {
|
|
8975
|
-
te || (te = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")),
|
|
8975
|
+
te || (te = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), de = !1, fe = 0, pe = 0, n();
|
|
8976
8976
|
return;
|
|
8977
8977
|
}
|
|
8978
8978
|
let r = Om(t);
|
|
8979
|
-
if (
|
|
8979
|
+
if (N.isPlaying() || ae ? (de = !1, fe = 0, pe = 0) : r >= Tm ? (pe = 0, fe += 1, !de && fe >= Em && (de = !0, c?.({ mode: "user-speaking" }))) : (fe = 0, de && ++pe >= Dm && (de = !1, pe = 0, c?.({
|
|
8980
8980
|
mode: "thinking",
|
|
8981
8981
|
tentative: !0
|
|
8982
|
-
}))), (
|
|
8982
|
+
}))), (N.isPlaying() || ae) && !ie) {
|
|
8983
8983
|
if (r < oe) {
|
|
8984
8984
|
A = 0, n();
|
|
8985
8985
|
return;
|
|
8986
8986
|
}
|
|
8987
|
-
if (A += 1, A <
|
|
8987
|
+
if (A += 1, A < j) {
|
|
8988
8988
|
n();
|
|
8989
8989
|
return;
|
|
8990
8990
|
}
|
|
8991
8991
|
ie = !0, A = 0;
|
|
8992
|
-
let e =
|
|
8993
|
-
|
|
8992
|
+
let e = N.playedMs();
|
|
8993
|
+
N.stop(), re = !1, ae = !1, M && !se && (clearTimeout(M), M = null), C.send(JSON.stringify({
|
|
8994
8994
|
type: "VisitorInterrupted",
|
|
8995
8995
|
played_ms: Math.round(e)
|
|
8996
8996
|
})), console.debug("[FlowEngage] barge-in — visitor spoke over the agent");
|
|
8997
8997
|
}
|
|
8998
8998
|
C.send(km(t).buffer);
|
|
8999
|
-
},
|
|
9000
|
-
let
|
|
8999
|
+
}, le.connect(ue), ue.connect(_.destination);
|
|
9000
|
+
let me = () => {
|
|
9001
9001
|
if (!O) {
|
|
9002
|
-
O = !0,
|
|
9002
|
+
O = !0, M &&= (clearTimeout(M), null), D(), N.stop();
|
|
9003
9003
|
try {
|
|
9004
|
-
|
|
9004
|
+
ue.disconnect(), le.disconnect();
|
|
9005
9005
|
} catch {}
|
|
9006
9006
|
if (g.getTracks().forEach((e) => e.stop()), x && x.state !== "inactive") {
|
|
9007
9007
|
x.onstop = () => Pm(t, n, S, b, y);
|
|
@@ -9013,7 +9013,7 @@ async function Lm(e) {
|
|
|
9013
9013
|
} else b.length && Pm(t, n, S, b, y);
|
|
9014
9014
|
_.close().catch(() => {}), (C.readyState === WebSocket.OPEN || C.readyState === WebSocket.CONNECTING) && C.close();
|
|
9015
9015
|
}
|
|
9016
|
-
},
|
|
9016
|
+
}, he = async (e) => {
|
|
9017
9017
|
let t = i[e.name];
|
|
9018
9018
|
if (!t) return u?.({ tool_name: e.name }), { error: `Unknown tool ${e.name}` };
|
|
9019
9019
|
let n = {};
|
|
@@ -9025,10 +9025,10 @@ async function Lm(e) {
|
|
|
9025
9025
|
} catch (e) {
|
|
9026
9026
|
return { error: e?.message || "Tool execution failed" };
|
|
9027
9027
|
}
|
|
9028
|
-
},
|
|
9028
|
+
}, ge = async (e) => {
|
|
9029
9029
|
for (let t of e.functions || []) {
|
|
9030
9030
|
if (!t.client_side) continue;
|
|
9031
|
-
let e = await
|
|
9031
|
+
let e = await he(t);
|
|
9032
9032
|
if (O || C.readyState !== WebSocket.OPEN) return;
|
|
9033
9033
|
C.send(JSON.stringify({
|
|
9034
9034
|
type: "FunctionCallResponse",
|
|
@@ -9037,10 +9037,10 @@ async function Lm(e) {
|
|
|
9037
9037
|
content: typeof e == "string" ? e : JSON.stringify(e ?? {})
|
|
9038
9038
|
}));
|
|
9039
9039
|
}
|
|
9040
|
-
},
|
|
9040
|
+
}, P = (e) => {
|
|
9041
9041
|
switch (e.type) {
|
|
9042
9042
|
case "Welcome":
|
|
9043
|
-
Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (oe = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && (
|
|
9043
|
+
Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (oe = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && (j = e.barge_in_frames), S = e.session_id || r || n || null, a?.({ conversationId: S });
|
|
9044
9044
|
break;
|
|
9045
9045
|
case "ConversationText": {
|
|
9046
9046
|
let t = String(e.content || "");
|
|
@@ -9059,22 +9059,22 @@ async function Lm(e) {
|
|
|
9059
9059
|
break;
|
|
9060
9060
|
}
|
|
9061
9061
|
case "UserStartedSpeaking":
|
|
9062
|
-
D(),
|
|
9062
|
+
D(), N.stop(), ae = !1, re = !1, ne = !1, M && !se && (clearTimeout(M), M = null), c?.({ mode: "listening" });
|
|
9063
9063
|
break;
|
|
9064
9064
|
case "AgentStartedSpeaking":
|
|
9065
9065
|
re = !0, ne = !0, ie = !1, A = 0, c?.({ mode: "speaking" });
|
|
9066
9066
|
break;
|
|
9067
9067
|
case "AgentAudioDone":
|
|
9068
|
-
ae = !1, D(),
|
|
9068
|
+
ae = !1, D(), ce(e.turnComplete !== !1), N.isPlaying() || (ne = !1, c?.({ mode: "listening" }));
|
|
9069
9069
|
break;
|
|
9070
9070
|
case "FunctionCallRequest":
|
|
9071
|
-
|
|
9071
|
+
ge(e);
|
|
9072
9072
|
break;
|
|
9073
9073
|
case "AgentPreparing":
|
|
9074
9074
|
ae = !0;
|
|
9075
9075
|
break;
|
|
9076
9076
|
case "SessionEnding":
|
|
9077
|
-
console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"),
|
|
9077
|
+
console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), se = !0;
|
|
9078
9078
|
break;
|
|
9079
9079
|
case "AgentThinking":
|
|
9080
9080
|
c?.({ mode: "thinking" });
|
|
@@ -9091,16 +9091,16 @@ async function Lm(e) {
|
|
|
9091
9091
|
};
|
|
9092
9092
|
return C.onopen = () => C.send(JSON.stringify(h)), C.onmessage = (e) => {
|
|
9093
9093
|
if (e.data instanceof ArrayBuffer) {
|
|
9094
|
-
re &&
|
|
9094
|
+
re && N.enqueue(new Int16Array(e.data));
|
|
9095
9095
|
return;
|
|
9096
9096
|
}
|
|
9097
9097
|
try {
|
|
9098
|
-
|
|
9098
|
+
P(JSON.parse(e.data));
|
|
9099
9099
|
} catch {}
|
|
9100
9100
|
}, C.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), C.onclose = () => {
|
|
9101
|
-
|
|
9101
|
+
me(), o?.();
|
|
9102
9102
|
}, {
|
|
9103
|
-
endSession: async () =>
|
|
9103
|
+
endSession: async () => me(),
|
|
9104
9104
|
sendContextualUpdate: (e) => {
|
|
9105
9105
|
O || C.readyState !== WebSocket.OPEN || !e || C.send(JSON.stringify({
|
|
9106
9106
|
type: "UpdatePrompt",
|
|
@@ -12056,7 +12056,7 @@ function bg(e) {
|
|
|
12056
12056
|
function xg(e) {
|
|
12057
12057
|
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
|
|
12058
12058
|
"fwh-navigate-mvp": async (n) => {
|
|
12059
|
-
$("fwh-navigate-mvp ▶ raw parameters:", n);
|
|
12059
|
+
if ($("fwh-navigate-mvp ▶ raw parameters:", n), e?.isWalkthroughActive?.()) return $("fwh-navigate-mvp ✖ blocked — walkthrough in progress"), "NAVIGATION_BLOCKED_DURING_WALKTHROUGH. A walkthrough of the current page is in progress, so navigation is not allowed. Do NOT tell the visitor you navigated or offer to. Describe the requested section using the CURRENT page's own content (fwh-read-content-mvp), then stop.";
|
|
12060
12060
|
let i = gg(n), a = _g(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
|
|
12061
12061
|
if ($("fwh-navigate-mvp · coerced:", {
|
|
12062
12062
|
url: a,
|
|
@@ -12104,10 +12104,10 @@ function xg(e) {
|
|
|
12104
12104
|
sender: "user",
|
|
12105
12105
|
message: e
|
|
12106
12106
|
}]);
|
|
12107
|
-
n &&
|
|
12107
|
+
n && F(t, n);
|
|
12108
12108
|
}
|
|
12109
12109
|
} catch {}
|
|
12110
|
-
|
|
12110
|
+
Te();
|
|
12111
12111
|
let e = a;
|
|
12112
12112
|
try {
|
|
12113
12113
|
e = new URL(a, typeof window < "u" ? window.location.href : "").href;
|
|
@@ -12117,7 +12117,7 @@ function xg(e) {
|
|
|
12117
12117
|
let e = new URL(a, window.location.href).pathname.split("/").filter(Boolean).pop() || "";
|
|
12118
12118
|
n = e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) : "Home";
|
|
12119
12119
|
} catch {}
|
|
12120
|
-
t && typeof window < "u" &&
|
|
12120
|
+
t && typeof window < "u" && je(t, window.location.href, e, n), gr(e), $("fwh-navigate-mvp → real navigation", a);
|
|
12121
12121
|
let i = typeof window < "u" && !!qn();
|
|
12122
12122
|
if (typeof window < "u" && window.__fe_triggerVoiceNavHooks && window.__fe_triggerVoiceNavHooks(), i && Rn(12e3), br(a, { voiceActive: !0 }).catch(() => {}), i) try {
|
|
12123
12123
|
let e = new URL(a, window.location.origin).pathname, t = window.location.pathname, n = Date.now() + 2e3;
|
|
@@ -12398,8 +12398,8 @@ function xg(e) {
|
|
|
12398
12398
|
var Sg = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
|
|
12399
12399
|
function Cg() {
|
|
12400
12400
|
try {
|
|
12401
|
-
let { headings: e } = yg();
|
|
12402
|
-
return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !Sg.test(e.trim()));
|
|
12401
|
+
let { headings: e, pageTitleHeading: t } = yg();
|
|
12402
|
+
return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !Sg.test(e.trim()));
|
|
12403
12403
|
} catch {
|
|
12404
12404
|
return [];
|
|
12405
12405
|
}
|
|
@@ -12835,62 +12835,62 @@ function Pg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
12835
12835
|
}
|
|
12836
12836
|
function Fg({ 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" }) {
|
|
12837
12837
|
c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
|
|
12838
|
-
let [T, E] = m("idle"), [D, ee] = m(!1), [O, k] = m(!1), [te, ne] = m(!1), [re, A] = m(""), [ie, ae] = m(""), oe = p(!1),
|
|
12839
|
-
|
|
12838
|
+
let [T, E] = m("idle"), [D, ee] = m(!1), [O, k] = m(!1), [te, ne] = m(!1), [re, A] = m(""), [ie, ae] = m(""), oe = p(!1), j = p(!1), M = p(null), se = p(0), ce = p(""), N = p(!1), le = p(0), ue = p(!1), de = p(!1), fe = p(!1), pe = p([]), me = p(null), he = (e) => {
|
|
12839
|
+
ue.current = e, e || (de.current = !1), P.current?.setWalkthroughActive?.(e);
|
|
12840
12840
|
};
|
|
12841
|
-
|
|
12842
|
-
if (
|
|
12843
|
-
let e =
|
|
12844
|
-
|
|
12845
|
-
let t =
|
|
12841
|
+
me.current = async () => {
|
|
12842
|
+
if (de.current) return;
|
|
12843
|
+
let e = pe.current;
|
|
12844
|
+
ge.current += 1;
|
|
12845
|
+
let t = ge.current, n = e[t];
|
|
12846
12846
|
if (!n) {
|
|
12847
|
-
|
|
12847
|
+
he(!1), e.length && P.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
|
|
12848
12848
|
return;
|
|
12849
12849
|
}
|
|
12850
12850
|
try {
|
|
12851
12851
|
await toolsRef.current?.highlightOnPage?.({ section_text: n });
|
|
12852
12852
|
} catch {}
|
|
12853
|
-
console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`),
|
|
12853
|
+
console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`), P.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t === 0 ? "Starting with" : "Next —"} ${n}. 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; read the section's content silently first (fwh-read-content-mvp) if you don't already have it. 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 });
|
|
12854
12854
|
};
|
|
12855
|
-
let
|
|
12855
|
+
let ge = p(0), P = p(null), _e = p(""), ve = p(async () => {}), ye = p(!1), be = p(!1), xe = p(!1), Se = p(!1), I = p("minimized"), Ee = p(null), De = p(null), L = p(null), Oe = p(0), Ae = p(!1), je = p("idle"), R = p(null), Ne = p(!1), Pe = p(null), Fe = o((e = "minimized") => {
|
|
12856
12856
|
console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
|
|
12857
12857
|
destination: e,
|
|
12858
12858
|
stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
|
|
12859
|
-
}),
|
|
12860
|
-
|
|
12859
|
+
}), I.current = e, Se.current = !0, queueMicrotask(() => {
|
|
12860
|
+
ye.current || (ye.current = !0, ve.current?.());
|
|
12861
12861
|
});
|
|
12862
12862
|
}, [l]), Ie = o(() => {
|
|
12863
|
-
|
|
12863
|
+
M.current &&= (clearTimeout(M.current), null);
|
|
12864
12864
|
}, []);
|
|
12865
12865
|
c(() => {
|
|
12866
12866
|
if (y) {
|
|
12867
12867
|
oe.current = !1;
|
|
12868
12868
|
return;
|
|
12869
12869
|
}
|
|
12870
|
-
if (oe.current = !0,
|
|
12871
|
-
|
|
12872
|
-
let e =
|
|
12873
|
-
|
|
12870
|
+
if (oe.current = !0, j.current = !1, ne(!1), Ie(), N.current) {
|
|
12871
|
+
N.current = !1, P.current?.setMicMuted?.(!1);
|
|
12872
|
+
let e = ce.current;
|
|
12873
|
+
ce.current = "", P.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && P.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
|
|
12874
12874
|
}
|
|
12875
|
-
|
|
12875
|
+
P.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.");
|
|
12876
12876
|
}, [y, Ie]);
|
|
12877
12877
|
let z = /(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 = o(() => {
|
|
12878
|
-
Ie(),
|
|
12879
|
-
if (!(!
|
|
12880
|
-
|
|
12878
|
+
Ie(), M.current = setTimeout(() => {
|
|
12879
|
+
if (!(!j.current || oe.current)) if (se.current < 3) {
|
|
12880
|
+
se.current += 1;
|
|
12881
12881
|
try {
|
|
12882
|
-
|
|
12882
|
+
P.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
|
|
12883
12883
|
} catch {}
|
|
12884
12884
|
ze();
|
|
12885
12885
|
} else {
|
|
12886
12886
|
try {
|
|
12887
|
-
|
|
12887
|
+
P.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");
|
|
12888
12888
|
} catch {}
|
|
12889
|
-
|
|
12889
|
+
j.current = !1, ne(!1), Ie(), Ae.current = !0;
|
|
12890
12890
|
}
|
|
12891
12891
|
}, 1e4);
|
|
12892
12892
|
}, [Ie]), Be = o(async (e) => {
|
|
12893
|
-
|
|
12893
|
+
Se.current = !0;
|
|
12894
12894
|
try {
|
|
12895
12895
|
On();
|
|
12896
12896
|
} catch {}
|
|
@@ -12898,9 +12898,9 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
12898
12898
|
Me(i);
|
|
12899
12899
|
} catch {}
|
|
12900
12900
|
try {
|
|
12901
|
-
await
|
|
12901
|
+
await P.current?.endSession?.();
|
|
12902
12902
|
} catch {}
|
|
12903
|
-
let t =
|
|
12903
|
+
let t = Ee.current, n = De.current;
|
|
12904
12904
|
if (t && s && a) {
|
|
12905
12905
|
let e = n ? Math.round((Date.now() - n) / 1e3) : 0;
|
|
12906
12906
|
fetch(`${a}/api/voice/save-chat-recording`, {
|
|
@@ -12914,8 +12914,8 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
12914
12914
|
})
|
|
12915
12915
|
}).catch((e) => console.warn("[FlowEngage] save-chat-recording failed:", e.message));
|
|
12916
12916
|
}
|
|
12917
|
-
if (
|
|
12918
|
-
|
|
12917
|
+
if (Ee.current = null, De.current = null, P.current = null, E("idle"), ee(!1), ye.current = !1, wr(), i) try {
|
|
12918
|
+
we(i);
|
|
12919
12919
|
} catch {}
|
|
12920
12920
|
typeof u == "function" && await u(l.current), e?.();
|
|
12921
12921
|
}, [
|
|
@@ -12925,8 +12925,8 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
12925
12925
|
s,
|
|
12926
12926
|
a
|
|
12927
12927
|
]);
|
|
12928
|
-
|
|
12929
|
-
|
|
12928
|
+
ve.current = () => Be(I.current === "chat" ? t : n), c(() => {
|
|
12929
|
+
be.current = D;
|
|
12930
12930
|
}, [D]), c(() => {
|
|
12931
12931
|
d && Fe("chat");
|
|
12932
12932
|
}, [d]), c(() => {
|
|
@@ -12938,13 +12938,13 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
12938
12938
|
}
|
|
12939
12939
|
try {
|
|
12940
12940
|
if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
|
|
12941
|
-
l.current = [],
|
|
12941
|
+
l.current = [], _e.current = "", ye.current = !1, xe.current = !1, Se.current = !1, I.current = "minimized", Cr({ onBeforeNavigate: () => {
|
|
12942
12942
|
if (i && l.current.length > 0) try {
|
|
12943
12943
|
let e = Fh(l.current);
|
|
12944
|
-
e &&
|
|
12944
|
+
e && F(i, e);
|
|
12945
12945
|
} catch {}
|
|
12946
12946
|
if (!qn()) {
|
|
12947
|
-
let e =
|
|
12947
|
+
let e = Ee.current, t = De.current;
|
|
12948
12948
|
if (e && s && a) try {
|
|
12949
12949
|
let n = t ? Math.round((Date.now() - t) / 1e3) : 0, r = JSON.stringify({
|
|
12950
12950
|
chatId: s,
|
|
@@ -12957,23 +12957,24 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
12957
12957
|
headers: { "Content-Type": "application/json" },
|
|
12958
12958
|
body: r,
|
|
12959
12959
|
keepalive: !0
|
|
12960
|
-
}).catch(() => {}),
|
|
12960
|
+
}).catch(() => {}), Ee.current = null, De.current = null;
|
|
12961
12961
|
} catch {}
|
|
12962
12962
|
}
|
|
12963
|
-
|
|
12963
|
+
Te();
|
|
12964
12964
|
} });
|
|
12965
12965
|
let t = wg(xg({
|
|
12966
12966
|
siteId: i || null,
|
|
12967
12967
|
apiBaseUrl: a || null,
|
|
12968
12968
|
chatId: s || null,
|
|
12969
|
-
getLastUserVoiceText: () =>
|
|
12969
|
+
getLastUserVoiceText: () => _e.current,
|
|
12970
|
+
isWalkthroughActive: () => ue.current && !de.current,
|
|
12970
12971
|
requestEndSession: () => {
|
|
12971
|
-
|
|
12972
|
+
Ae.current = !0;
|
|
12972
12973
|
},
|
|
12973
12974
|
requestEmailCollection: () => {
|
|
12974
|
-
b && (oe.current ||
|
|
12975
|
+
b && (oe.current || j.current || (j.current = !0, se.current = 0, ne(!0), ze()));
|
|
12975
12976
|
}
|
|
12976
|
-
})), n = i ?
|
|
12977
|
+
})), n = i ? Ce(i) : null, r = !!n?.transcript, u = i ? Me(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 = {
|
|
12977
12978
|
apiBaseUrl: a,
|
|
12978
12979
|
siteId: i,
|
|
12979
12980
|
chatId: s,
|
|
@@ -13004,17 +13005,17 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13004
13005
|
let e = f || "";
|
|
13005
13006
|
x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to the ${w} page!`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
|
|
13006
13007
|
}
|
|
13007
|
-
let O = !1, k = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [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, te = !1, re = !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, A = r && !p, ie = !1, ae = A ? `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,
|
|
13008
|
+
let O = !1, k = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [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, te = !1, re = !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, A = r && !p, ie = !1, ae = A ? `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, M = !1, ve = !1, we = b && !!y && !fe.current, L = await Rm.startSession({
|
|
13008
13009
|
...x,
|
|
13009
13010
|
onConnect: ({ conversationId: e }) => {
|
|
13010
|
-
|
|
13011
|
+
Ee.current = e, De.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
13011
13012
|
},
|
|
13012
13013
|
onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
|
|
13013
13014
|
onSessionInfo: ({ emailOnFile: e }) => {
|
|
13014
|
-
|
|
13015
|
+
fe.current = !!e, e && (oe.current = !0, j.current = !1, ne(!1), Ie(), console.log("[FlowEngage] email already on file per server — gate disabled"));
|
|
13015
13016
|
},
|
|
13016
13017
|
onAgentTurnEnd: () => {
|
|
13017
|
-
e ||
|
|
13018
|
+
e || ue.current && (de.current || N.current || setTimeout(() => me.current?.(), 250));
|
|
13018
13019
|
},
|
|
13019
13020
|
onSessionEnding: () => {
|
|
13020
13021
|
e || Fe("minimized");
|
|
@@ -13022,128 +13023,124 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13022
13023
|
onModeChange: ({ mode: t, tentative: n }) => {
|
|
13023
13024
|
if (!e) {
|
|
13024
13025
|
if (t === "speaking") {
|
|
13025
|
-
R.current &&= (clearTimeout(R.current), null), Pe.current &&= (clearTimeout(Pe.current), null), E("speaking"),
|
|
13026
|
+
R.current &&= (clearTimeout(R.current), null), Pe.current &&= (clearTimeout(Pe.current), null), E("speaking"), je.current = "speaking", Ne.current = !1;
|
|
13026
13027
|
return;
|
|
13027
13028
|
}
|
|
13028
13029
|
if (t === "user-speaking") {
|
|
13029
|
-
|
|
13030
|
-
|
|
13030
|
+
try {
|
|
13031
|
+
On();
|
|
13032
|
+
} catch {}
|
|
13033
|
+
if (Pe.current &&= (clearTimeout(Pe.current), null), je.current === "speaking") return;
|
|
13034
|
+
R.current &&= (clearTimeout(R.current), null), je.current !== "listening" && (E("listening"), je.current = "listening");
|
|
13031
13035
|
return;
|
|
13032
13036
|
}
|
|
13033
13037
|
if (t === "thinking") {
|
|
13034
|
-
if (R.current &&= (clearTimeout(R.current), null), Pe.current &&= (clearTimeout(Pe.current), null),
|
|
13035
|
-
E("thinking"),
|
|
13036
|
-
Pe.current = null, !(e ||
|
|
13038
|
+
if (R.current &&= (clearTimeout(R.current), null), Pe.current &&= (clearTimeout(Pe.current), null), je.current === "speaking") return;
|
|
13039
|
+
E("thinking"), je.current = "thinking", n && (Pe.current = setTimeout(() => {
|
|
13040
|
+
Pe.current = null, !(e || je.current !== "thinking") && (je.current = "listening", E("listening"));
|
|
13037
13041
|
}, 4e3));
|
|
13038
13042
|
return;
|
|
13039
13043
|
}
|
|
13040
|
-
if (
|
|
13041
|
-
|
|
13044
|
+
if (je.current = "listening", Ae.current) {
|
|
13045
|
+
Ae.current = !1, Fe();
|
|
13042
13046
|
return;
|
|
13043
13047
|
}
|
|
13044
|
-
if (
|
|
13045
|
-
|
|
13048
|
+
if (we && !ve && !oe.current && !fe.current) {
|
|
13049
|
+
ve = !0, O = !0, te = !0;
|
|
13046
13050
|
try {
|
|
13047
|
-
|
|
13051
|
+
P.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: \"Before I answer that, could you please enter your email in the text box below?\" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be \"Before\". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.");
|
|
13048
13052
|
} catch {}
|
|
13049
13053
|
}
|
|
13050
13054
|
if (k && !O) {
|
|
13051
13055
|
O = !0;
|
|
13052
13056
|
try {
|
|
13053
|
-
|
|
13057
|
+
P.current?.sendContextualUpdate?.(k);
|
|
13054
13058
|
} catch {}
|
|
13055
13059
|
}
|
|
13056
13060
|
if (ae && !ie) {
|
|
13057
13061
|
ie = !0;
|
|
13058
13062
|
try {
|
|
13059
|
-
|
|
13063
|
+
P.current?.sendContextualUpdate?.(ae);
|
|
13060
13064
|
} catch {}
|
|
13061
13065
|
}
|
|
13062
13066
|
if (re && !te) {
|
|
13063
13067
|
te = !0;
|
|
13064
13068
|
try {
|
|
13065
|
-
|
|
13069
|
+
P.current?.sendContextualUpdate?.(re);
|
|
13066
13070
|
} catch {}
|
|
13067
13071
|
}
|
|
13068
13072
|
R.current && clearTimeout(R.current), R.current = setTimeout(() => {
|
|
13069
|
-
e ||
|
|
13073
|
+
e || je.current !== "speaking" && (Ne.current || (R.current = null, je.current = "listening", E("listening")));
|
|
13070
13074
|
}, 1200);
|
|
13071
13075
|
}
|
|
13072
13076
|
},
|
|
13073
13077
|
onMessage: (t) => {
|
|
13074
|
-
if (e ||
|
|
13075
|
-
if (t.role === "user" && z.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null),
|
|
13076
|
-
else if (t.role === "user" &&
|
|
13078
|
+
if (e || N.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
|
|
13079
|
+
if (t.role === "user" && z.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), he(!0), de.current = !1, le.current = 0, ge.current = -1, pe.current = Cg(), setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${pe.current.length} sections on this page`);
|
|
13080
|
+
else if (t.role === "user" && ue.current) {
|
|
13077
13081
|
let e = String(t.message || "").trim();
|
|
13078
|
-
Re.test(e) ?
|
|
13082
|
+
Re.test(e) ? de.current && (de.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => me.current?.(), 300)) : (de.current = !0, console.debug("[FlowEngage] walkthrough paused — visitor interjected"));
|
|
13079
13083
|
}
|
|
13080
13084
|
if (t.role !== "user" && Le.test(String(t.message || ""))) {
|
|
13081
|
-
let e =
|
|
13082
|
-
!e ||
|
|
13085
|
+
let e = pe.current.length;
|
|
13086
|
+
!e || ge.current >= e - 1 ? he(!1) : console.debug(`[FlowEngage] agent claimed completion at step ${ge.current + 1}/${e} — ignoring, tour continues`);
|
|
13083
13087
|
}
|
|
13084
13088
|
let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
|
|
13085
13089
|
if (r) {
|
|
13086
|
-
if (n === "user") {
|
|
13087
|
-
ve.current = r, typeof window < "u" && (window.__fe_user_nav_during_speech = null), Ne.current = !0, R.current &&= (clearTimeout(R.current), null), L.current !== "speaking" && (E("thinking"), L.current = "thinking");
|
|
13088
|
-
try {
|
|
13089
|
-
On();
|
|
13090
|
-
} catch {}
|
|
13091
|
-
Te && !j && !oe.current && !pe.current && (j = !0, le.current = r, M.current = !0, N.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), N.current?.setMicMuted?.(!0), se.current || (se.current = !0, ce.current = 0, ne(!0), ze()));
|
|
13092
|
-
}
|
|
13093
|
-
if (l.current = [...l.current, {
|
|
13090
|
+
if (n === "user" && (_e.current = r, typeof window < "u" && (window.__fe_user_nav_during_speech = null), Ne.current = !0, R.current &&= (clearTimeout(R.current), null), je.current !== "speaking" && (E("thinking"), je.current = "thinking"), we && !M && !oe.current && !fe.current && (M = !0, ce.current = r, N.current = !0, P.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), P.current?.setMicMuted?.(!0), j.current || (j.current = !0, se.current = 0, ne(!0), ze()))), l.current = [...l.current, {
|
|
13094
13091
|
sender: n,
|
|
13095
13092
|
message: r,
|
|
13096
13093
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13097
13094
|
debug: t.debug
|
|
13098
13095
|
}], i) try {
|
|
13099
13096
|
let e = Fh(l.current);
|
|
13100
|
-
e &&
|
|
13097
|
+
e && F(i, e);
|
|
13101
13098
|
} catch {}
|
|
13102
13099
|
if (jg(n, r)) {
|
|
13103
|
-
|
|
13100
|
+
Ae.current = !0;
|
|
13104
13101
|
return;
|
|
13105
13102
|
}
|
|
13106
|
-
if (
|
|
13107
|
-
|
|
13103
|
+
if (be.current && n === "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(r)) if (Oe.current += 1, Oe.current === 2) try {
|
|
13104
|
+
P.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.");
|
|
13108
13105
|
} catch {}
|
|
13109
|
-
else
|
|
13106
|
+
else Oe.current >= 5 && Fe("minimized");
|
|
13110
13107
|
}
|
|
13111
13108
|
},
|
|
13112
13109
|
onError: (t) => {
|
|
13113
|
-
if (!e && !
|
|
13114
|
-
|
|
13110
|
+
if (!e && !Se.current && !xe.current && !ke()) {
|
|
13111
|
+
xe.current = !0, console.error("[FlowEngageVoiceCall] session:error", {
|
|
13115
13112
|
message: t?.message,
|
|
13116
13113
|
name: t?.name,
|
|
13117
13114
|
raw: t
|
|
13118
13115
|
});
|
|
13119
13116
|
try {
|
|
13120
|
-
|
|
13117
|
+
P.current?.setMicMuted?.(!0);
|
|
13121
13118
|
} catch {}
|
|
13122
13119
|
ee(!0), E("error"), Fe("chat");
|
|
13123
13120
|
}
|
|
13124
13121
|
},
|
|
13125
13122
|
onDisconnect: (t) => {
|
|
13126
|
-
if (e ||
|
|
13123
|
+
if (e || Se.current || xe.current || ke()) return;
|
|
13127
13124
|
let n = l.current?.length || 0;
|
|
13128
13125
|
console.warn("[FlowEngageVoiceCall] session:disconnected", {
|
|
13129
13126
|
historyCount: n,
|
|
13130
13127
|
reason: t?.reason,
|
|
13131
13128
|
closeCode: t?.context?.code,
|
|
13132
13129
|
closeReason: t?.context?.reason || t?.message,
|
|
13133
|
-
lastUserText:
|
|
13134
|
-
wasMuted:
|
|
13135
|
-
}),
|
|
13130
|
+
lastUserText: _e.current || "",
|
|
13131
|
+
wasMuted: be.current
|
|
13132
|
+
}), xe.current = !0;
|
|
13136
13133
|
try {
|
|
13137
|
-
|
|
13134
|
+
P.current?.setMicMuted?.(!0);
|
|
13138
13135
|
} catch {}
|
|
13139
13136
|
ee(!0), Fe("chat");
|
|
13140
13137
|
}
|
|
13141
13138
|
});
|
|
13142
13139
|
if (e) {
|
|
13143
|
-
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"),
|
|
13140
|
+
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), L.endSession().catch(() => {});
|
|
13144
13141
|
return;
|
|
13145
13142
|
}
|
|
13146
|
-
o =
|
|
13143
|
+
o = L, P.current = L, E("listening");
|
|
13147
13144
|
try {
|
|
13148
13145
|
let e = typeof window < "u" ? window.location.href : "", a = "[]";
|
|
13149
13146
|
try {
|
|
@@ -13155,7 +13152,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13155
13152
|
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(" | "));
|
|
13156
13153
|
} catch {}
|
|
13157
13154
|
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` : "";
|
|
13158
|
-
|
|
13155
|
+
L.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. 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. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
|
|
13159
13156
|
} catch {}
|
|
13160
13157
|
if (typeof window < "u") {
|
|
13161
13158
|
let t = window.location.pathname, n = Date.now(), r = (e) => {
|
|
@@ -13201,7 +13198,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13201
13198
|
ts: Date.now()
|
|
13202
13199
|
}), console.log(`[FlowEngage] visitor navigation detected: "${a}" → "${i}" (agent target: ${D || "none"})`);
|
|
13203
13200
|
try {
|
|
13204
|
-
|
|
13201
|
+
P.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${d}" page (${o}). Page title: "${s}". Sections: ${JSON.stringify(c)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${d} 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 "${d}" only.]`);
|
|
13205
13202
|
} catch {}
|
|
13206
13203
|
};
|
|
13207
13204
|
c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
|
|
@@ -13209,7 +13206,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13209
13206
|
}, d = () => setTimeout(i, 50), window.addEventListener("popstate", d);
|
|
13210
13207
|
}
|
|
13211
13208
|
} catch (r) {
|
|
13212
|
-
e || (console.error("[FlowEngage] startSession failed", r), r.message && r.message.includes("Too many voice sessions") ? (alert(r.message), n && n("minimized")) : (E("error"),
|
|
13209
|
+
e || (console.error("[FlowEngage] startSession failed", r), r.message && r.message.includes("Too many voice sessions") ? (alert(r.message), n && n("minimized")) : (E("error"), I.current = "chat", window.setTimeout(() => {
|
|
13213
13210
|
e || t?.();
|
|
13214
13211
|
}, 0)));
|
|
13215
13212
|
}
|
|
@@ -13218,15 +13215,15 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13218
13215
|
agentId: r,
|
|
13219
13216
|
siteId: i,
|
|
13220
13217
|
apiBaseUrl: a
|
|
13221
|
-
}), e = !0,
|
|
13218
|
+
}), e = !0, Se.current = !0;
|
|
13222
13219
|
try {
|
|
13223
13220
|
On();
|
|
13224
13221
|
} catch {}
|
|
13225
13222
|
if (i) try {
|
|
13226
13223
|
Me(i);
|
|
13227
13224
|
} catch {}
|
|
13228
|
-
typeof window < "u" && (window.__fe_user_nav_during_speech = null), wr(), R.current &&= (clearTimeout(R.current), null), Pe.current &&= (clearTimeout(Pe.current), null),
|
|
13229
|
-
let t = o ||
|
|
13225
|
+
typeof window < "u" && (window.__fe_user_nav_during_speech = null), wr(), R.current &&= (clearTimeout(R.current), null), Pe.current &&= (clearTimeout(Pe.current), null), M.current &&= (clearTimeout(M.current), null), Ne.current = !1, je.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
|
|
13226
|
+
let t = o || P.current, n = Ee.current, f = De.current;
|
|
13230
13227
|
if (t?.endSession?.().catch(() => {}), n && s && a) {
|
|
13231
13228
|
let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
|
|
13232
13229
|
chatId: s,
|
|
@@ -13239,7 +13236,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13239
13236
|
headers: { "Content-Type": "application/json" },
|
|
13240
13237
|
body: t,
|
|
13241
13238
|
keepalive: !0
|
|
13242
|
-
}).catch(() => {}),
|
|
13239
|
+
}).catch(() => {}), Ee.current = null, De.current = null;
|
|
13243
13240
|
}
|
|
13244
13241
|
typeof u == "function" && l.current.length > 0 && u(l.current).catch?.(() => {});
|
|
13245
13242
|
};
|
|
@@ -13252,21 +13249,21 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13252
13249
|
if (!O) return;
|
|
13253
13250
|
let e = (e) => {
|
|
13254
13251
|
let t = e.composedPath?.()?.[0] || e.target;
|
|
13255
|
-
|
|
13252
|
+
L.current && !L.current.contains(t) && k(!1);
|
|
13256
13253
|
};
|
|
13257
13254
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
13258
13255
|
}, [O]);
|
|
13259
13256
|
let Ve = async () => {
|
|
13260
|
-
if (
|
|
13257
|
+
if (P.current) try {
|
|
13261
13258
|
if (D) {
|
|
13262
|
-
|
|
13259
|
+
Oe.current = 0, await P.current.setMicMuted?.(!1), ee(!1);
|
|
13263
13260
|
try {
|
|
13264
|
-
|
|
13261
|
+
P.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
|
|
13265
13262
|
} catch {}
|
|
13266
13263
|
} else {
|
|
13267
|
-
|
|
13264
|
+
Oe.current = 0, await P.current.setMicMuted?.(!0), ee(!0);
|
|
13268
13265
|
try {
|
|
13269
|
-
|
|
13266
|
+
P.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.");
|
|
13270
13267
|
} catch {}
|
|
13271
13268
|
}
|
|
13272
13269
|
} catch {}
|
|
@@ -13277,15 +13274,15 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13277
13274
|
ae("Please enter a valid email address.");
|
|
13278
13275
|
return;
|
|
13279
13276
|
}
|
|
13280
|
-
ae(""), oe.current = !0,
|
|
13277
|
+
ae(""), oe.current = !0, j.current = !1, Ie(), ne(!1), A(""), N.current = !1;
|
|
13281
13278
|
try {
|
|
13282
13279
|
typeof v == "function" && await v(t);
|
|
13283
13280
|
} catch {}
|
|
13284
|
-
|
|
13285
|
-
let n =
|
|
13286
|
-
|
|
13281
|
+
P.current?.setMicMuted?.(!1);
|
|
13282
|
+
let n = ce.current;
|
|
13283
|
+
ce.current = "";
|
|
13287
13284
|
try {
|
|
13288
|
-
|
|
13285
|
+
P.current?.injectAgentSpeech?.("Thank you for submitting your email."), P.current?.sendUserMessage?.(n || "The visitor's email is on file. Carry on helping them and never ask for it again.");
|
|
13289
13286
|
} catch {}
|
|
13290
13287
|
}, [
|
|
13291
13288
|
re,
|
|
@@ -13293,7 +13290,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13293
13290
|
Ie
|
|
13294
13291
|
]), Ue = Array.isArray(e) && e[0] || "#3B82F6";
|
|
13295
13292
|
return /* @__PURE__ */ _("div", {
|
|
13296
|
-
ref:
|
|
13293
|
+
ref: L,
|
|
13297
13294
|
style: {
|
|
13298
13295
|
position: "relative",
|
|
13299
13296
|
display: "flex",
|
|
@@ -13531,7 +13528,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13531
13528
|
children: [
|
|
13532
13529
|
/* @__PURE__ */ _("button", {
|
|
13533
13530
|
onClick: () => {
|
|
13534
|
-
k(!1),
|
|
13531
|
+
k(!1), I.current = "chat", Be(t);
|
|
13535
13532
|
},
|
|
13536
13533
|
style: {
|
|
13537
13534
|
display: "flex",
|
|
@@ -13560,7 +13557,7 @@ function Fg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13560
13557
|
}),
|
|
13561
13558
|
/* @__PURE__ */ _("button", {
|
|
13562
13559
|
onClick: () => {
|
|
13563
|
-
k(!1),
|
|
13560
|
+
k(!1), I.current = "minimized", Be(n);
|
|
13564
13561
|
},
|
|
13565
13562
|
style: {
|
|
13566
13563
|
display: "flex",
|
|
@@ -13686,8 +13683,8 @@ var Lg = () => /* @__PURE__ */ g("div", {
|
|
|
13686
13683
|
} }, e))
|
|
13687
13684
|
})
|
|
13688
13685
|
});
|
|
13689
|
-
function Rg({ 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: ee, onFileSelect: O, onRemoveSelectedFile: k, attachmentError: te, isUploadingAttachment: ne, requiresEmail: re, emailInput: A, setEmailInput: ie, emailError: ae, emailCaptureSuccess: oe, replyContext:
|
|
13690
|
-
let
|
|
13686
|
+
function Rg({ 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: ee, onFileSelect: O, onRemoveSelectedFile: k, attachmentError: te, isUploadingAttachment: ne, requiresEmail: re, emailInput: A, setEmailInput: ie, emailError: ae, emailCaptureSuccess: oe, replyContext: j, setReplyContext: M, webRTCError: se, micError: ce, setMicError: N, dismissCallError: le, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: P, onCollapse: _e, onStartVoice: ve, voiceEnabled: ye, headerBgColor: be, onNewChat: xe, showPoweredBy: Se, privacyPolicyUrl: F, getVisitorChatHistory: Ce, resumeChat: we, isSessionRestoring: I, isClosing: Te }) {
|
|
13687
|
+
let Ee = l.length > 0, De = T || E || w, L = !!ue, [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, R] = m([]), [Ne, Pe] = m(!1), Fe = p(null), [Ie, z] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Le, Re] = m(0);
|
|
13691
13688
|
c(() => {
|
|
13692
13689
|
if (!s) return;
|
|
13693
13690
|
let e = window.visualViewport;
|
|
@@ -13700,9 +13697,9 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13700
13697
|
};
|
|
13701
13698
|
}, [s]);
|
|
13702
13699
|
let ze = s && window.innerHeight - Ie > 150, Be = async () => {
|
|
13703
|
-
|
|
13700
|
+
ke(!1), je(!0), Pe(!0);
|
|
13704
13701
|
try {
|
|
13705
|
-
let e = await
|
|
13702
|
+
let e = await Ce();
|
|
13706
13703
|
e?.data && R(e.data);
|
|
13707
13704
|
} catch (e) {
|
|
13708
13705
|
console.error(e);
|
|
@@ -13710,16 +13707,16 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13710
13707
|
Pe(!1);
|
|
13711
13708
|
}
|
|
13712
13709
|
}, Ve = async (e) => {
|
|
13713
|
-
|
|
13710
|
+
je(!1), we?.(e.chatId);
|
|
13714
13711
|
};
|
|
13715
13712
|
return c(() => {
|
|
13716
|
-
if (!
|
|
13713
|
+
if (!Oe) return;
|
|
13717
13714
|
let e = (e) => {
|
|
13718
13715
|
let t = e.composedPath?.()?.[0] || e.target;
|
|
13719
|
-
Fe.current && !Fe.current.contains(t) &&
|
|
13716
|
+
Fe.current && !Fe.current.contains(t) && ke(!1);
|
|
13720
13717
|
};
|
|
13721
13718
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
13722
|
-
}, [
|
|
13719
|
+
}, [Oe]), /* @__PURE__ */ _("div", {
|
|
13723
13720
|
style: s ? {
|
|
13724
13721
|
"--flowengage-primary": n,
|
|
13725
13722
|
"--flowengage-accent": n,
|
|
@@ -13733,7 +13730,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13733
13730
|
display: "flex",
|
|
13734
13731
|
flexDirection: "column",
|
|
13735
13732
|
overflow: "hidden",
|
|
13736
|
-
animation:
|
|
13733
|
+
animation: Te ? "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)"
|
|
13737
13734
|
} : {
|
|
13738
13735
|
"--flowengage-primary": n,
|
|
13739
13736
|
"--flowengage-accent": n,
|
|
@@ -13746,7 +13743,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13746
13743
|
flexDirection: "column",
|
|
13747
13744
|
overflow: "hidden",
|
|
13748
13745
|
position: "relative",
|
|
13749
|
-
animation:
|
|
13746
|
+
animation: Te ? "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)"
|
|
13750
13747
|
},
|
|
13751
13748
|
children: [
|
|
13752
13749
|
/* @__PURE__ */ _("div", {
|
|
@@ -13756,7 +13753,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13756
13753
|
alignItems: "center",
|
|
13757
13754
|
columnGap: "14px",
|
|
13758
13755
|
padding: "16px 10px 14px",
|
|
13759
|
-
background:
|
|
13756
|
+
background: be || "transparent",
|
|
13760
13757
|
flexShrink: 0,
|
|
13761
13758
|
position: "relative",
|
|
13762
13759
|
zIndex: 30
|
|
@@ -13769,7 +13766,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13769
13766
|
alignItems: "center"
|
|
13770
13767
|
},
|
|
13771
13768
|
children: /* @__PURE__ */ g("button", {
|
|
13772
|
-
onClick:
|
|
13769
|
+
onClick: _e,
|
|
13773
13770
|
style: {
|
|
13774
13771
|
width: "40px",
|
|
13775
13772
|
height: "40px",
|
|
@@ -13874,7 +13871,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13874
13871
|
ref: Fe,
|
|
13875
13872
|
children: [/* @__PURE__ */ g("button", {
|
|
13876
13873
|
type: "button",
|
|
13877
|
-
onClick: () =>
|
|
13874
|
+
onClick: () => ke((e) => !e),
|
|
13878
13875
|
style: {
|
|
13879
13876
|
width: "40px",
|
|
13880
13877
|
height: "40px",
|
|
@@ -13920,7 +13917,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13920
13917
|
})
|
|
13921
13918
|
]
|
|
13922
13919
|
})
|
|
13923
|
-
}),
|
|
13920
|
+
}), Oe && /* @__PURE__ */ _("div", {
|
|
13924
13921
|
style: {
|
|
13925
13922
|
position: "absolute",
|
|
13926
13923
|
top: "34px",
|
|
@@ -13936,10 +13933,10 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13936
13933
|
animation: "fe-orb-fade-in 0.18s ease"
|
|
13937
13934
|
},
|
|
13938
13935
|
children: [
|
|
13939
|
-
|
|
13936
|
+
ye && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
|
|
13940
13937
|
type: "button",
|
|
13941
13938
|
onClick: () => {
|
|
13942
|
-
|
|
13939
|
+
ke(!1), ve?.();
|
|
13943
13940
|
},
|
|
13944
13941
|
style: {
|
|
13945
13942
|
display: "flex",
|
|
@@ -13981,7 +13978,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
13981
13978
|
/* @__PURE__ */ _("button", {
|
|
13982
13979
|
type: "button",
|
|
13983
13980
|
onClick: () => {
|
|
13984
|
-
|
|
13981
|
+
ke(!1), xe?.();
|
|
13985
13982
|
},
|
|
13986
13983
|
style: {
|
|
13987
13984
|
display: "flex",
|
|
@@ -14016,7 +14013,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14016
14013
|
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" })]
|
|
14017
14014
|
}), "Start new chat"]
|
|
14018
14015
|
}),
|
|
14019
|
-
|
|
14016
|
+
Ce && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", { style: {
|
|
14020
14017
|
height: "1px",
|
|
14021
14018
|
background: "rgba(255,255,255,0.07)",
|
|
14022
14019
|
margin: "0 14px"
|
|
@@ -14064,7 +14061,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14064
14061
|
/* @__PURE__ */ _("button", {
|
|
14065
14062
|
type: "button",
|
|
14066
14063
|
onClick: () => {
|
|
14067
|
-
|
|
14064
|
+
ke(!1), _e?.();
|
|
14068
14065
|
},
|
|
14069
14066
|
style: {
|
|
14070
14067
|
display: "flex",
|
|
@@ -14123,23 +14120,23 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14123
14120
|
]
|
|
14124
14121
|
}),
|
|
14125
14122
|
/* @__PURE__ */ g(_h, {
|
|
14126
|
-
webRTCError:
|
|
14127
|
-
micError:
|
|
14128
|
-
setMicError:
|
|
14129
|
-
dismissCallError:
|
|
14123
|
+
webRTCError: se,
|
|
14124
|
+
micError: ce,
|
|
14125
|
+
setMicError: N,
|
|
14126
|
+
dismissCallError: le,
|
|
14130
14127
|
isRateLimited: E,
|
|
14131
14128
|
rateLimitMessage: D
|
|
14132
14129
|
}),
|
|
14133
|
-
|
|
14130
|
+
ge && /* @__PURE__ */ g(Ph, {
|
|
14134
14131
|
agentName: v,
|
|
14135
14132
|
agentHeadshot: y,
|
|
14136
14133
|
fallbackAgentName: b,
|
|
14137
|
-
callDurationSeconds:
|
|
14138
|
-
isCallMuted:
|
|
14139
|
-
formatCallDuration:
|
|
14140
|
-
toggleCallMute:
|
|
14141
|
-
endWebRTCCall:
|
|
14142
|
-
onExpand:
|
|
14134
|
+
callDurationSeconds: he,
|
|
14135
|
+
isCallMuted: de,
|
|
14136
|
+
formatCallDuration: me,
|
|
14137
|
+
toggleCallMute: fe,
|
|
14138
|
+
endWebRTCCall: pe,
|
|
14139
|
+
onExpand: P,
|
|
14143
14140
|
primaryColor: n
|
|
14144
14141
|
}),
|
|
14145
14142
|
/* @__PURE__ */ _("div", {
|
|
@@ -14151,7 +14148,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14151
14148
|
background: "transparent",
|
|
14152
14149
|
position: "relative"
|
|
14153
14150
|
},
|
|
14154
|
-
children: [
|
|
14151
|
+
children: [Ae ? /* @__PURE__ */ _("div", {
|
|
14155
14152
|
style: {
|
|
14156
14153
|
position: "absolute",
|
|
14157
14154
|
inset: 0,
|
|
@@ -14170,7 +14167,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14170
14167
|
flexShrink: 0
|
|
14171
14168
|
},
|
|
14172
14169
|
children: /* @__PURE__ */ _("button", {
|
|
14173
|
-
onClick: () =>
|
|
14170
|
+
onClick: () => je(!1),
|
|
14174
14171
|
style: {
|
|
14175
14172
|
background: "none",
|
|
14176
14173
|
border: "none",
|
|
@@ -14264,18 +14261,18 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14264
14261
|
children: "No previous chats found."
|
|
14265
14262
|
})
|
|
14266
14263
|
})]
|
|
14267
|
-
}) : null,
|
|
14264
|
+
}) : null, Ee ? /* @__PURE__ */ g(mh, {
|
|
14268
14265
|
chatHistory: l,
|
|
14269
14266
|
isAiTyping: u,
|
|
14270
14267
|
isLoading: T,
|
|
14271
14268
|
isAgentTyping: d,
|
|
14272
|
-
setReplyContext:
|
|
14269
|
+
setReplyContext: M,
|
|
14273
14270
|
TypingDots: Lg,
|
|
14274
14271
|
primaryColor: n,
|
|
14275
14272
|
agentHeadshot: y,
|
|
14276
14273
|
agentDisplayName: v || b,
|
|
14277
14274
|
botAvatarNode: /* @__PURE__ */ g(Ig, { orbColors: t })
|
|
14278
|
-
}) :
|
|
14275
|
+
}) : I ? /* @__PURE__ */ _("div", {
|
|
14279
14276
|
style: {
|
|
14280
14277
|
flex: 1,
|
|
14281
14278
|
display: "flex",
|
|
@@ -14411,13 +14408,13 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14411
14408
|
setInput: S,
|
|
14412
14409
|
onSubmit: C,
|
|
14413
14410
|
isConversationEnded: w,
|
|
14414
|
-
callUiActive:
|
|
14415
|
-
handleToggleVoice:
|
|
14411
|
+
callUiActive: L,
|
|
14412
|
+
handleToggleVoice: ve,
|
|
14416
14413
|
showVoiceToggle: f === "agent",
|
|
14417
14414
|
activeScreen: f,
|
|
14418
|
-
inputDisabled:
|
|
14419
|
-
replyContext:
|
|
14420
|
-
clearReplyContext: () =>
|
|
14415
|
+
inputDisabled: De,
|
|
14416
|
+
replyContext: j,
|
|
14417
|
+
clearReplyContext: () => M(null),
|
|
14421
14418
|
onFileSelect: O,
|
|
14422
14419
|
selectedFile: ee,
|
|
14423
14420
|
onRemoveSelectedFile: k,
|
|
@@ -14438,7 +14435,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14438
14435
|
paddingBottom: "max(12px, env(safe-area-inset-bottom, 12px))",
|
|
14439
14436
|
pointerEvents: "none"
|
|
14440
14437
|
},
|
|
14441
|
-
children: [
|
|
14438
|
+
children: [F && /* @__PURE__ */ _("p", {
|
|
14442
14439
|
style: {
|
|
14443
14440
|
margin: "0 0 4px",
|
|
14444
14441
|
fontSize: "10px",
|
|
@@ -14451,7 +14448,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14451
14448
|
"This conversation is recorded for quality assurance purposes.",
|
|
14452
14449
|
" ",
|
|
14453
14450
|
/* @__PURE__ */ g("a", {
|
|
14454
|
-
href:
|
|
14451
|
+
href: F,
|
|
14455
14452
|
target: "_blank",
|
|
14456
14453
|
rel: "noopener noreferrer",
|
|
14457
14454
|
style: {
|
|
@@ -14461,7 +14458,7 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14461
14458
|
children: "See our privacy policy"
|
|
14462
14459
|
})
|
|
14463
14460
|
]
|
|
14464
|
-
}),
|
|
14461
|
+
}), Se && /* @__PURE__ */ _("span", {
|
|
14465
14462
|
style: {
|
|
14466
14463
|
fontSize: "11px",
|
|
14467
14464
|
color: "#9ca3af",
|
|
@@ -14481,33 +14478,33 @@ function Rg({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14481
14478
|
});
|
|
14482
14479
|
}
|
|
14483
14480
|
function zg() {
|
|
14484
|
-
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: ee, webRTCError: O, language: k, chatId: te, historyRef: ne, onMessageSync: re, sendMessage: A, uploadChatFile: ie, openWidget: ae, captureVisitorEmail: oe, setVoiceMode:
|
|
14481
|
+
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: ee, webRTCError: O, language: k, chatId: te, historyRef: ne, onMessageSync: re, sendMessage: A, uploadChatFile: ie, openWidget: ae, captureVisitorEmail: oe, setVoiceMode: j, endConversation: M, startNewChat: N, acceptCall: le, rejectCall: ue, endWebRTCCall: de, toggleCallMute: fe, dismissCallError: pe, startTyping: me, stopTyping: he, updateTypingDraft: ge, getVisitorChatHistory: P, resumeChat: _e, isSessionRestoring: ve, openToChatCounter: ye, voiceEndCounter: be } = Cn();
|
|
14485
14482
|
c(() => {
|
|
14486
14483
|
try {
|
|
14487
14484
|
or();
|
|
14488
14485
|
} catch {}
|
|
14489
14486
|
}, []), c(() => {
|
|
14490
|
-
|
|
14491
|
-
}, [
|
|
14492
|
-
let
|
|
14493
|
-
...
|
|
14494
|
-
...
|
|
14495
|
-
},
|
|
14496
|
-
...
|
|
14497
|
-
...
|
|
14498
|
-
},
|
|
14499
|
-
...
|
|
14500
|
-
...
|
|
14501
|
-
},
|
|
14487
|
+
ye && H !== "voice_mode" && H !== "text_chat" && H !== "call_screen" && (j?.(!1), U("text_chat"));
|
|
14488
|
+
}, [ye]);
|
|
14489
|
+
let xe = t?.widgetSettings || {}, Se = n?.widgetSettings || {}, F = {
|
|
14490
|
+
...xe.branding || {},
|
|
14491
|
+
...Se.branding || {}
|
|
14492
|
+
}, I = {
|
|
14493
|
+
...xe.theme || {},
|
|
14494
|
+
...Se.theme || {}
|
|
14495
|
+
}, Te = {
|
|
14496
|
+
...xe.features || {},
|
|
14497
|
+
...Se.features || {}
|
|
14498
|
+
}, De = Te.voice !== !1, L = Array.isArray(I.orbColors) && I.orbColors.length > 0 ? I.orbColors : null, ke = I.buttonColor || I.primaryColor || L?.[0] || "#3B82F6", Ae = {
|
|
14502
14499
|
small: 50,
|
|
14503
14500
|
medium: 64,
|
|
14504
14501
|
large: 80
|
|
14505
|
-
},
|
|
14502
|
+
}, je = Ae[I.orbSize] || Ae.small, Me = I.position || "bottom-right", R = F.fallbackAgentName || "Agent", Ne = Eg(L ?? I.chatBgColors), Pe = F.logo || F.logoUrl || null, Fe = k || "en", Ie = xe.recommendations?.[Fe] || [], z = (Se.recommendations?.[Fe] ?? Ie).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
14506
14503
|
id: e.key || `qr-${t}`,
|
|
14507
14504
|
label: e.label,
|
|
14508
14505
|
message: e.label,
|
|
14509
14506
|
text: e.label
|
|
14510
|
-
})), Le = Array.isArray(
|
|
14507
|
+
})), Le = Array.isArray(F.quickChatOptions) && F.quickChatOptions.length > 0 ? F.quickChatOptions : z, Re = F.hideWatermark === !0 ? !1 : F.showPoweredBy !== !1, ze = F.headerBgColor || null, Be = I.bottomPosition == null ? "1.5rem" : `${I.bottomPosition}px`, Ve = F.privacyPolicyUrl || null, He = F.chatbotEnabled !== !1 && I.chatbotEnabled !== !1, [Ue, We] = m(() => typeof window < "u" ? window.location.pathname : "/");
|
|
14511
14508
|
c(() => {
|
|
14512
14509
|
if (typeof window > "u") return;
|
|
14513
14510
|
let e = () => We(window.location.pathname), t = window.history.pushState.bind(window.history);
|
|
@@ -14519,24 +14516,24 @@ function zg() {
|
|
|
14519
14516
|
}, []);
|
|
14520
14517
|
let Ge = (() => {
|
|
14521
14518
|
let e = {
|
|
14522
|
-
...
|
|
14523
|
-
...
|
|
14519
|
+
...xe.pageVisibility || {},
|
|
14520
|
+
...Se.pageVisibility || {}
|
|
14524
14521
|
};
|
|
14525
14522
|
return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
|
|
14526
|
-
})(), Ke = Ge.length === 0 || Ge.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ue.startsWith(e.slice(0, -1)) : Ue.replace(/\/$/, "") === e.replace(/\/$/, "")), qe =
|
|
14527
|
-
entryPrompt:
|
|
14528
|
-
yesLabel:
|
|
14529
|
-
laterLabel:
|
|
14530
|
-
connectionTitle:
|
|
14531
|
-
connectionSubtitle:
|
|
14532
|
-
voiceLabel:
|
|
14533
|
-
textLabel:
|
|
14534
|
-
chatTitle:
|
|
14535
|
-
hasCustomTitle: !!(
|
|
14523
|
+
})(), Ke = Ge.length === 0 || Ge.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ue.startsWith(e.slice(0, -1)) : Ue.replace(/\/$/, "") === e.replace(/\/$/, "")), qe = xe.greetings?.[k] || Se.greetings?.[k] || F.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Je = {
|
|
14524
|
+
entryPrompt: F.entryPrompt || "Do you want to explore in a new way?",
|
|
14525
|
+
yesLabel: F.yesLabel || "Yes",
|
|
14526
|
+
laterLabel: F.laterLabel || "Later",
|
|
14527
|
+
connectionTitle: F.connectionTitle || "How would you like to connect?",
|
|
14528
|
+
connectionSubtitle: F.connectionSubtitle || "",
|
|
14529
|
+
voiceLabel: F.voiceLabel || "Voice",
|
|
14530
|
+
textLabel: F.textLabel || "Text",
|
|
14531
|
+
chatTitle: F.headerName || "Chat with FlowEngage",
|
|
14532
|
+
hasCustomTitle: !!(F.headerName && String(F.headerName).trim()),
|
|
14536
14533
|
introGreeting: qe,
|
|
14537
|
-
inputPlaceholder:
|
|
14538
|
-
analysingLabel:
|
|
14539
|
-
}, Ye =
|
|
14534
|
+
inputPlaceholder: F.inputPlaceholder || "Type your message",
|
|
14535
|
+
analysingLabel: F.analysingLabel || "analysing..."
|
|
14536
|
+
}, Ye = Se.elevenLabsAgentId || t?.elevenLabsAgentId || null, B = t?.siteId || n?.siteId || null, V = t?.apiBaseUrl || "";
|
|
14540
14537
|
c(() => {
|
|
14541
14538
|
Kn(t?.siteType || null);
|
|
14542
14539
|
}, [t?.siteType]);
|
|
@@ -14547,10 +14544,10 @@ function zg() {
|
|
|
14547
14544
|
]), Ze = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, Qe = r.some((e) => e.sender === "user"), $e = f(() => {
|
|
14548
14545
|
let e = r.findIndex((e) => e.sender === "user");
|
|
14549
14546
|
return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
14550
|
-
}, [r]), et = !!(
|
|
14547
|
+
}, [r]), et = !!(Se._dashboardLivePreview || xe._dashboardLivePreview), [H, U] = m(() => et ? "text_chat" : "entry_prompt"), [tt, nt] = m(""), [rt, W] = m(null), [it, at] = m(h || ""), [G, 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 && Qe && $e && H !== "voice_mode";
|
|
14551
14548
|
d(() => {
|
|
14552
14549
|
if (e !== "ready" || wt.current) return;
|
|
14553
|
-
if (wt.current = !0, !
|
|
14550
|
+
if (wt.current = !0, !De) {
|
|
14554
14551
|
U("minimized_orb");
|
|
14555
14552
|
return;
|
|
14556
14553
|
}
|
|
@@ -14558,12 +14555,12 @@ function zg() {
|
|
|
14558
14555
|
try {
|
|
14559
14556
|
t = vr().shouldResumeVoice;
|
|
14560
14557
|
} catch {}
|
|
14561
|
-
let n =
|
|
14558
|
+
let n = Ee(), r = B ? Ce(B) : null, i = n || !!r?.transcript;
|
|
14562
14559
|
if (t) {
|
|
14563
|
-
ae?.({ notifyChatInitiated: !0 }),
|
|
14560
|
+
ae?.({ notifyChatInitiated: !0 }), j?.(!0), U("voice_mode");
|
|
14564
14561
|
return;
|
|
14565
14562
|
}
|
|
14566
|
-
if (
|
|
14563
|
+
if (Oe()) {
|
|
14567
14564
|
ae?.({ notifyChatInitiated: !1 }), U("text_chat");
|
|
14568
14565
|
return;
|
|
14569
14566
|
}
|
|
@@ -14572,13 +14569,13 @@ function zg() {
|
|
|
14572
14569
|
U("minimized_orb");
|
|
14573
14570
|
return;
|
|
14574
14571
|
}
|
|
14575
|
-
ae?.({ notifyChatInitiated: !0 }),
|
|
14572
|
+
ae?.({ notifyChatInitiated: !0 }), j?.(!0), U("voice_mode");
|
|
14576
14573
|
return;
|
|
14577
14574
|
}
|
|
14578
14575
|
if (B) try {
|
|
14579
|
-
|
|
14576
|
+
we(B);
|
|
14580
14577
|
} catch {}
|
|
14581
|
-
if (
|
|
14578
|
+
if (se(B)) {
|
|
14582
14579
|
U("minimized_orb");
|
|
14583
14580
|
return;
|
|
14584
14581
|
}
|
|
@@ -14636,7 +14633,7 @@ function zg() {
|
|
|
14636
14633
|
hasIncomingCall: !!w?.callId,
|
|
14637
14634
|
activeCallId: T,
|
|
14638
14635
|
callConnectionState: E
|
|
14639
|
-
}), Ct.current = e, H === "voice_mode" &&
|
|
14636
|
+
}), Ct.current = e, H === "voice_mode" && j?.(!1), ae?.(), At());
|
|
14640
14637
|
}
|
|
14641
14638
|
}, [
|
|
14642
14639
|
T,
|
|
@@ -14645,7 +14642,7 @@ function zg() {
|
|
|
14645
14642
|
w?.callId,
|
|
14646
14643
|
i,
|
|
14647
14644
|
ae,
|
|
14648
|
-
|
|
14645
|
+
j,
|
|
14649
14646
|
H
|
|
14650
14647
|
]), c(() => {
|
|
14651
14648
|
!w && !T && H === "call_screen" && U("text_chat");
|
|
@@ -14657,16 +14654,16 @@ function zg() {
|
|
|
14657
14654
|
!T && yt && bt(!1);
|
|
14658
14655
|
}, [T, yt]), c(() => {
|
|
14659
14656
|
if (!s || C) {
|
|
14660
|
-
|
|
14657
|
+
ge?.(""), he?.();
|
|
14661
14658
|
return;
|
|
14662
14659
|
}
|
|
14663
14660
|
if (!tt.trim() || pt) {
|
|
14664
|
-
|
|
14665
|
-
let e = window.setTimeout(() =>
|
|
14661
|
+
ge?.("");
|
|
14662
|
+
let e = window.setTimeout(() => he?.(), 100);
|
|
14666
14663
|
return () => window.clearTimeout(e);
|
|
14667
14664
|
}
|
|
14668
|
-
|
|
14669
|
-
let e = window.setTimeout(() =>
|
|
14665
|
+
me?.();
|
|
14666
|
+
let e = window.setTimeout(() => ge?.(tt), 120), t = window.setTimeout(() => he?.(), 1200);
|
|
14670
14667
|
return () => {
|
|
14671
14668
|
window.clearTimeout(e), window.clearTimeout(t);
|
|
14672
14669
|
};
|
|
@@ -14675,9 +14672,9 @@ function zg() {
|
|
|
14675
14672
|
pt,
|
|
14676
14673
|
s,
|
|
14677
14674
|
C,
|
|
14675
|
+
me,
|
|
14678
14676
|
he,
|
|
14679
|
-
ge
|
|
14680
|
-
_e
|
|
14677
|
+
ge
|
|
14681
14678
|
]);
|
|
14682
14679
|
let Mt = (e) => e ? {
|
|
14683
14680
|
replyTo: e.messageId || e.id || null,
|
|
@@ -14719,8 +14716,8 @@ function zg() {
|
|
|
14719
14716
|
let n = tt.trim();
|
|
14720
14717
|
nt(""), W(null), await A(n, "", t);
|
|
14721
14718
|
}, Pt = o(() => {
|
|
14722
|
-
r.length !== 0 &&
|
|
14723
|
-
}, [r.length,
|
|
14719
|
+
r.length !== 0 && N?.();
|
|
14720
|
+
}, [r.length, N]), Ft = (e) => {
|
|
14724
14721
|
let t = Math.floor(e / 60);
|
|
14725
14722
|
return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
|
|
14726
14723
|
}, It = o(async (e) => {
|
|
@@ -14776,13 +14773,13 @@ function zg() {
|
|
|
14776
14773
|
t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
|
|
14777
14774
|
}
|
|
14778
14775
|
} catch {}
|
|
14779
|
-
ae({ notifyChatInitiated: !0 }),
|
|
14776
|
+
ae({ notifyChatInitiated: !0 }), j?.(!0), U("voice_mode");
|
|
14780
14777
|
}, Vt = () => {
|
|
14781
|
-
ae({ notifyChatInitiated: !0 }),
|
|
14778
|
+
ae({ notifyChatInitiated: !0 }), j?.(!1), U("text_chat");
|
|
14782
14779
|
}, Ht = () => {
|
|
14783
|
-
|
|
14780
|
+
j?.(!1), Rt();
|
|
14784
14781
|
};
|
|
14785
|
-
return e !== "ready" || !He ||
|
|
14782
|
+
return e !== "ready" || !He || Te.chat === !1 || !Ke ? null : /* @__PURE__ */ _("div", {
|
|
14786
14783
|
className: "flowengage-widget-root",
|
|
14787
14784
|
style: {
|
|
14788
14785
|
position: "fixed",
|
|
@@ -14794,13 +14791,13 @@ function zg() {
|
|
|
14794
14791
|
children: [
|
|
14795
14792
|
H === "entry_prompt" && /* @__PURE__ */ g(Ng, {
|
|
14796
14793
|
copy: Je,
|
|
14797
|
-
orbColors:
|
|
14798
|
-
primaryColor:
|
|
14794
|
+
orbColors: L,
|
|
14795
|
+
primaryColor: ke,
|
|
14799
14796
|
onYes: () => {
|
|
14800
|
-
|
|
14797
|
+
ce(B), Bt();
|
|
14801
14798
|
},
|
|
14802
14799
|
onLater: () => {
|
|
14803
|
-
|
|
14800
|
+
ce(B), Rt();
|
|
14804
14801
|
},
|
|
14805
14802
|
isMobile: Et,
|
|
14806
14803
|
isClosing: xt
|
|
@@ -14876,15 +14873,15 @@ function zg() {
|
|
|
14876
14873
|
})]
|
|
14877
14874
|
})]
|
|
14878
14875
|
}), /* @__PURE__ */ g(Mg, {
|
|
14879
|
-
size:
|
|
14880
|
-
orbColors:
|
|
14881
|
-
onClick: T ? At :
|
|
14876
|
+
size: je,
|
|
14877
|
+
orbColors: L,
|
|
14878
|
+
onClick: T ? At : De ? zt : Vt
|
|
14882
14879
|
})]
|
|
14883
14880
|
}),
|
|
14884
14881
|
H === "connection_modal" && /* @__PURE__ */ g(Pg, {
|
|
14885
14882
|
copy: Je,
|
|
14886
|
-
orbColors:
|
|
14887
|
-
primaryColor:
|
|
14883
|
+
orbColors: L,
|
|
14884
|
+
primaryColor: ke,
|
|
14888
14885
|
onVoice: Bt,
|
|
14889
14886
|
onText: Vt,
|
|
14890
14887
|
onClose: Rt,
|
|
@@ -14892,7 +14889,7 @@ function zg() {
|
|
|
14892
14889
|
isClosing: xt
|
|
14893
14890
|
}),
|
|
14894
14891
|
H === "voice_mode" && /* @__PURE__ */ g(Fg, {
|
|
14895
|
-
orbColors:
|
|
14892
|
+
orbColors: L,
|
|
14896
14893
|
onEnterChat: Vt,
|
|
14897
14894
|
onEndChat: Ht,
|
|
14898
14895
|
agentId: Ye,
|
|
@@ -14901,16 +14898,16 @@ function zg() {
|
|
|
14901
14898
|
chatId: te,
|
|
14902
14899
|
historyRef: ne,
|
|
14903
14900
|
onMessageSync: re,
|
|
14904
|
-
voiceEndCounter:
|
|
14901
|
+
voiceEndCounter: be,
|
|
14905
14902
|
websiteName: t?.websiteName,
|
|
14906
|
-
voiceFirstMessage:
|
|
14903
|
+
voiceFirstMessage: xe.voiceFirstMessage || null,
|
|
14907
14904
|
captureVisitorEmail: oe,
|
|
14908
14905
|
emailRequired: !h,
|
|
14909
|
-
emailCaptureEnabled:
|
|
14910
|
-
listeningLabel:
|
|
14911
|
-
thinkingLabel:
|
|
14912
|
-
enterChatModeLabel:
|
|
14913
|
-
endConversationLabel:
|
|
14906
|
+
emailCaptureEnabled: F.disableEmailCapture !== !0,
|
|
14907
|
+
listeningLabel: F.voiceListeningLabel || "Listening...",
|
|
14908
|
+
thinkingLabel: F.voiceThinkingLabel || "Thinking...",
|
|
14909
|
+
enterChatModeLabel: F.voiceEnterChatLabel || "Enter Chat Mode",
|
|
14910
|
+
endConversationLabel: F.voiceEndConversationLabel || "End Conversation"
|
|
14914
14911
|
}, "voice"),
|
|
14915
14912
|
H === "call_screen" && /* @__PURE__ */ g(Nh, {
|
|
14916
14913
|
incomingCall: w,
|
|
@@ -14921,21 +14918,21 @@ function zg() {
|
|
|
14921
14918
|
agentName: Xe,
|
|
14922
14919
|
agentHeadshot: Ze,
|
|
14923
14920
|
fallbackAgentName: R,
|
|
14924
|
-
acceptCall:
|
|
14925
|
-
rejectCall:
|
|
14926
|
-
endWebRTCCall:
|
|
14927
|
-
toggleCallMute:
|
|
14921
|
+
acceptCall: le,
|
|
14922
|
+
rejectCall: ue,
|
|
14923
|
+
endWebRTCCall: de,
|
|
14924
|
+
toggleCallMute: fe,
|
|
14928
14925
|
formatCallDuration: Ft,
|
|
14929
14926
|
onMinimize: jt,
|
|
14930
|
-
primaryColor:
|
|
14931
|
-
orbColors:
|
|
14927
|
+
primaryColor: ke,
|
|
14928
|
+
orbColors: L,
|
|
14932
14929
|
chatHistory: r
|
|
14933
14930
|
}),
|
|
14934
14931
|
H === "text_chat" && /* @__PURE__ */ g(Rg, {
|
|
14935
14932
|
isClosing: xt,
|
|
14936
14933
|
copy: Je,
|
|
14937
|
-
orbColors:
|
|
14938
|
-
primaryColor:
|
|
14934
|
+
orbColors: L,
|
|
14935
|
+
primaryColor: ke,
|
|
14939
14936
|
chatBgGradient: Ne,
|
|
14940
14937
|
logo: Pe,
|
|
14941
14938
|
quickChatOptions: Le,
|
|
@@ -14970,16 +14967,16 @@ function zg() {
|
|
|
14970
14967
|
webRTCError: O,
|
|
14971
14968
|
micError: dt,
|
|
14972
14969
|
setMicError: ft,
|
|
14973
|
-
dismissCallError:
|
|
14970
|
+
dismissCallError: pe,
|
|
14974
14971
|
activeCallId: T,
|
|
14975
14972
|
isCallMuted: ee,
|
|
14976
|
-
toggleCallMute:
|
|
14977
|
-
endWebRTCCall:
|
|
14973
|
+
toggleCallMute: fe,
|
|
14974
|
+
endWebRTCCall: de,
|
|
14978
14975
|
formatCallDuration: Ft,
|
|
14979
14976
|
callDurationSeconds: lt,
|
|
14980
14977
|
onCollapse: Rt,
|
|
14981
14978
|
onStartVoice: Bt,
|
|
14982
|
-
voiceEnabled:
|
|
14979
|
+
voiceEnabled: De,
|
|
14983
14980
|
onNewChat: Pt,
|
|
14984
14981
|
onMinimize: jt,
|
|
14985
14982
|
onExpand: At,
|
|
@@ -14987,9 +14984,9 @@ function zg() {
|
|
|
14987
14984
|
showPoweredBy: Re,
|
|
14988
14985
|
privacyPolicyUrl: Ve,
|
|
14989
14986
|
headerBgColor: ze,
|
|
14990
|
-
getVisitorChatHistory:
|
|
14991
|
-
resumeChat:
|
|
14992
|
-
isSessionRestoring:
|
|
14987
|
+
getVisitorChatHistory: P,
|
|
14988
|
+
resumeChat: _e,
|
|
14989
|
+
isSessionRestoring: ve
|
|
14993
14990
|
}),
|
|
14994
14991
|
/* @__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 " })
|
|
14995
14992
|
]
|