@flowengage/react-chatbot 8.0.131 → 8.0.132
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.
|
@@ -34,72 +34,72 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
34
34
|
agentName: "flowengage.agentName",
|
|
35
35
|
agentHeadshot: "flowengage.agentHeadshot",
|
|
36
36
|
visitorEmail: "flowengage.visitorEmail"
|
|
37
|
-
}, ee = 6e4, te = 480 * 60, ne = 3e4, j = typeof window < "u",
|
|
37
|
+
}, ee = 6e4, te = 480 * 60, ne = 3e4, j = typeof window < "u", M = (e) => e ? `flowengage.visitorEmail.${e}` : null, re = () => {
|
|
38
38
|
if (!j) return null;
|
|
39
39
|
let e = window.localStorage.getItem(A.chatId);
|
|
40
40
|
return e && String(e).trim() ? String(e).trim() : null;
|
|
41
|
-
},
|
|
41
|
+
}, ie = () => {
|
|
42
42
|
if (j) try {
|
|
43
43
|
window.localStorage.removeItem(A.chatId);
|
|
44
44
|
} catch {}
|
|
45
|
-
},
|
|
45
|
+
}, ae = () => j ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", N = (e) => e ? `flowengage.entrySeen.${e}` : null, oe = (e) => {
|
|
46
46
|
if (!j || !e) return !1;
|
|
47
47
|
try {
|
|
48
|
-
let t =
|
|
48
|
+
let t = N(e);
|
|
49
49
|
return t ? window.localStorage.getItem(t) === "1" : !1;
|
|
50
50
|
} catch {
|
|
51
51
|
return !1;
|
|
52
52
|
}
|
|
53
|
-
},
|
|
53
|
+
}, se = (e) => {
|
|
54
54
|
if (!(!j || !e)) try {
|
|
55
|
-
let t =
|
|
55
|
+
let t = N(e);
|
|
56
56
|
t && window.localStorage.setItem(t, "1");
|
|
57
57
|
} catch {}
|
|
58
|
-
},
|
|
58
|
+
}, P = (e) => e ? `flowengage.navPreference.${e}` : null, F = (e) => e ? `flowengage.navPreferencePromptShown.${e}` : null, ce = (e) => {
|
|
59
59
|
if (!j || !e) return null;
|
|
60
60
|
try {
|
|
61
|
-
let t =
|
|
61
|
+
let t = P(e), n = t ? window.localStorage.getItem(t) : null;
|
|
62
62
|
return n === "auto" || n === "ask" ? n : null;
|
|
63
63
|
} catch {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, le = (e, t) => {
|
|
67
67
|
if (!(!j || !e || t !== "auto" && t !== "ask")) try {
|
|
68
|
-
let n =
|
|
69
|
-
n && window.localStorage.setItem(n, t),
|
|
68
|
+
let n = P(e);
|
|
69
|
+
n && window.localStorage.setItem(n, t), de(e);
|
|
70
70
|
} catch {}
|
|
71
|
-
},
|
|
71
|
+
}, ue = (e) => {
|
|
72
72
|
if (!j || !e) return !1;
|
|
73
73
|
try {
|
|
74
|
-
let t =
|
|
74
|
+
let t = F(e);
|
|
75
75
|
return t ? window.localStorage.getItem(t) === "1" : !1;
|
|
76
76
|
} catch {
|
|
77
77
|
return !1;
|
|
78
78
|
}
|
|
79
|
-
},
|
|
79
|
+
}, de = (e) => {
|
|
80
80
|
if (!(!j || !e)) try {
|
|
81
|
-
let t =
|
|
81
|
+
let t = F(e);
|
|
82
82
|
t && window.localStorage.setItem(t, "1");
|
|
83
83
|
} catch {}
|
|
84
|
-
},
|
|
84
|
+
}, fe = (e) => e ? `flowengage.persistedChatId.${e}` : null, pe = (e) => {
|
|
85
85
|
if (!j || !e) return null;
|
|
86
86
|
try {
|
|
87
|
-
let t =
|
|
87
|
+
let t = fe(e), n = t ? window.localStorage.getItem(t) : null;
|
|
88
88
|
return n && String(n).trim() ? String(n).trim() : null;
|
|
89
89
|
} catch {
|
|
90
90
|
return null;
|
|
91
91
|
}
|
|
92
|
-
},
|
|
92
|
+
}, me = (e) => {
|
|
93
93
|
if (!(!j || !e)) try {
|
|
94
|
-
let t =
|
|
94
|
+
let t = fe(e);
|
|
95
95
|
t && window.localStorage.removeItem(t);
|
|
96
96
|
} catch {}
|
|
97
|
-
},
|
|
97
|
+
}, he = (e, t) => {
|
|
98
98
|
if (!(!j || !e || !t)) try {
|
|
99
|
-
let n =
|
|
99
|
+
let n = fe(e);
|
|
100
100
|
n && window.localStorage.setItem(n, String(t).trim());
|
|
101
101
|
} catch {}
|
|
102
|
-
},
|
|
102
|
+
}, ge = () => j ? {
|
|
103
103
|
isOpen: !1,
|
|
104
104
|
activeScreen: window.sessionStorage.getItem(A.activeScreen) || "ai",
|
|
105
105
|
isHumanHandled: window.sessionStorage.getItem(A.isHumanHandled) === "true",
|
|
@@ -113,7 +113,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
113
113
|
agentName: null,
|
|
114
114
|
agentHeadshot: null,
|
|
115
115
|
visitorEmail: ""
|
|
116
|
-
},
|
|
116
|
+
}, _e = (e) => {
|
|
117
117
|
j && Object.entries(e).forEach(([e, t]) => {
|
|
118
118
|
let n = A[e];
|
|
119
119
|
if (n) {
|
|
@@ -124,17 +124,17 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
124
124
|
window.sessionStorage.setItem(n, String(t));
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
},
|
|
127
|
+
}, ve = (e) => {
|
|
128
128
|
if (!j || !e) return "";
|
|
129
|
-
let t =
|
|
129
|
+
let t = M(e), n = window.localStorage.getItem(t);
|
|
130
130
|
if (!n) {
|
|
131
131
|
let e = window.sessionStorage.getItem(A.visitorEmail);
|
|
132
132
|
e && (window.localStorage.setItem(t, e), window.sessionStorage.removeItem(A.visitorEmail), n = e);
|
|
133
133
|
}
|
|
134
134
|
return n || "";
|
|
135
|
-
},
|
|
135
|
+
}, ye = (e, t) => {
|
|
136
136
|
if (!j) return;
|
|
137
|
-
let n =
|
|
137
|
+
let n = M(t);
|
|
138
138
|
if (!n) return;
|
|
139
139
|
let r = typeof e == "string" ? e.trim() : "";
|
|
140
140
|
if (!r) {
|
|
@@ -142,91 +142,91 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
window.localStorage.setItem(n, r), window.sessionStorage.removeItem(A.visitorEmail);
|
|
145
|
-
},
|
|
145
|
+
}, be = (e) => e ? `flowengage.visitorId.${e}` : null, xe = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, I = (e) => {
|
|
146
146
|
if (!j || !e) return null;
|
|
147
147
|
try {
|
|
148
|
-
let t =
|
|
148
|
+
let t = be(e), n = t ? window.localStorage.getItem(t) : null;
|
|
149
149
|
return n && String(n).trim() ? String(n).trim() : null;
|
|
150
150
|
} catch {
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
},
|
|
153
|
+
}, L = (e) => {
|
|
154
154
|
if (!j || !e) return null;
|
|
155
155
|
try {
|
|
156
|
-
let t =
|
|
156
|
+
let t = I(e);
|
|
157
157
|
if (t) return t;
|
|
158
|
-
let n =
|
|
158
|
+
let n = xe(), r = be(e);
|
|
159
159
|
return r && window.localStorage.setItem(r, n), n;
|
|
160
160
|
} catch {
|
|
161
|
-
return
|
|
161
|
+
return xe();
|
|
162
162
|
}
|
|
163
|
-
},
|
|
163
|
+
}, R = "flowengage.tabId", Se = () => {
|
|
164
164
|
if (!j) return "default";
|
|
165
165
|
try {
|
|
166
|
-
let e = window.sessionStorage.getItem(
|
|
167
|
-
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(
|
|
166
|
+
let e = window.sessionStorage.getItem(R);
|
|
167
|
+
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(R, e)), e;
|
|
168
168
|
} catch {
|
|
169
169
|
return "default";
|
|
170
170
|
}
|
|
171
|
-
},
|
|
171
|
+
}, Ce = (e) => e ? `flowengage.voice.transcript.${e}.${Se()}` : null, we = 600 * 1e3, Te = (e, t, n = {}) => {
|
|
172
172
|
if (!j || !e) return;
|
|
173
173
|
let r = typeof t == "string" ? t.trim() : "";
|
|
174
174
|
if (!r) return;
|
|
175
|
-
let i = Number.isFinite(n.ttlMs) ? n.ttlMs :
|
|
175
|
+
let i = Number.isFinite(n.ttlMs) ? n.ttlMs : we, a = {
|
|
176
176
|
transcript: r,
|
|
177
177
|
expiresAt: Date.now() + i
|
|
178
178
|
};
|
|
179
179
|
try {
|
|
180
|
-
let t =
|
|
180
|
+
let t = Ce(e);
|
|
181
181
|
t && window.localStorage.setItem(t, JSON.stringify(a));
|
|
182
182
|
} catch {}
|
|
183
|
-
},
|
|
183
|
+
}, Ee = (e) => {
|
|
184
184
|
if (!j || !e) return null;
|
|
185
185
|
try {
|
|
186
|
-
let t =
|
|
186
|
+
let t = Ce(e), n = t ? window.localStorage.getItem(t) : null;
|
|
187
187
|
if (!n) return null;
|
|
188
188
|
let r = JSON.parse(n);
|
|
189
189
|
return !r || typeof r.transcript != "string" ? null : Number.isFinite(r.expiresAt) && Date.now() > r.expiresAt ? (window.localStorage.removeItem(t), null) : r;
|
|
190
190
|
} catch {
|
|
191
191
|
return null;
|
|
192
192
|
}
|
|
193
|
-
},
|
|
193
|
+
}, De = (e) => {
|
|
194
194
|
if (!(!j || !e)) try {
|
|
195
|
-
let t =
|
|
195
|
+
let t = Ce(e);
|
|
196
196
|
t && window.localStorage.removeItem(t);
|
|
197
197
|
} catch {}
|
|
198
|
-
},
|
|
198
|
+
}, Oe = "flowengage.voice.pendingResume", ke = () => {
|
|
199
199
|
if (j) try {
|
|
200
|
-
window.sessionStorage.setItem(
|
|
200
|
+
window.sessionStorage.setItem(Oe, "1");
|
|
201
201
|
} catch {}
|
|
202
|
-
},
|
|
202
|
+
}, Ae = () => {
|
|
203
203
|
if (!j) return !1;
|
|
204
204
|
try {
|
|
205
|
-
return window.sessionStorage.getItem(
|
|
205
|
+
return window.sessionStorage.getItem(Oe) === "1" ? (window.sessionStorage.removeItem(Oe), !0) : !1;
|
|
206
206
|
} catch {
|
|
207
207
|
return !1;
|
|
208
208
|
}
|
|
209
|
-
},
|
|
209
|
+
}, je = "flowengage.chat.pendingReopen", Me = () => {
|
|
210
210
|
if (j) try {
|
|
211
|
-
window.sessionStorage.setItem(
|
|
211
|
+
window.sessionStorage.setItem(je, "1");
|
|
212
212
|
} catch {}
|
|
213
|
-
},
|
|
213
|
+
}, Ne = () => {
|
|
214
214
|
if (!j) return !1;
|
|
215
215
|
try {
|
|
216
|
-
return window.sessionStorage.getItem(
|
|
216
|
+
return window.sessionStorage.getItem(je) === "1" ? (window.sessionStorage.removeItem(je), !0) : !1;
|
|
217
217
|
} catch {
|
|
218
218
|
return !1;
|
|
219
219
|
}
|
|
220
|
-
},
|
|
220
|
+
}, Pe = () => {
|
|
221
221
|
if (!j) return !1;
|
|
222
222
|
try {
|
|
223
|
-
return window.sessionStorage.getItem(
|
|
223
|
+
return window.sessionStorage.getItem(Oe) === "1";
|
|
224
224
|
} catch {
|
|
225
225
|
return !1;
|
|
226
226
|
}
|
|
227
|
-
},
|
|
227
|
+
}, Fe = (e) => e ? `flowengage.voice.navState.${e}.${Se()}` : null, Ie = (e, t, n, r) => {
|
|
228
228
|
if (!(!j || !e || !t)) try {
|
|
229
|
-
let i =
|
|
229
|
+
let i = Fe(e);
|
|
230
230
|
i && window.sessionStorage.setItem(i, JSON.stringify({
|
|
231
231
|
previousPage: String(t),
|
|
232
232
|
targetPath: n ? new URL(String(n), window.location.href).pathname : null,
|
|
@@ -234,10 +234,10 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
234
234
|
ts: Date.now()
|
|
235
235
|
}));
|
|
236
236
|
} catch {}
|
|
237
|
-
},
|
|
237
|
+
}, Le = (e) => {
|
|
238
238
|
if (!j || !e) return null;
|
|
239
239
|
try {
|
|
240
|
-
let t =
|
|
240
|
+
let t = Fe(e);
|
|
241
241
|
if (!t) return null;
|
|
242
242
|
let n = window.sessionStorage.getItem(t);
|
|
243
243
|
if (!n) return null;
|
|
@@ -250,14 +250,14 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
250
250
|
} catch {
|
|
251
251
|
return null;
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, z = async (e) => {
|
|
254
254
|
let t = await e.json().catch(() => ({}));
|
|
255
255
|
if (!e.ok) {
|
|
256
256
|
let n = Error(t.message || t.error || `Request failed with status ${e.status}`);
|
|
257
257
|
throw n.status = e.status, n;
|
|
258
258
|
}
|
|
259
259
|
return t;
|
|
260
|
-
},
|
|
260
|
+
}, Re = async (e, t = {}) => {
|
|
261
261
|
try {
|
|
262
262
|
return await fetch(e, {
|
|
263
263
|
mode: "cors",
|
|
@@ -267,9 +267,9 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
267
267
|
let n = /* @__PURE__ */ Error(`Network error reaching ${e}. Check: (1) backend is running, (2) CORS allows this origin, (3) siteId is correct. Original: ${t.message}`);
|
|
268
268
|
throw n.status = 0, n.cause = t, n;
|
|
269
269
|
}
|
|
270
|
-
},
|
|
270
|
+
}, ze = async ({ apiBaseUrl: e, userId: t, siteId: n, priorChatId: r = null, forceNew: i = !1, resumeChatId: a = null, visitorId: o = null }) => {
|
|
271
271
|
let s = `${e}/api/visitors/resolve-session`, c = { siteId: n };
|
|
272
|
-
return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o),
|
|
272
|
+
return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), z(await Re(s, {
|
|
273
273
|
method: "POST",
|
|
274
274
|
mode: "cors",
|
|
275
275
|
headers: {
|
|
@@ -280,13 +280,13 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
280
280
|
},
|
|
281
281
|
body: JSON.stringify(c)
|
|
282
282
|
}));
|
|
283
|
-
},
|
|
283
|
+
}, Be = async ({ apiBaseUrl: e, siteId: t }) => {
|
|
284
284
|
let n = typeof window < "u" ? window.location.origin : "http://localhost";
|
|
285
|
-
return (await
|
|
285
|
+
return (await z(await Re(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
|
|
286
286
|
siteId: t,
|
|
287
287
|
origin: n
|
|
288
288
|
}).toString()}`, { method: "GET" }))).data;
|
|
289
|
-
},
|
|
289
|
+
}, Ve = ({ apiBaseUrl: e, userId: t, siteId: n, visitorId: r = null }) => {
|
|
290
290
|
let i = (t, n) => {
|
|
291
291
|
let r = `${e}${t}`, i = JSON.stringify(n);
|
|
292
292
|
if (typeof navigator < "u" && navigator.sendBeacon) try {
|
|
@@ -300,7 +300,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
300
300
|
headers: { "Content-Type": "application/json" },
|
|
301
301
|
body: i
|
|
302
302
|
}).catch(() => {}), !0) : !1;
|
|
303
|
-
}, a = async (i, a = {}) =>
|
|
303
|
+
}, a = async (i, a = {}) => z(await Re(`${e}${i}`, {
|
|
304
304
|
...a,
|
|
305
305
|
headers: {
|
|
306
306
|
"Content-Type": "application/json",
|
|
@@ -315,7 +315,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
315
315
|
...n ? { "x-site-id": n } : {},
|
|
316
316
|
...a.headers || {}
|
|
317
317
|
};
|
|
318
|
-
return
|
|
318
|
+
return z(await Re(`${e}${r}`, {
|
|
319
319
|
...a,
|
|
320
320
|
body: i,
|
|
321
321
|
headers: o
|
|
@@ -346,7 +346,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
346
346
|
method: "POST",
|
|
347
347
|
body: JSON.stringify(f)
|
|
348
348
|
});
|
|
349
|
-
let p = await
|
|
349
|
+
let p = await Re(`${e}/api/ai/chat`, {
|
|
350
350
|
method: "POST",
|
|
351
351
|
headers: {
|
|
352
352
|
"Content-Type": "application/json",
|
|
@@ -359,7 +359,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
359
359
|
stream: !0
|
|
360
360
|
})
|
|
361
361
|
});
|
|
362
|
-
if (!(p.headers.get("content-type") || "").includes("text/event-stream")) return
|
|
362
|
+
if (!(p.headers.get("content-type") || "").includes("text/event-stream")) return z(p);
|
|
363
363
|
let m = p.body.getReader(), h = new TextDecoder(), g = "", _ = null, v = (e) => {
|
|
364
364
|
let t = e.split("\n").find((e) => e.startsWith("data: "));
|
|
365
365
|
if (t) try {
|
|
@@ -475,7 +475,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
|
|
|
475
475
|
});
|
|
476
476
|
},
|
|
477
477
|
async getIceServersConfig() {
|
|
478
|
-
return
|
|
478
|
+
return z(await Re(`${e}/api/calls/ice-config`, {
|
|
479
479
|
method: "GET",
|
|
480
480
|
headers: {
|
|
481
481
|
"x-user-id": t,
|
|
@@ -2881,7 +2881,7 @@ async function Ar(e, t = {}) {
|
|
|
2881
2881
|
reason: "already-on-page"
|
|
2882
2882
|
};
|
|
2883
2883
|
let a = i.pathname + i.search + i.hash;
|
|
2884
|
-
if (window.Shopify) return n && br(n), r ||
|
|
2884
|
+
if (window.Shopify) return n && br(n), r || Me(), r ? kr().then(() => window.location.assign(i.href)) : window.location.assign(i.href), { navigated: !0 };
|
|
2885
2885
|
let o = window.next?.router;
|
|
2886
2886
|
if (o?.push) return new Promise((e) => {
|
|
2887
2887
|
let t = () => {
|
|
@@ -2900,11 +2900,11 @@ async function Ar(e, t = {}) {
|
|
|
2900
2900
|
try {
|
|
2901
2901
|
window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate", { state: {} }));
|
|
2902
2902
|
} catch {}
|
|
2903
|
-
return n && br(n), r ||
|
|
2903
|
+
return n && br(n), r || Me(), window.location.assign(i.href), { navigated: !0 };
|
|
2904
2904
|
}
|
|
2905
2905
|
return { navigated: !0 };
|
|
2906
2906
|
}
|
|
2907
|
-
return n && br(n), r ||
|
|
2907
|
+
return n && br(n), r || Me(), window.location.assign(i.href), { navigated: !0 };
|
|
2908
2908
|
} catch (t) {
|
|
2909
2909
|
console.warn("[FlowEngage] shadowNavigate error:", t), n && br(n);
|
|
2910
2910
|
try {
|
|
@@ -3325,7 +3325,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3325
3325
|
message: "Looks like you're already on this page!",
|
|
3326
3326
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3327
3327
|
}]);
|
|
3328
|
-
}, []), [D, O] = m(
|
|
3328
|
+
}, []), [D, O] = m(ge().isOpen), [k, A] = m(ge().activeScreen), [j, M] = m(ge().isHumanHandled), [N, oe] = m(ge().agentName), [se, P] = m(ge().agentHeadshot), [F, le] = m(() => ve(i?.siteId)), [fe, be] = m(!1), [xe, I] = m(!1), [R, Se] = m("idle"), [Ce, we] = m(!1), [Te, Ee] = m(!1), [De, Oe] = m(""), [Ae, je] = m(!1), [Me, Ne] = m(0), [Pe, Fe] = m(0), [Ie, Le] = m(!1), [z, Re] = m(null), [B, He] = m(null), [Ue, V] = m("idle"), [We, Ge] = m(null), [Ke, qe] = m(!1), [Je, Ye] = m(""), [Xe, Ze] = m(!1), H = p(null), U = p(null), Qe = p(""), $e = p(!1), W = p(null), et = p(null), tt = p(null), nt = p(null), rt = p(null), it = p(null), at = p(null), ot = p(!1), st = p({
|
|
3329
3329
|
url: null,
|
|
3330
3330
|
at: 0
|
|
3331
3331
|
}), ct = o((e, t) => {
|
|
@@ -3342,23 +3342,23 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3342
3342
|
url: n,
|
|
3343
3343
|
at: Date.now()
|
|
3344
3344
|
}, Ar(e, t));
|
|
3345
|
-
}, []), G = p([]), lt = p(null), ut = p(null), dt = p(null), ft = p(!1), pt = p(!1), mt = p(""), ht = p(null), gt = p(null), _t = p([]), vt = p(0), yt = p(
|
|
3345
|
+
}, []), G = p([]), lt = p(null), ut = p(null), dt = p(null), ft = p(!1), pt = p(!1), mt = p(""), ht = p(null), gt = p(null), _t = p([]), vt = p(0), yt = p(N), bt = p([]), xt = p(!1), St = p(!1), Ct = p(i), wt = p({
|
|
3346
3346
|
notifyRouteChange: () => {},
|
|
3347
3347
|
cleanup: () => {}
|
|
3348
3348
|
}), Tt = o((e = {}) => {
|
|
3349
3349
|
let t = !!e.is_human_handled;
|
|
3350
|
-
return
|
|
3350
|
+
return M(t), t ? (A("agent"), e.agent_info?.name && oe(e.agent_info.name), e.agent_info?.headshot && P(e.agent_info.headshot), t) : (A("ai"), t);
|
|
3351
3351
|
}, []), Et = f(() => {
|
|
3352
3352
|
let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
|
|
3353
3353
|
return Number.isFinite(t) && t > 0 ? t : te;
|
|
3354
3354
|
}, [i, _]);
|
|
3355
3355
|
c(() => {
|
|
3356
|
-
et.current =
|
|
3357
|
-
}, [
|
|
3358
|
-
yt.current =
|
|
3359
|
-
}, [
|
|
3360
|
-
St.current =
|
|
3361
|
-
}, [
|
|
3356
|
+
et.current = z;
|
|
3357
|
+
}, [z]), c(() => {
|
|
3358
|
+
yt.current = N;
|
|
3359
|
+
}, [N]), c(() => {
|
|
3360
|
+
St.current = Ae;
|
|
3361
|
+
}, [Ae]), c(() => {
|
|
3362
3362
|
Ct.current = i;
|
|
3363
3363
|
}, [i]);
|
|
3364
3364
|
let Dt = () => {
|
|
@@ -3367,17 +3367,17 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3367
3367
|
dt.current &&= (window.clearTimeout(dt.current), null);
|
|
3368
3368
|
}, []), kt = (e) => {
|
|
3369
3369
|
let t = typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
3370
|
-
return
|
|
3370
|
+
return le(t), ye(t, i?.siteId), t;
|
|
3371
3371
|
};
|
|
3372
3372
|
c(() => {
|
|
3373
3373
|
let e = i?.siteId;
|
|
3374
3374
|
if (!e) return;
|
|
3375
|
-
let t =
|
|
3375
|
+
let t = ve(e);
|
|
3376
3376
|
if (t) {
|
|
3377
|
-
|
|
3377
|
+
le(t);
|
|
3378
3378
|
return;
|
|
3379
3379
|
}
|
|
3380
|
-
|
|
3380
|
+
le((t) => (t && ye(t, e), t));
|
|
3381
3381
|
}, [i?.siteId]);
|
|
3382
3382
|
let At = (e = "unspecified") => {
|
|
3383
3383
|
let t = lt.current || it.current?.callId, n = vt.current, r = ht.current;
|
|
@@ -3407,7 +3407,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3407
3407
|
} catch {}
|
|
3408
3408
|
gt.current = null;
|
|
3409
3409
|
}
|
|
3410
|
-
tt.current &&= (tt.current.close(), null), nt.current &&= (nt.current.getTracks().forEach((e) => e.stop()), null), rt.current &&= (rt.current.srcObject = null, rt.current.remove(), null), Ot(), it.current = null, G.current = [], lt.current = null, ut.current = null, ft.current = !1, qe(!1),
|
|
3410
|
+
tt.current &&= (tt.current.close(), null), nt.current &&= (nt.current.getTracks().forEach((e) => e.stop()), null), rt.current &&= (rt.current.srcObject = null, rt.current.remove(), null), Ot(), it.current = null, G.current = [], lt.current = null, ut.current = null, ft.current = !1, qe(!1), Re(null), He(null), V("idle"), Ge(null);
|
|
3411
3411
|
}, jt = (e = (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
3412
3412
|
let t = H.current, n = lt.current || it.current?.callId;
|
|
3413
3413
|
if (!(!t?.connected || !n || ft.current)) {
|
|
@@ -3459,7 +3459,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3459
3459
|
if (!e.callId) return;
|
|
3460
3460
|
let t = ut.current === e.callId, n = lt.current === e.callId, r = et.current?.callId === e.callId;
|
|
3461
3461
|
if (!(!t && !n && !r)) {
|
|
3462
|
-
if (Ot(),
|
|
3462
|
+
if (Ot(), Re(null), t || n) {
|
|
3463
3463
|
lt.current = e.callId, He(e.callId), V((e) => e === "connected" ? e : "connecting"), O(!0);
|
|
3464
3464
|
return;
|
|
3465
3465
|
}
|
|
@@ -3473,7 +3473,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3473
3473
|
At();
|
|
3474
3474
|
return;
|
|
3475
3475
|
}
|
|
3476
|
-
ut.current = null, it.current = null, G.current = [],
|
|
3476
|
+
ut.current = null, it.current = null, G.current = [], Re(null), V("idle");
|
|
3477
3477
|
}
|
|
3478
3478
|
}, Pt = async (e = {}) => {
|
|
3479
3479
|
let t = tt.current, n = H.current, r = e.sdpOffer || e.offer?.sdp;
|
|
@@ -3507,44 +3507,44 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3507
3507
|
});
|
|
3508
3508
|
};
|
|
3509
3509
|
c(() => {
|
|
3510
|
-
|
|
3510
|
+
_e({
|
|
3511
3511
|
isOpen: D,
|
|
3512
3512
|
activeScreen: k,
|
|
3513
3513
|
isHumanHandled: j,
|
|
3514
|
-
agentName:
|
|
3515
|
-
agentHeadshot:
|
|
3514
|
+
agentName: N,
|
|
3515
|
+
agentHeadshot: se
|
|
3516
3516
|
});
|
|
3517
3517
|
}, [
|
|
3518
3518
|
D,
|
|
3519
3519
|
k,
|
|
3520
3520
|
j,
|
|
3521
|
-
|
|
3522
|
-
|
|
3521
|
+
N,
|
|
3522
|
+
se
|
|
3523
3523
|
]), c(() => {
|
|
3524
3524
|
let e = !0;
|
|
3525
3525
|
return (async () => {
|
|
3526
3526
|
Ze(!0);
|
|
3527
3527
|
try {
|
|
3528
|
-
let t = E(i), n = await
|
|
3528
|
+
let t = E(i), n = await Be(t);
|
|
3529
3529
|
if (!e) return;
|
|
3530
|
-
let a = t.siteId, o =
|
|
3530
|
+
let a = t.siteId, o = pe(a), s = L(a), c = "";
|
|
3531
3531
|
try {
|
|
3532
3532
|
let e = $e.current, r = W.current;
|
|
3533
|
-
if ($e.current = !1, W.current = null, c = (await
|
|
3533
|
+
if ($e.current = !1, W.current = null, c = (await ze({
|
|
3534
3534
|
apiBaseUrl: t.apiBaseUrl,
|
|
3535
3535
|
userId: n.userId,
|
|
3536
3536
|
siteId: a,
|
|
3537
|
-
priorChatId: e || r ? null : o ||
|
|
3537
|
+
priorChatId: e || r ? null : o || re(),
|
|
3538
3538
|
forceNew: e,
|
|
3539
3539
|
resumeChatId: r,
|
|
3540
3540
|
visitorId: s
|
|
3541
3541
|
}))?.data?.chatId, !c) throw Error("resolve-session returned no chatId");
|
|
3542
|
-
|
|
3542
|
+
ie(), he(a, c);
|
|
3543
3543
|
} catch (e) {
|
|
3544
|
-
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o ||
|
|
3544
|
+
console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ae(), he(a, c);
|
|
3545
3545
|
}
|
|
3546
3546
|
Qe.current = c;
|
|
3547
|
-
let l =
|
|
3547
|
+
let l = Ve({
|
|
3548
3548
|
apiBaseUrl: t.apiBaseUrl,
|
|
3549
3549
|
userId: n.userId,
|
|
3550
3550
|
siteId: t.siteId,
|
|
@@ -3561,23 +3561,23 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3561
3561
|
siteId: t.siteId
|
|
3562
3562
|
});
|
|
3563
3563
|
H.current = f, f.on("connect", async () => {
|
|
3564
|
-
|
|
3564
|
+
Se("connected");
|
|
3565
3565
|
let e = Qe.current;
|
|
3566
3566
|
if (e && U.current) try {
|
|
3567
3567
|
Tt(await U.current.checkHumanHandled(e));
|
|
3568
3568
|
} catch {}
|
|
3569
3569
|
}), f.on("disconnect", () => {
|
|
3570
|
-
|
|
3570
|
+
Se("disconnected");
|
|
3571
3571
|
}), f.on("aiTyping", () => {
|
|
3572
|
-
|
|
3572
|
+
I(!0);
|
|
3573
3573
|
}), f.on("ai:typing", () => {
|
|
3574
|
-
|
|
3574
|
+
I(!0);
|
|
3575
3575
|
}), f.on("messageReceived", (e) => {
|
|
3576
3576
|
let t = e.message || e, n = {
|
|
3577
3577
|
...t,
|
|
3578
3578
|
message: fi(t.message)
|
|
3579
3579
|
};
|
|
3580
|
-
|
|
3580
|
+
I(!1), be(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
|
|
3581
3581
|
...n,
|
|
3582
3582
|
isPending: !1,
|
|
3583
3583
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -3595,7 +3595,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3595
3595
|
...t,
|
|
3596
3596
|
message: fi(t.message)
|
|
3597
3597
|
};
|
|
3598
|
-
|
|
3598
|
+
I(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && ((n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && be(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
|
|
3599
3599
|
...n,
|
|
3600
3600
|
isPending: !1,
|
|
3601
3601
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -3607,11 +3607,11 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3607
3607
|
...n,
|
|
3608
3608
|
isPending: !1,
|
|
3609
3609
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
3610
|
-
}]), (n.sender === "agent" || n.agent_name) && (
|
|
3610
|
+
}]), (n.sender === "agent" || n.agent_name) && (M(!0), A("agent"), oe(_i([
|
|
3611
3611
|
n.agent_name,
|
|
3612
3612
|
n.agentName,
|
|
3613
3613
|
n.metadata?.agentName
|
|
3614
|
-
], d)), n.sender_headshot &&
|
|
3614
|
+
], d)), n.sender_headshot && P(n.sender_headshot), O(!0), Ne((e) => e + 1)));
|
|
3615
3615
|
});
|
|
3616
3616
|
let p = (e = {}) => {
|
|
3617
3617
|
let t = _i([
|
|
@@ -3620,7 +3620,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3620
3620
|
e.agent_name,
|
|
3621
3621
|
yt.current
|
|
3622
3622
|
], d);
|
|
3623
|
-
|
|
3623
|
+
M(!0), A("agent"), oe(t), P(e.agent?.headshot || null), O(!0), Ne((e) => e + 1), S((e) => vi(e, {
|
|
3624
3624
|
id: `agent-joined-${Date.now()}`,
|
|
3625
3625
|
sender: "system",
|
|
3626
3626
|
message: `${t} has joined the chat.`,
|
|
@@ -3634,7 +3634,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3634
3634
|
e.agent_name,
|
|
3635
3635
|
yt.current
|
|
3636
3636
|
], d);
|
|
3637
|
-
|
|
3637
|
+
M(!1), A("ai"), S((e) => vi(e, {
|
|
3638
3638
|
id: `agent-left-${Date.now()}`,
|
|
3639
3639
|
sender: "system",
|
|
3640
3640
|
message: `${t} has left the chat.`,
|
|
@@ -3643,7 +3643,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3643
3643
|
}));
|
|
3644
3644
|
};
|
|
3645
3645
|
f.on("agent:joined", p), f.on("agentJoined", p), f.on("agent:left", m), f.on("agentLeft", m), f.on("conversationEnded", (e) => {
|
|
3646
|
-
|
|
3646
|
+
Le(!0);
|
|
3647
3647
|
let t = e?.message || "This conversation has ended. Thank you for reaching out!";
|
|
3648
3648
|
S((e) => [...e, {
|
|
3649
3649
|
id: `conversation-ended-${Date.now()}`,
|
|
@@ -3654,15 +3654,15 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3654
3654
|
}]);
|
|
3655
3655
|
}), f.on("chat:history_update", (e) => {
|
|
3656
3656
|
let t = pi(e.chat_history || []);
|
|
3657
|
-
S(t), t.length === 0 && (
|
|
3657
|
+
S(t), t.length === 0 && (Le(!1), M(!1), A("ai"), I(!1), be(!1));
|
|
3658
3658
|
}), f.on("conversation:reset", () => {
|
|
3659
|
-
S([]),
|
|
3659
|
+
S([]), Le(!1), M(!1), A("ai"), I(!1), be(!1);
|
|
3660
3660
|
}), f.on("voice:end_session", (e = {}) => {
|
|
3661
|
-
console.log("[FlowEngageProvider] voice:end_session received — ending voice session"),
|
|
3661
|
+
console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Fe((e) => e + 1), O(!0), Ne((e) => e + 1);
|
|
3662
3662
|
}), f.on("typing:start", (e) => {
|
|
3663
|
-
e.sender === "agent" &&
|
|
3663
|
+
e.sender === "agent" && be(!0);
|
|
3664
3664
|
}), f.on("typing:stop", (e) => {
|
|
3665
|
-
e.sender === "agent" &&
|
|
3665
|
+
e.sender === "agent" && be(!1);
|
|
3666
3666
|
}), f.on("call:incoming", (e = {}) => {
|
|
3667
3667
|
let t = _i([
|
|
3668
3668
|
e.agentName,
|
|
@@ -3670,12 +3670,12 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3670
3670
|
e.agent?.name,
|
|
3671
3671
|
yt.current
|
|
3672
3672
|
], "Agent");
|
|
3673
|
-
Dt(), Ot(), ft.current = !1,
|
|
3673
|
+
Dt(), Ot(), ft.current = !1, Re({
|
|
3674
3674
|
callId: e.callId,
|
|
3675
3675
|
from: e.from || "owner",
|
|
3676
3676
|
agentId: e.agentId || null,
|
|
3677
3677
|
agentName: t
|
|
3678
|
-
}),
|
|
3678
|
+
}), oe((e) => _i([t, e], "Agent")), V("incoming"), Ge(null), O(!0);
|
|
3679
3679
|
}), f.on("call:offer", async (e = {}) => {
|
|
3680
3680
|
it.current = e;
|
|
3681
3681
|
try {
|
|
@@ -3718,10 +3718,10 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3718
3718
|
if (!e.callId) return;
|
|
3719
3719
|
let t = ut.current === e.callId, n = lt.current === e.callId, r = it.current?.callId === e.callId, i = et.current?.callId === e.callId;
|
|
3720
3720
|
if (!t && !n && !r) {
|
|
3721
|
-
i && (
|
|
3721
|
+
i && (Re(null), V("idle"));
|
|
3722
3722
|
return;
|
|
3723
3723
|
}
|
|
3724
|
-
ft.current = !0, ut.current = null, lt.current = e.callId, He(e.callId),
|
|
3724
|
+
ft.current = !0, ut.current = null, lt.current = e.callId, He(e.callId), Re(null), V("connected"), Ge(e.connectedAt || (/* @__PURE__ */ new Date()).toISOString()), O(!0);
|
|
3725
3725
|
}), f.on("call:unavailable", (e = {}) => {
|
|
3726
3726
|
At("socket:call_unavailable"), Ye(hi(e, "This visitor is not available for a call right now.")), O(!0);
|
|
3727
3727
|
}), f.on("call:error", (e = {}) => {
|
|
@@ -3750,7 +3750,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3750
3750
|
});
|
|
3751
3751
|
let h = await l.loadHistory(c, r);
|
|
3752
3752
|
if (!e) return;
|
|
3753
|
-
S(pi(h.chat_history || [])),
|
|
3753
|
+
S(pi(h.chat_history || [])), M(!!h.is_human_handled), A(h.is_human_handled ? "agent" : k);
|
|
3754
3754
|
let g = h?.visitor_email || h?.visitorEmail;
|
|
3755
3755
|
if (g && String(g).trim() && kt(String(g).trim()), await new Promise((e) => setTimeout(e, 500)), !e) return;
|
|
3756
3756
|
u("ready");
|
|
@@ -3768,11 +3768,11 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3768
3768
|
r,
|
|
3769
3769
|
a
|
|
3770
3770
|
]), c(() => () => {
|
|
3771
|
-
if (
|
|
3771
|
+
if (Ae && !xt.current && bt.current.length > 0) {
|
|
3772
3772
|
let e = Qe.current, t = bt.current, n = U.current;
|
|
3773
3773
|
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), xt.current = !0);
|
|
3774
3774
|
}
|
|
3775
|
-
}, [
|
|
3775
|
+
}, [Ae, _]);
|
|
3776
3776
|
let Ft = p(null);
|
|
3777
3777
|
c(() => {
|
|
3778
3778
|
let e = U.current;
|
|
@@ -3785,8 +3785,8 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3785
3785
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
3786
3786
|
}, []);
|
|
3787
3787
|
let It = async () => {
|
|
3788
|
-
if (!(!
|
|
3789
|
-
Dt(), ut.current =
|
|
3788
|
+
if (!(!z?.callId || !U.current || !H.current || !y)) {
|
|
3789
|
+
Dt(), ut.current = z.callId, Ot();
|
|
3790
3790
|
try {
|
|
3791
3791
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
3792
3792
|
nt.current = e;
|
|
@@ -3828,7 +3828,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3828
3828
|
if (!e.candidate || !H.current?.connected) return;
|
|
3829
3829
|
let t = e.candidate;
|
|
3830
3830
|
H.current.emit("call:ice-candidate", {
|
|
3831
|
-
callId:
|
|
3831
|
+
callId: z.callId,
|
|
3832
3832
|
candidate: t.candidate,
|
|
3833
3833
|
sdpMid: t.sdpMid,
|
|
3834
3834
|
sdpMLineIndex: t.sdpMLineIndex,
|
|
@@ -3842,7 +3842,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3842
3842
|
e.id = "flowengage-remote-audio", e.autoplay = !0, e.playsInline = !0, e.onplay = () => {}, e.onpause = () => {}, e.onended = () => {}, e.onerror = (e) => {}, rt.current = e, document.body.appendChild(e);
|
|
3843
3843
|
}
|
|
3844
3844
|
rt.current.srcObject = e.streams[0];
|
|
3845
|
-
let r =
|
|
3845
|
+
let r = z?.callId, i = r && (ut.current === r || lt.current === r);
|
|
3846
3846
|
if (!ft.current && i) {
|
|
3847
3847
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
3848
3848
|
V("connected"), Ge((t) => t || e), lt.current = r, He(r), jt(e);
|
|
@@ -3853,15 +3853,15 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3853
3853
|
};
|
|
3854
3854
|
let r = it.current;
|
|
3855
3855
|
r && (console.log("[FlowEngageProvider] found pending remote offer during accept", {
|
|
3856
|
-
callId: r.callId ||
|
|
3856
|
+
callId: r.callId || z.callId,
|
|
3857
3857
|
chatId: y
|
|
3858
3858
|
}), await Pt({
|
|
3859
3859
|
...r,
|
|
3860
|
-
callId: r.callId ||
|
|
3861
|
-
})), await U.current.acceptCall(
|
|
3862
|
-
callId:
|
|
3860
|
+
callId: r.callId || z.callId
|
|
3861
|
+
})), await U.current.acceptCall(z.callId, y), H.current?.emit("call:accepted", {
|
|
3862
|
+
callId: z.callId,
|
|
3863
3863
|
chatId: y
|
|
3864
|
-
}), lt.current =
|
|
3864
|
+
}), lt.current = z.callId, He(z.callId), V((e) => e === "connected" || ft.current ? "connected" : "connecting"), Re(null), O(!0);
|
|
3865
3865
|
} catch (e) {
|
|
3866
3866
|
if (ut.current = null, At("accept_call_failed"), e?.status === 404 || e?.status === 409 || e?.status === 422) {
|
|
3867
3867
|
Ye(hi(e, "This visitor call is no longer available."));
|
|
@@ -3869,7 +3869,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3869
3869
|
}
|
|
3870
3870
|
if (e?.name === "NotAllowedError" || e?.name === "PermissionDeniedError") {
|
|
3871
3871
|
try {
|
|
3872
|
-
await U.current.rejectCall(
|
|
3872
|
+
await U.current.rejectCall(z.callId, y);
|
|
3873
3873
|
} catch (e) {
|
|
3874
3874
|
console.error("[FlowEngageProvider] failed to reject call after microphone denial", e);
|
|
3875
3875
|
}
|
|
@@ -3880,11 +3880,11 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3880
3880
|
}
|
|
3881
3881
|
}
|
|
3882
3882
|
}, Lt = async () => {
|
|
3883
|
-
if (!
|
|
3883
|
+
if (!z?.callId || !U.current || !y) {
|
|
3884
3884
|
At("reject_call_without_server_context");
|
|
3885
3885
|
return;
|
|
3886
3886
|
}
|
|
3887
|
-
let e =
|
|
3887
|
+
let e = z.callId;
|
|
3888
3888
|
Ot(), Dt(), H.current?.emit("call:rejected", {
|
|
3889
3889
|
callId: e,
|
|
3890
3890
|
chatId: y,
|
|
@@ -3899,11 +3899,11 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3899
3899
|
}
|
|
3900
3900
|
}, Rt = p(Lt);
|
|
3901
3901
|
Rt.current = Lt, c(() => {
|
|
3902
|
-
if (!
|
|
3902
|
+
if (!z?.callId || B) {
|
|
3903
3903
|
Ot();
|
|
3904
3904
|
return;
|
|
3905
3905
|
}
|
|
3906
|
-
let e =
|
|
3906
|
+
let e = z.callId;
|
|
3907
3907
|
return Ot(), dt.current = window.setTimeout(() => {
|
|
3908
3908
|
et.current?.callId === e && ut.current !== e && lt.current !== e && Rt.current();
|
|
3909
3909
|
}, ne), () => {
|
|
@@ -3912,7 +3912,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3912
3912
|
}, [
|
|
3913
3913
|
B,
|
|
3914
3914
|
Ot,
|
|
3915
|
-
|
|
3915
|
+
z?.callId
|
|
3916
3916
|
]);
|
|
3917
3917
|
let zt = async () => {
|
|
3918
3918
|
if (!B || !U.current || !y) {
|
|
@@ -3991,7 +3991,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
3991
3991
|
}
|
|
3992
3992
|
let qt = async (e, t = "", n = null, a = {}) => {
|
|
3993
3993
|
let o = typeof e == "string" ? e.trim() : "";
|
|
3994
|
-
if (!o || !U.current || !y || l !== "ready" ||
|
|
3994
|
+
if (!o || !U.current || !y || l !== "ready" || Ie) return;
|
|
3995
3995
|
Wt(), ot.current = !1;
|
|
3996
3996
|
let s = /^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i, c = /^\s*(?:yes|yeah|sure|ok|okay|yep|absolutely)\s+(?!(?:please|do\s+it|let'?s|that|this|there|it|thanks|go|cool|great|perfect|sounds|alright|proceed)\b)\w/i, u = /\b(take me|navigate|go to|show me|bring me|open|go there|navigate to|take me to|let'?s go to)\b/i;
|
|
3997
3997
|
if (at.current && s.test(o) && !c.test(o)) {
|
|
@@ -4027,17 +4027,17 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4027
4027
|
chatId: y,
|
|
4028
4028
|
content: e,
|
|
4029
4029
|
sender: "user",
|
|
4030
|
-
email:
|
|
4030
|
+
email: F || void 0,
|
|
4031
4031
|
type: a?.type || "text",
|
|
4032
4032
|
metadata: a?.metadata || {},
|
|
4033
4033
|
...n || {}
|
|
4034
4034
|
});
|
|
4035
4035
|
return;
|
|
4036
4036
|
}
|
|
4037
|
-
|
|
4037
|
+
we(!0);
|
|
4038
4038
|
try {
|
|
4039
4039
|
let s = await Ur(), c = Vr(), l = `stream-preview-${Date.now().toString(36)}`, d = (e) => {
|
|
4040
|
-
|
|
4040
|
+
I(!1), S((t) => {
|
|
4041
4041
|
let n = t.findIndex((e) => e.id === l);
|
|
4042
4042
|
if (n === -1) return [...t, {
|
|
4043
4043
|
id: l,
|
|
@@ -4054,14 +4054,14 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4054
4054
|
});
|
|
4055
4055
|
}, f = await U.current.sendAiMessage(y, e, r, t, {
|
|
4056
4056
|
...n || {},
|
|
4057
|
-
...
|
|
4057
|
+
...F ? { email: F } : {}
|
|
4058
4058
|
}, {
|
|
4059
4059
|
...a,
|
|
4060
4060
|
currentPageUrl: typeof window < "u" ? window.location.href : void 0,
|
|
4061
4061
|
currentPageTitle: typeof window < "u" ? document.title : void 0,
|
|
4062
4062
|
currentPagePath: typeof window < "u" ? window.location.pathname : void 0,
|
|
4063
4063
|
currentPageContent: Kt() || void 0,
|
|
4064
|
-
navPreference:
|
|
4064
|
+
navPreference: ce(i?.siteId) || void 0,
|
|
4065
4065
|
...s ? { shopifyCart: s } : {},
|
|
4066
4066
|
...c ? { shopifyCustomerId: c } : {}
|
|
4067
4067
|
}, d), p = f.chat_history || [];
|
|
@@ -4087,7 +4087,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4087
4087
|
}, 300);
|
|
4088
4088
|
})) : (at.current = e, console.log("[FWH Nav] Stored pending nav →", at.current));
|
|
4089
4089
|
let t = i?.siteId;
|
|
4090
|
-
t && !
|
|
4090
|
+
t && !ue(t) && (de(t), S((e) => [...e, {
|
|
4091
4091
|
id: `nav-pref-${Date.now()}`,
|
|
4092
4092
|
type: "nav_pref_choice",
|
|
4093
4093
|
sender: "system",
|
|
@@ -4140,14 +4140,14 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4140
4140
|
});
|
|
4141
4141
|
}
|
|
4142
4142
|
}
|
|
4143
|
-
S(pi(p)), Array.isArray(f.cart_actions) && f.cart_actions.length && w(f.cart_actions),
|
|
4143
|
+
S(pi(p)), Array.isArray(f.cart_actions) && f.cart_actions.length && w(f.cart_actions), M(!!f.is_human_handled), A(f.is_human_handled ? "agent" : "ai"), I(!1), we(!1), await U.current.updateChatStatus(y, "messageSent");
|
|
4144
4144
|
} catch (e) {
|
|
4145
4145
|
S((e) => e.filter((e) => !e.isStreaming).map((e) => e.id === d ? {
|
|
4146
4146
|
...e,
|
|
4147
4147
|
isPending: !1,
|
|
4148
4148
|
failed: !0
|
|
4149
|
-
} : e)),
|
|
4150
|
-
|
|
4149
|
+
} : e)), I(!1), we(!1), e.status === 429 ? (Ee(!0), Oe(e.message), window.setTimeout(() => {
|
|
4150
|
+
Ee(!1), Oe("");
|
|
4151
4151
|
}, ee)) : h(e);
|
|
4152
4152
|
}
|
|
4153
4153
|
}, Jt = async (e) => {
|
|
@@ -4159,12 +4159,12 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4159
4159
|
let t = e ? "voice" : "text";
|
|
4160
4160
|
await U.current.setChatMode(y, t);
|
|
4161
4161
|
} catch {}
|
|
4162
|
-
|
|
4162
|
+
je(e), e && (xt.current = !1);
|
|
4163
4163
|
}
|
|
4164
4164
|
}, Xt = async (e) => {
|
|
4165
4165
|
if (xt.current) return;
|
|
4166
4166
|
if (xt.current = !0, !U.current || !y || !e?.length) {
|
|
4167
|
-
|
|
4167
|
+
je(!1);
|
|
4168
4168
|
return;
|
|
4169
4169
|
}
|
|
4170
4170
|
let t = () => {
|
|
@@ -4188,11 +4188,11 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4188
4188
|
} catch {
|
|
4189
4189
|
t();
|
|
4190
4190
|
} finally {
|
|
4191
|
-
|
|
4191
|
+
je(!1);
|
|
4192
4192
|
}
|
|
4193
4193
|
}, Zt = async () => {
|
|
4194
4194
|
if (!(!U.current || !y)) {
|
|
4195
|
-
|
|
4195
|
+
Ae && !xt.current && bt.current.length > 0 && await Xt(bt.current);
|
|
4196
4196
|
try {
|
|
4197
4197
|
await U.current.endConversation(y);
|
|
4198
4198
|
} catch {
|
|
@@ -4200,7 +4200,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4200
4200
|
await U.current.updateChatStatus(y, "ended");
|
|
4201
4201
|
} catch {}
|
|
4202
4202
|
}
|
|
4203
|
-
|
|
4203
|
+
Le(!0), S((e) => [...e, {
|
|
4204
4204
|
id: `conversation-ended-${Date.now()}`,
|
|
4205
4205
|
sender: "system",
|
|
4206
4206
|
message: "This conversation has ended. Thank you for reaching out!",
|
|
@@ -4226,7 +4226,7 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4226
4226
|
let e = () => {
|
|
4227
4227
|
let e = Qe.current, t = U.current;
|
|
4228
4228
|
if (!t || !e) return;
|
|
4229
|
-
if (St.current && bt.current.length > 0 &&
|
|
4229
|
+
if (St.current && bt.current.length > 0 && ke(), !xt.current && bt.current.length > 0 && (t.beaconSyncVoice(e, bt.current) || t.syncVoice(e, bt.current).catch(() => {}), xt.current = !0), lt.current) {
|
|
4230
4230
|
t.beaconEndWebRTCCall(lt.current, e);
|
|
4231
4231
|
return;
|
|
4232
4232
|
}
|
|
@@ -4239,9 +4239,9 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4239
4239
|
}, []);
|
|
4240
4240
|
let Qt = o(() => {
|
|
4241
4241
|
let e = i?.siteId;
|
|
4242
|
-
|
|
4242
|
+
me(e), $e.current = !0, W.current = null, H.current?.disconnect(), S([]), b(""), Qe.current = "", Le(!1), M(!1), oe(null), P(null), Ze(!0), s((e) => e + 1);
|
|
4243
4243
|
}, [i?.siteId]), $t = o((e) => {
|
|
4244
|
-
i?.siteId, $e.current = !1, W.current = e, H.current?.disconnect(), S([]), b(""), Qe.current = "",
|
|
4244
|
+
i?.siteId, $e.current = !1, W.current = e, H.current?.disconnect(), S([]), b(""), Qe.current = "", Le(!1), M(!1), oe(null), P(null), Ze(!0), s((e) => e + 1);
|
|
4245
4245
|
}, [i?.siteId]), en = f(() => ({
|
|
4246
4246
|
status: l,
|
|
4247
4247
|
error: d,
|
|
@@ -4252,21 +4252,21 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4252
4252
|
isOpen: D,
|
|
4253
4253
|
activeScreen: k,
|
|
4254
4254
|
isHumanHandled: j,
|
|
4255
|
-
agentName:
|
|
4256
|
-
agentHeadshot:
|
|
4257
|
-
visitorEmail:
|
|
4258
|
-
isAgentTyping:
|
|
4259
|
-
isAiTyping:
|
|
4260
|
-
connectionStatus:
|
|
4261
|
-
isLoading:
|
|
4262
|
-
isVoiceMode:
|
|
4263
|
-
isRateLimited:
|
|
4264
|
-
rateLimitMessage:
|
|
4265
|
-
isConversationEnded:
|
|
4255
|
+
agentName: N,
|
|
4256
|
+
agentHeadshot: se,
|
|
4257
|
+
visitorEmail: F,
|
|
4258
|
+
isAgentTyping: fe,
|
|
4259
|
+
isAiTyping: xe,
|
|
4260
|
+
connectionStatus: R,
|
|
4261
|
+
isLoading: Ce,
|
|
4262
|
+
isVoiceMode: Ae,
|
|
4263
|
+
isRateLimited: Te,
|
|
4264
|
+
rateLimitMessage: De,
|
|
4265
|
+
isConversationEnded: Ie,
|
|
4266
4266
|
isSessionRestoring: Xe,
|
|
4267
|
-
openToChatCounter:
|
|
4268
|
-
voiceEndCounter:
|
|
4269
|
-
incomingCall:
|
|
4267
|
+
openToChatCounter: Me,
|
|
4268
|
+
voiceEndCounter: Pe,
|
|
4269
|
+
incomingCall: z,
|
|
4270
4270
|
activeCallId: B,
|
|
4271
4271
|
callConnectionState: Ue,
|
|
4272
4272
|
callConnectedAt: We,
|
|
@@ -4317,21 +4317,21 @@ function yi({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
4317
4317
|
D,
|
|
4318
4318
|
k,
|
|
4319
4319
|
j,
|
|
4320
|
-
M,
|
|
4321
4320
|
N,
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
we,
|
|
4327
|
-
je,
|
|
4328
|
-
Ee,
|
|
4329
|
-
Oe,
|
|
4330
|
-
Le,
|
|
4331
|
-
Xe,
|
|
4332
|
-
Ne,
|
|
4333
|
-
Fe,
|
|
4321
|
+
se,
|
|
4322
|
+
F,
|
|
4323
|
+
fe,
|
|
4324
|
+
xe,
|
|
4334
4325
|
R,
|
|
4326
|
+
Ce,
|
|
4327
|
+
Ae,
|
|
4328
|
+
Te,
|
|
4329
|
+
De,
|
|
4330
|
+
Ie,
|
|
4331
|
+
Xe,
|
|
4332
|
+
Me,
|
|
4333
|
+
Pe,
|
|
4334
|
+
z,
|
|
4335
4335
|
B,
|
|
4336
4336
|
Ue,
|
|
4337
4337
|
We,
|
|
@@ -9349,7 +9349,7 @@ async function Dh(e, t, n) {
|
|
|
9349
9349
|
let r = new URLSearchParams({ siteId: t || "" });
|
|
9350
9350
|
n && r.set("chatId", n);
|
|
9351
9351
|
let i = Vr();
|
|
9352
|
-
i && r.set("shopifyCustomerId", String(i)),
|
|
9352
|
+
i && r.set("shopifyCustomerId", String(i)), ce(t) === "auto" && r.set("navPreference", "auto");
|
|
9353
9353
|
let a = await fetch(`${e}/api/voice/session?${r.toString()}`, {
|
|
9354
9354
|
method: "GET",
|
|
9355
9355
|
headers: { "Content-Type": "application/json" }
|
|
@@ -9364,38 +9364,38 @@ async function Dh(e, t, n) {
|
|
|
9364
9364
|
return o;
|
|
9365
9365
|
}
|
|
9366
9366
|
async function Oh(e) {
|
|
9367
|
-
let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p, onPanel: m } = e,
|
|
9368
|
-
f?.({ emailOnFile: !!
|
|
9369
|
-
let
|
|
9370
|
-
e.greeting !== void 0 && (
|
|
9371
|
-
let
|
|
9367
|
+
let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p, onPanel: m, onStartWalkthrough: h } = e, g = await Dh(t, n, r);
|
|
9368
|
+
f?.({ emailOnFile: !!g.emailOnFile });
|
|
9369
|
+
let _ = { type: "Start" };
|
|
9370
|
+
e.greeting !== void 0 && (_.greeting = e.greeting || null);
|
|
9371
|
+
let v = await navigator.mediaDevices.getUserMedia({ audio: {
|
|
9372
9372
|
channelCount: 1,
|
|
9373
9373
|
echoCancellation: !0,
|
|
9374
9374
|
noiseSuppression: !0,
|
|
9375
9375
|
autoGainControl: !0
|
|
9376
|
-
} }),
|
|
9377
|
-
|
|
9378
|
-
let
|
|
9379
|
-
|
|
9380
|
-
e.data && e.data.size > 0 &&
|
|
9381
|
-
},
|
|
9382
|
-
let
|
|
9383
|
-
|
|
9384
|
-
let
|
|
9376
|
+
} }), y = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: sh });
|
|
9377
|
+
y.state === "suspended" && await y.resume();
|
|
9378
|
+
let b = y.createMediaStreamDestination(), x = Ch(), S = [], C = null, w = r || n || null;
|
|
9379
|
+
x && (C = new window.MediaRecorder(b.stream, { mimeType: x }), C.ondataavailable = (e) => {
|
|
9380
|
+
e.data && e.data.size > 0 && S.push(e.data);
|
|
9381
|
+
}, C.start());
|
|
9382
|
+
let T = new WebSocket(g.wsUrl);
|
|
9383
|
+
T.binaryType = "arraybuffer";
|
|
9384
|
+
let E = /* @__PURE__ */ new Set(), D = {
|
|
9385
9385
|
role: null,
|
|
9386
9386
|
text: "",
|
|
9387
9387
|
timer: null,
|
|
9388
9388
|
debug: null
|
|
9389
|
-
},
|
|
9390
|
-
|
|
9391
|
-
let e =
|
|
9392
|
-
if (
|
|
9389
|
+
}, O = "", k = () => {
|
|
9390
|
+
D.timer &&= (clearTimeout(D.timer), null);
|
|
9391
|
+
let e = D.text.trim(), t = D.role, n = D.debug;
|
|
9392
|
+
if (D.text = "", D.role = null, D.debug = null, !(!e || !t)) {
|
|
9393
9393
|
if (t === "agent") {
|
|
9394
|
-
if (e ===
|
|
9394
|
+
if (e === O) {
|
|
9395
9395
|
console.debug("[FlowEngage] duplicate agent turn suppressed");
|
|
9396
9396
|
return;
|
|
9397
9397
|
}
|
|
9398
|
-
|
|
9398
|
+
O = e;
|
|
9399
9399
|
}
|
|
9400
9400
|
s?.({
|
|
9401
9401
|
role: t,
|
|
@@ -9403,64 +9403,64 @@ async function Oh(e) {
|
|
|
9403
9403
|
debug: n
|
|
9404
9404
|
});
|
|
9405
9405
|
}
|
|
9406
|
-
},
|
|
9407
|
-
t && (
|
|
9408
|
-
},
|
|
9409
|
-
|
|
9406
|
+
}, A = (e, t, n) => {
|
|
9407
|
+
t && (D.role && D.role !== e && k(), D.role = e, D.text = D.text ? `${D.text} ${t}`.replace(/\s+/g, " ") : t, n && (D.debug = n), D.timer && clearTimeout(D.timer), D.timer = setTimeout(k, lh));
|
|
9408
|
+
}, ee = !1, te = !1, ne = !1, j = !1, M = !1, re = !0, ie = 0, ae = 0, N = !1, oe = !1, se = uh, P = null, F = !1, ce = !1, le = () => {
|
|
9409
|
+
P && clearTimeout(P);
|
|
9410
9410
|
let e = () => {
|
|
9411
|
-
if (!
|
|
9411
|
+
if (!ee) {
|
|
9412
9412
|
if (ue.isPlaying()) {
|
|
9413
|
-
|
|
9413
|
+
P = setTimeout(e, 150);
|
|
9414
9414
|
return;
|
|
9415
9415
|
}
|
|
9416
|
-
if (
|
|
9416
|
+
if (P = null, F) {
|
|
9417
9417
|
p?.();
|
|
9418
9418
|
return;
|
|
9419
9419
|
}
|
|
9420
|
-
!
|
|
9420
|
+
!ee && T.readyState === WebSocket.OPEN && T.send(JSON.stringify({ type: "PlaybackDrained" })), ce && (ce = !1, d?.());
|
|
9421
9421
|
}
|
|
9422
9422
|
};
|
|
9423
|
-
|
|
9424
|
-
}, ue = Eh(
|
|
9425
|
-
|
|
9426
|
-
},
|
|
9423
|
+
P = setTimeout(e, 150);
|
|
9424
|
+
}, ue = Eh(y, () => {
|
|
9425
|
+
j && (j = !1, c?.({ mode: M ? "thinking" : "listening" }));
|
|
9426
|
+
}, b);
|
|
9427
9427
|
typeof window < "u" && (window.__fe_agentAudioPlaying = () => ue.isPlaying());
|
|
9428
|
-
let de =
|
|
9429
|
-
de.connect(
|
|
9430
|
-
let fe =
|
|
9428
|
+
let de = y.createMediaStreamSource(v);
|
|
9429
|
+
de.connect(b);
|
|
9430
|
+
let fe = y.createScriptProcessor(ch, 1, 1), pe = !1;
|
|
9431
9431
|
fe.onaudioprocess = (e) => {
|
|
9432
|
-
if (
|
|
9433
|
-
let t = e.inputBuffer.getChannelData(0), n = () =>
|
|
9434
|
-
if (
|
|
9435
|
-
|
|
9432
|
+
if (ee || T.readyState !== WebSocket.OPEN) return;
|
|
9433
|
+
let t = e.inputBuffer.getChannelData(0), n = () => T.send(new Int16Array(t.length).buffer);
|
|
9434
|
+
if (te) {
|
|
9435
|
+
ne || (ne = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), pe = !1, ie = 0, ae = 0, n();
|
|
9436
9436
|
return;
|
|
9437
9437
|
}
|
|
9438
|
-
let r = vh(t), i = _h(t), a = ue.isPlaying() ||
|
|
9439
|
-
if (r >= o && i >= dh && i <= fh ? (ae = 0, ie += 1) : ++ae >= mh && (ie = 0), a ? pe = !1 : !pe && ie >= ph ? (pe = !0, c?.({ mode: "user-speaking" })) : pe && ie === 0 && (pe = !1), a && !
|
|
9440
|
-
|
|
9438
|
+
let r = vh(t), i = _h(t), a = ue.isPlaying() || oe, o = a ? se * gh : se, s = a ? hh : ph;
|
|
9439
|
+
if (r >= o && i >= dh && i <= fh ? (ae = 0, ie += 1) : ++ae >= mh && (ie = 0), a ? pe = !1 : !pe && ie >= ph ? (pe = !0, c?.({ mode: "user-speaking" })) : pe && ie === 0 && (pe = !1), a && !N && ie >= s) {
|
|
9440
|
+
N = !0, M = !1, ie = 0;
|
|
9441
9441
|
let e = ue.playedMs();
|
|
9442
|
-
ue.stop(), re = !1,
|
|
9442
|
+
ue.stop(), re = !1, oe = !1, P && !F && (clearTimeout(P), P = null), ce = !1, T.send(JSON.stringify({
|
|
9443
9443
|
type: "VisitorInterrupted",
|
|
9444
9444
|
played_ms: Math.round(e)
|
|
9445
9445
|
})), console.debug("[FlowEngage] barge-in — visitor spoke over the agent");
|
|
9446
9446
|
}
|
|
9447
|
-
|
|
9448
|
-
}, de.connect(fe), fe.connect(
|
|
9447
|
+
T.send(yh(t).buffer);
|
|
9448
|
+
}, de.connect(fe), fe.connect(y.destination);
|
|
9449
9449
|
let me = () => {
|
|
9450
|
-
if (!
|
|
9451
|
-
|
|
9450
|
+
if (!ee) {
|
|
9451
|
+
ee = !0, P &&= (clearTimeout(P), null), k(), ue.stop(), typeof window < "u" && delete window.__fe_agentAudioPlaying;
|
|
9452
9452
|
try {
|
|
9453
9453
|
fe.disconnect(), de.disconnect();
|
|
9454
9454
|
} catch {}
|
|
9455
|
-
if (
|
|
9456
|
-
|
|
9455
|
+
if (v.getTracks().forEach((e) => e.stop()), C && C.state !== "inactive") {
|
|
9456
|
+
C.onstop = () => wh(t, n, w, S, x);
|
|
9457
9457
|
try {
|
|
9458
|
-
|
|
9458
|
+
C.stop();
|
|
9459
9459
|
} catch {
|
|
9460
|
-
|
|
9460
|
+
C.onstop = null;
|
|
9461
9461
|
}
|
|
9462
|
-
} else
|
|
9463
|
-
|
|
9462
|
+
} else S.length && wh(t, n, w, S, x);
|
|
9463
|
+
y.close().catch(() => {}), (T.readyState === WebSocket.OPEN || T.readyState === WebSocket.CONNECTING) && T.close();
|
|
9464
9464
|
}
|
|
9465
9465
|
}, he = async (e) => {
|
|
9466
9466
|
let t = i[e.name];
|
|
@@ -9478,8 +9478,8 @@ async function Oh(e) {
|
|
|
9478
9478
|
for (let t of e.functions || []) {
|
|
9479
9479
|
if (!t.client_side) continue;
|
|
9480
9480
|
let e = await he(t);
|
|
9481
|
-
if (
|
|
9482
|
-
|
|
9481
|
+
if (ee || T.readyState !== WebSocket.OPEN) return;
|
|
9482
|
+
T.send(JSON.stringify({
|
|
9483
9483
|
type: "FunctionCallResponse",
|
|
9484
9484
|
id: t.id,
|
|
9485
9485
|
name: t.name,
|
|
@@ -9489,14 +9489,14 @@ async function Oh(e) {
|
|
|
9489
9489
|
}, _e = (e) => {
|
|
9490
9490
|
switch (e.type) {
|
|
9491
9491
|
case "Welcome":
|
|
9492
|
-
Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (se = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && e.barge_in_frames,
|
|
9492
|
+
Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (se = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && e.barge_in_frames, w = e.session_id || r || n || null, a?.({ conversationId: w });
|
|
9493
9493
|
break;
|
|
9494
9494
|
case "ConversationText": {
|
|
9495
9495
|
let t = String(e.content || "");
|
|
9496
9496
|
if (e.role === "user") {
|
|
9497
9497
|
let e = t.trim();
|
|
9498
|
-
if (
|
|
9499
|
-
|
|
9498
|
+
if (E.has(e)) {
|
|
9499
|
+
E.delete(e);
|
|
9500
9500
|
break;
|
|
9501
9501
|
}
|
|
9502
9502
|
if (/^\[SYSTEM:/i.test(e) || /^Continue (now )?to the next section/i.test(e) || /^That was the last section/i.test(e)) {
|
|
@@ -9504,32 +9504,35 @@ async function Oh(e) {
|
|
|
9504
9504
|
break;
|
|
9505
9505
|
}
|
|
9506
9506
|
}
|
|
9507
|
-
|
|
9507
|
+
A(e.role === "user" ? "user" : "agent", t, e.debug);
|
|
9508
9508
|
break;
|
|
9509
9509
|
}
|
|
9510
9510
|
case "UserStartedSpeaking":
|
|
9511
|
-
|
|
9511
|
+
k(), ue.stop(), oe = !1, re = !1, j = !1, M = !1, P && !F && (clearTimeout(P), P = null), ce = !1, c?.({ mode: "listening" });
|
|
9512
9512
|
break;
|
|
9513
9513
|
case "AgentStartedSpeaking":
|
|
9514
|
-
re = !0,
|
|
9514
|
+
re = !0, j = !0, N = !1, ie = 0, c?.({ mode: "speaking" });
|
|
9515
9515
|
break;
|
|
9516
9516
|
case "AgentAudioDone":
|
|
9517
|
-
|
|
9517
|
+
oe = !1, k(), le(), ue.isPlaying() || (j = !1, c?.({ mode: M ? "thinking" : "listening" }));
|
|
9518
9518
|
break;
|
|
9519
9519
|
case "FunctionCallRequest":
|
|
9520
9520
|
ge(e);
|
|
9521
9521
|
break;
|
|
9522
9522
|
case "AgentPreparing":
|
|
9523
|
-
|
|
9523
|
+
oe = !0;
|
|
9524
9524
|
break;
|
|
9525
9525
|
case "AgentTurnComplete":
|
|
9526
|
-
|
|
9526
|
+
M = !1, ce = !0, le();
|
|
9527
9527
|
break;
|
|
9528
9528
|
case "SessionEnding":
|
|
9529
|
-
console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"),
|
|
9529
|
+
console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), F = !0;
|
|
9530
|
+
break;
|
|
9531
|
+
case "StartWalkthrough":
|
|
9532
|
+
h?.();
|
|
9530
9533
|
break;
|
|
9531
9534
|
case "AgentThinking":
|
|
9532
|
-
|
|
9535
|
+
M = !0, c?.({ mode: "thinking" });
|
|
9533
9536
|
break;
|
|
9534
9537
|
case "PromptUpdated": break;
|
|
9535
9538
|
case "AgentPanel":
|
|
@@ -9548,7 +9551,7 @@ async function Oh(e) {
|
|
|
9548
9551
|
default: break;
|
|
9549
9552
|
}
|
|
9550
9553
|
};
|
|
9551
|
-
return
|
|
9554
|
+
return T.onopen = () => T.send(JSON.stringify(_)), T.onmessage = (e) => {
|
|
9552
9555
|
if (e.data instanceof ArrayBuffer) {
|
|
9553
9556
|
re && ue.enqueue(new Int16Array(e.data));
|
|
9554
9557
|
return;
|
|
@@ -9564,44 +9567,51 @@ async function Oh(e) {
|
|
|
9564
9567
|
} catch (e) {
|
|
9565
9568
|
console.error("[FlowEngage] voice event handler failed:", t?.type, e);
|
|
9566
9569
|
}
|
|
9567
|
-
},
|
|
9570
|
+
}, T.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), T.onclose = () => {
|
|
9568
9571
|
me(), o?.();
|
|
9569
9572
|
}, {
|
|
9570
9573
|
endSession: async () => me(),
|
|
9571
9574
|
sendContextualUpdate: (e) => {
|
|
9572
|
-
|
|
9575
|
+
ee || T.readyState !== WebSocket.OPEN || !e || T.send(JSON.stringify({
|
|
9573
9576
|
type: "UpdatePrompt",
|
|
9574
9577
|
prompt: e
|
|
9575
9578
|
}));
|
|
9576
9579
|
},
|
|
9580
|
+
reportPage: (e, t) => {
|
|
9581
|
+
ee || T.readyState !== WebSocket.OPEN || !e || T.send(JSON.stringify({
|
|
9582
|
+
type: "PageChanged",
|
|
9583
|
+
path: e,
|
|
9584
|
+
title: t || null
|
|
9585
|
+
}));
|
|
9586
|
+
},
|
|
9577
9587
|
sendUserMessage: (e, { silent: t = !0, suppressQuestion: n = !1 } = {}) => {
|
|
9578
|
-
|
|
9588
|
+
ee || T.readyState !== WebSocket.OPEN || !e || (t && E.add(e.trim()), T.send(JSON.stringify({
|
|
9579
9589
|
type: "InjectUserMessage",
|
|
9580
9590
|
content: e,
|
|
9581
9591
|
suppress_question: n
|
|
9582
9592
|
})));
|
|
9583
9593
|
},
|
|
9584
9594
|
injectAgentSpeech: (e, t = "interrupt") => {
|
|
9585
|
-
|
|
9595
|
+
ee || T.readyState !== WebSocket.OPEN || !e || T.send(JSON.stringify({
|
|
9586
9596
|
type: "InjectAgentMessage",
|
|
9587
9597
|
message: e,
|
|
9588
9598
|
behavior: t
|
|
9589
9599
|
}));
|
|
9590
9600
|
},
|
|
9591
9601
|
setWalkthroughActive: (e) => {
|
|
9592
|
-
|
|
9602
|
+
ee || T.readyState !== WebSocket.OPEN || T.send(JSON.stringify({
|
|
9593
9603
|
type: "WalkthroughActive",
|
|
9594
9604
|
active: !!e
|
|
9595
9605
|
}));
|
|
9596
9606
|
},
|
|
9597
9607
|
setMicMuted: (e) => {
|
|
9598
|
-
|
|
9608
|
+
te = !!e, !ee && T.readyState === WebSocket.OPEN && T.send(JSON.stringify({
|
|
9599
9609
|
type: "MicHeld",
|
|
9600
|
-
held:
|
|
9610
|
+
held: te
|
|
9601
9611
|
}));
|
|
9602
9612
|
},
|
|
9603
9613
|
get status() {
|
|
9604
|
-
return
|
|
9614
|
+
return ee ? "disconnected" : "connected";
|
|
9605
9615
|
}
|
|
9606
9616
|
};
|
|
9607
9617
|
}
|
|
@@ -10400,7 +10410,7 @@ function Lg({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
|
|
|
10400
10410
|
//#region src/components/MessageList.jsx
|
|
10401
10411
|
function Rg({ siteId: e, onChoose: t }) {
|
|
10402
10412
|
let [n, r] = m(null), i = (n) => {
|
|
10403
|
-
|
|
10413
|
+
le(e, n), r(n), t?.(n);
|
|
10404
10414
|
};
|
|
10405
10415
|
return /* @__PURE__ */ g("div", {
|
|
10406
10416
|
style: {
|
|
@@ -12820,7 +12830,7 @@ function T_(e) {
|
|
|
12820
12830
|
function E_(e) {
|
|
12821
12831
|
let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = typeof e.beaconSyncFullVoiceHistory == "function" ? e.beaconSyncFullVoiceHistory : null, a = [], o = {
|
|
12822
12832
|
"fwh-navigate-mvp": async (n) => {
|
|
12823
|
-
|
|
12833
|
+
$("fwh-navigate-mvp ▶ raw parameters:", n);
|
|
12824
12834
|
let a = x_(n), o = S_(a), s = a.section_text ?? a.sectionText ?? a.section, c = Array.isArray(a.expected_landmarks) ? a.expected_landmarks : Array.isArray(a.expectedLandmarks) ? a.expectedLandmarks : [];
|
|
12825
12835
|
if ($("fwh-navigate-mvp · coerced:", {
|
|
12826
12836
|
url: o,
|
|
@@ -12872,10 +12882,10 @@ function E_(e) {
|
|
|
12872
12882
|
sender: "user",
|
|
12873
12883
|
message: e
|
|
12874
12884
|
}]);
|
|
12875
|
-
n &&
|
|
12885
|
+
n && Te(t, n);
|
|
12876
12886
|
}
|
|
12877
12887
|
} catch {}
|
|
12878
|
-
|
|
12888
|
+
ke();
|
|
12879
12889
|
let e = o;
|
|
12880
12890
|
try {
|
|
12881
12891
|
e = new URL(o, typeof window < "u" ? window.location.href : "").href;
|
|
@@ -12885,7 +12895,7 @@ function E_(e) {
|
|
|
12885
12895
|
let e = new URL(o, window.location.href).pathname.split("/").filter(Boolean).pop() || "";
|
|
12886
12896
|
n = e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) : "Home";
|
|
12887
12897
|
} catch {}
|
|
12888
|
-
t && typeof window < "u" &&
|
|
12898
|
+
t && typeof window < "u" && Ie(t, window.location.href, e, n), Sr(e);
|
|
12889
12899
|
try {
|
|
12890
12900
|
window.__fe_agent_nav = {
|
|
12891
12901
|
path: new URL(e, window.location.href).pathname,
|
|
@@ -13250,7 +13260,7 @@ function E_(e) {
|
|
|
13250
13260
|
try {
|
|
13251
13261
|
r = new URL(e, window.location.href).href;
|
|
13252
13262
|
} catch {}
|
|
13253
|
-
return t &&
|
|
13263
|
+
return t && Ie(t, window.location.href, r, n), Sr(r), kr().then(() => {
|
|
13254
13264
|
window.location.assign(r);
|
|
13255
13265
|
}), `OK_NAVIGATING to ${n}. The page is loading.`;
|
|
13256
13266
|
}
|
|
@@ -13296,7 +13306,13 @@ var A_ = "[PAGE_CONTEXT]";
|
|
|
13296
13306
|
function j_(e, t, n, r) {
|
|
13297
13307
|
return `${A_} The visitor is on ${e}${r ? `, having moved here themselves from the ${r} page` : ""}. Approximate headings: ${t || "none"}. ${n ? `Forms: ${n}. ` : ""}`.trim();
|
|
13298
13308
|
}
|
|
13299
|
-
|
|
13309
|
+
function M_(e, t, n, r, i) {
|
|
13310
|
+
e?.sendContextualUpdate?.(j_(t, n, r, i));
|
|
13311
|
+
try {
|
|
13312
|
+
e?.reportPage?.(new URL(t, window.location.href).pathname, document.title);
|
|
13313
|
+
} catch {}
|
|
13314
|
+
}
|
|
13315
|
+
var N_ = {
|
|
13300
13316
|
blue: "#135bd8",
|
|
13301
13317
|
red: "#ef334b",
|
|
13302
13318
|
yellow: "#ffbd2e",
|
|
@@ -13304,7 +13320,7 @@ var M_ = {
|
|
|
13304
13320
|
highlight: "rgba(255,255,255,0.9)",
|
|
13305
13321
|
green: "#10b981"
|
|
13306
13322
|
};
|
|
13307
|
-
function
|
|
13323
|
+
function P_(e) {
|
|
13308
13324
|
if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
|
|
13309
13325
|
let [t, n, r] = e;
|
|
13310
13326
|
return e.length >= 3 && r ? [
|
|
@@ -13318,12 +13334,12 @@ function N_(e) {
|
|
|
13318
13334
|
"#f7f8fa"
|
|
13319
13335
|
].join(", ");
|
|
13320
13336
|
}
|
|
13321
|
-
function
|
|
13337
|
+
function F_(e) {
|
|
13322
13338
|
if (!e || typeof e != "string") return "#1a1a1a";
|
|
13323
13339
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16) / 255, a = parseInt(n.slice(4, 6), 16) / 255, o = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
13324
13340
|
return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
|
|
13325
13341
|
}
|
|
13326
|
-
function
|
|
13342
|
+
function I_(t) {
|
|
13327
13343
|
let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
|
|
13328
13344
|
return e.useEffect(() => {
|
|
13329
13345
|
if (!i) {
|
|
@@ -13341,8 +13357,8 @@ function F_(t) {
|
|
|
13341
13357
|
};
|
|
13342
13358
|
}, [i]), n;
|
|
13343
13359
|
}
|
|
13344
|
-
function
|
|
13345
|
-
let r =
|
|
13360
|
+
function L_({ logo: t, style: n }) {
|
|
13361
|
+
let r = I_(typeof t == "string" ? t : null);
|
|
13346
13362
|
if (!t) return null;
|
|
13347
13363
|
if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
|
|
13348
13364
|
src: r,
|
|
@@ -13367,7 +13383,7 @@ function I_({ logo: t, style: n }) {
|
|
|
13367
13383
|
children: i
|
|
13368
13384
|
}) : null;
|
|
13369
13385
|
}
|
|
13370
|
-
function
|
|
13386
|
+
function R_({ title: e }) {
|
|
13371
13387
|
return /* @__PURE__ */ g("div", {
|
|
13372
13388
|
style: {
|
|
13373
13389
|
width: "100%",
|
|
@@ -13385,18 +13401,18 @@ function L_({ title: e }) {
|
|
|
13385
13401
|
children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
|
|
13386
13402
|
});
|
|
13387
13403
|
}
|
|
13388
|
-
function
|
|
13404
|
+
function z_(e, t) {
|
|
13389
13405
|
let n = (t || "").trim();
|
|
13390
13406
|
return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || e === "bot" && (/\b(that'?s all|we'?re done)\b/i.test(n) || /\b(goodbye|bye)\b/i.test(n) || /\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n))) : !1;
|
|
13391
13407
|
}
|
|
13392
|
-
function
|
|
13408
|
+
function B_({ orbColors: e, ...t }) {
|
|
13393
13409
|
return /* @__PURE__ */ g(Zg, {
|
|
13394
13410
|
colors: e,
|
|
13395
13411
|
...t
|
|
13396
13412
|
});
|
|
13397
13413
|
}
|
|
13398
|
-
function
|
|
13399
|
-
let s = n ||
|
|
13414
|
+
function V_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
|
|
13415
|
+
let s = n || N_.green, c = F_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
|
|
13400
13416
|
style: {
|
|
13401
13417
|
display: "flex",
|
|
13402
13418
|
alignItems: a ? "flex-end" : "center",
|
|
@@ -13522,7 +13538,7 @@ function B_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
13522
13538
|
delay: 0
|
|
13523
13539
|
},
|
|
13524
13540
|
style: { flexShrink: 0 },
|
|
13525
|
-
children: /* @__PURE__ */ g(
|
|
13541
|
+
children: /* @__PURE__ */ g(B_, {
|
|
13526
13542
|
size: l,
|
|
13527
13543
|
orbColors: t
|
|
13528
13544
|
})
|
|
@@ -13554,8 +13570,8 @@ function B_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
|
|
|
13554
13570
|
children: u
|
|
13555
13571
|
})] });
|
|
13556
13572
|
}
|
|
13557
|
-
function
|
|
13558
|
-
let c = n ||
|
|
13573
|
+
function H_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
|
|
13574
|
+
let c = n || N_.green, l = F_(c);
|
|
13559
13575
|
return /* @__PURE__ */ _(oh.div, {
|
|
13560
13576
|
initial: {
|
|
13561
13577
|
scale: 50 / 350,
|
|
@@ -13626,7 +13642,7 @@ function V_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
13626
13642
|
children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
|
|
13627
13643
|
})
|
|
13628
13644
|
}),
|
|
13629
|
-
/* @__PURE__ */ g(
|
|
13645
|
+
/* @__PURE__ */ g(B_, {
|
|
13630
13646
|
size: 72,
|
|
13631
13647
|
orbColors: t
|
|
13632
13648
|
}),
|
|
@@ -13706,88 +13722,88 @@ function V_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
|
|
|
13706
13722
|
]
|
|
13707
13723
|
});
|
|
13708
13724
|
}
|
|
13709
|
-
function
|
|
13725
|
+
function U_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, beaconSyncVoiceTranscript: d, widgetPosition: f = "bottom-right", voiceEndCounter: h, websiteName: v, voiceFirstMessage: y, captureVisitorEmail: b, emailRequired: x, emailCaptureEnabled: S = !0, listeningLabel: C = "Listening...", thinkingLabel: w = "Thinking...", enterChatModeLabel: T = "Enter Chat Mode", endConversationLabel: E = "End Conversation" }) {
|
|
13710
13726
|
c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
|
|
13711
|
-
let [D, O] = m("idle"), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(() =>
|
|
13727
|
+
let [D, O] = m("idle"), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(() => ce(i) === "auto"), M = () => {
|
|
13712
13728
|
let e = ne ? "ask" : "auto";
|
|
13713
|
-
|
|
13714
|
-
}, [
|
|
13715
|
-
|
|
13729
|
+
le(i, e), j(e === "auto");
|
|
13730
|
+
}, [re, ie] = m(!1), [ae, N] = m(""), [oe, se] = m(""), P = p(!1), F = p(!1), ue = p(null), de = p(0), fe = p(""), pe = p(!1), me = p(0), he = p(!1), ge = p(!1), _e = p(!1), ve = p([]), ye = p(null), be = p(""), xe = p(null), I = (e) => {
|
|
13731
|
+
he.current = e, e || (ge.current = !1), R.current?.setWalkthroughActive?.(e);
|
|
13716
13732
|
};
|
|
13717
|
-
|
|
13718
|
-
if (
|
|
13733
|
+
xe.current = async () => {
|
|
13734
|
+
if (ge.current) return;
|
|
13719
13735
|
let e = typeof window < "u" ? window.location.pathname : null;
|
|
13720
|
-
if (e &&
|
|
13721
|
-
console.log("[FlowEngage] walkthrough ended — visitor left " +
|
|
13736
|
+
if (e && ye.current && e !== ye.current) {
|
|
13737
|
+
console.log("[FlowEngage] walkthrough ended — visitor left " + ye.current), ye.current = null, ve.current = [], I(!1);
|
|
13722
13738
|
return;
|
|
13723
13739
|
}
|
|
13724
|
-
let t =
|
|
13725
|
-
|
|
13726
|
-
let n =
|
|
13740
|
+
let t = ve.current;
|
|
13741
|
+
L.current += 1;
|
|
13742
|
+
let n = L.current, r = t[n];
|
|
13727
13743
|
if (!r) {
|
|
13728
|
-
if (
|
|
13744
|
+
if (I(!1), t.length) R.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
|
|
13729
13745
|
else if (n === 0) {
|
|
13730
13746
|
let e = "";
|
|
13731
13747
|
try {
|
|
13732
|
-
let t = await
|
|
13748
|
+
let t = await Se.current?.["fwh-read-content-mvp"]?.({});
|
|
13733
13749
|
typeof t == "string" && t && !/^Could not/i.test(t) && (e = t.slice(0, 2800));
|
|
13734
13750
|
} catch {}
|
|
13735
|
-
|
|
13751
|
+
R.current?.sendUserMessage?.(e ? `Give the visitor a complete spoken overview of this page in 4-6 sentences, based ONLY on this page content:\n"""${e}"""\nThen ask which part they'd like to hear more about. Do not call any tool.` : "Give the visitor a complete spoken overview of this page in 4-6 sentences based on what you know about it, then ask which part they'd like to hear more about. Do not call any tool.", { suppressQuestion: !0 });
|
|
13736
13752
|
}
|
|
13737
13753
|
return;
|
|
13738
13754
|
}
|
|
13739
13755
|
try {
|
|
13740
|
-
await
|
|
13756
|
+
await Se.current?.highlightOnPage?.({ section_text: r });
|
|
13741
13757
|
} catch (e) {
|
|
13742
13758
|
console.warn("[FlowEngage] walkthrough highlight failed:", e?.message || e);
|
|
13743
13759
|
}
|
|
13744
13760
|
console.debug(`[FlowEngage] walkthrough step ${n + 1}/${t.length}: ${r}`);
|
|
13745
13761
|
let i = "";
|
|
13746
13762
|
try {
|
|
13747
|
-
let e = await
|
|
13763
|
+
let e = await Se.current?.["fwh-read-content-mvp"]?.({ section_text: r });
|
|
13748
13764
|
typeof e == "string" && e && !/^Could not/i.test(e) && (i = e.slice(0, 2500));
|
|
13749
13765
|
} catch {}
|
|
13750
|
-
|
|
13766
|
+
R.current?.sendUserMessage?.(`Describe the section titled "${r}".` + (i ? ` Its content:\n"""${i}"""` : ""), { suppressQuestion: !0 });
|
|
13751
13767
|
};
|
|
13752
|
-
let
|
|
13768
|
+
let L = p(0), R = p(null), Se = p(null), Ce = p(""), we = p(async () => {}), Oe = p(!1), Ae = p(!1), je = p(!1), Me = p(!1), Ne = p("minimized"), Fe = p(null), Ie = p(null), z = p(null), Re = p(0), ze = p(!1), Be = p("idle"), Ve = p(null), B = p(!1), He = p(null), Ue = o((e = "minimized") => {
|
|
13753
13769
|
console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
|
|
13754
13770
|
destination: e,
|
|
13755
13771
|
stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
|
|
13756
|
-
}),
|
|
13757
|
-
|
|
13772
|
+
}), Ne.current = e, Me.current = !0, queueMicrotask(() => {
|
|
13773
|
+
Oe.current || (Oe.current = !0, we.current?.());
|
|
13758
13774
|
});
|
|
13759
13775
|
}, [l]), V = o(() => {
|
|
13760
|
-
|
|
13776
|
+
ue.current &&= (clearTimeout(ue.current), null);
|
|
13761
13777
|
}, []);
|
|
13762
13778
|
c(() => {
|
|
13763
13779
|
if (x) {
|
|
13764
|
-
|
|
13780
|
+
P.current = !1;
|
|
13765
13781
|
return;
|
|
13766
13782
|
}
|
|
13767
|
-
if (
|
|
13768
|
-
|
|
13769
|
-
let e =
|
|
13770
|
-
|
|
13783
|
+
if (P.current = !0, F.current = !1, ie(!1), V(), pe.current) {
|
|
13784
|
+
pe.current = !1, R.current?.setMicMuted?.(!1);
|
|
13785
|
+
let e = fe.current;
|
|
13786
|
+
fe.current = "", R.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && R.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
|
|
13771
13787
|
}
|
|
13772
|
-
|
|
13788
|
+
R.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.");
|
|
13773
13789
|
}, [x, V]);
|
|
13774
|
-
let We = /(
|
|
13775
|
-
V(),
|
|
13776
|
-
if (!(!
|
|
13777
|
-
|
|
13790
|
+
let We = /(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i, Ge = /^((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, Ke = /(would you like (me )?to take you|shall i take you|want me to take you|would you like to (go|explore|visit|see)|take you there)/i, qe = /^((uh+|um+|oh|ah|so|well)[,.\s]+)*(cool|nice|great|awesome|wow|lovely|perfect|got it|gotcha|i see|understood|makes sense|interesting|right|alright|sounds good|mm+-?hmm+|hmm+|k)[\s.!,]*$/i, Je = (e) => String(e || "").replace(/[\s.,!?]*((uh+|um+|er+|hmm+|mm+)[\s.,!?]*)+$/i, "").trim(), Ye = o(() => {
|
|
13791
|
+
V(), ue.current = setTimeout(() => {
|
|
13792
|
+
if (!(!F.current || P.current)) if (de.current < 3) {
|
|
13793
|
+
de.current += 1;
|
|
13778
13794
|
try {
|
|
13779
|
-
|
|
13795
|
+
R.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
|
|
13780
13796
|
} catch {}
|
|
13781
|
-
|
|
13797
|
+
Ye();
|
|
13782
13798
|
} else {
|
|
13783
13799
|
try {
|
|
13784
|
-
|
|
13800
|
+
R.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");
|
|
13785
13801
|
} catch {}
|
|
13786
|
-
|
|
13802
|
+
F.current = !1, ie(!1), V(), ze.current = !0;
|
|
13787
13803
|
}
|
|
13788
13804
|
}, 1e4);
|
|
13789
|
-
}, [V]),
|
|
13790
|
-
|
|
13805
|
+
}, [V]), Xe = o(async (e) => {
|
|
13806
|
+
Me.current = !0;
|
|
13791
13807
|
try {
|
|
13792
13808
|
Pn();
|
|
13793
13809
|
} catch {}
|
|
@@ -13795,12 +13811,12 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13795
13811
|
Jh();
|
|
13796
13812
|
} catch {}
|
|
13797
13813
|
if (i) try {
|
|
13798
|
-
|
|
13814
|
+
Le(i);
|
|
13799
13815
|
} catch {}
|
|
13800
13816
|
try {
|
|
13801
|
-
await
|
|
13817
|
+
await R.current?.endSession?.();
|
|
13802
13818
|
} catch {}
|
|
13803
|
-
let t =
|
|
13819
|
+
let t = Fe.current, n = Ie.current;
|
|
13804
13820
|
if (t && s && a) {
|
|
13805
13821
|
let e = n ? Math.round((Date.now() - n) / 1e3) : 0;
|
|
13806
13822
|
fetch(`${a}/api/voice/save-chat-recording`, {
|
|
@@ -13814,8 +13830,8 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13814
13830
|
})
|
|
13815
13831
|
}).catch((e) => console.warn("[FlowEngage] save-chat-recording failed:", e.message));
|
|
13816
13832
|
}
|
|
13817
|
-
if (
|
|
13818
|
-
|
|
13833
|
+
if (Fe.current = null, Ie.current = null, R.current = null, O("idle"), A(!1), Oe.current = !1, Pr(), i) try {
|
|
13834
|
+
De(i);
|
|
13819
13835
|
} catch {}
|
|
13820
13836
|
typeof u == "function" && await u(l.current), e?.();
|
|
13821
13837
|
}, [
|
|
@@ -13825,8 +13841,8 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13825
13841
|
s,
|
|
13826
13842
|
a
|
|
13827
13843
|
]);
|
|
13828
|
-
|
|
13829
|
-
|
|
13844
|
+
we.current = () => Xe(Ne.current === "chat" ? t : n), c(() => {
|
|
13845
|
+
Ae.current = k;
|
|
13830
13846
|
}, [k]), c(() => {
|
|
13831
13847
|
h && Ue("chat");
|
|
13832
13848
|
}, [h]), c(() => {
|
|
@@ -13838,13 +13854,13 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13838
13854
|
}
|
|
13839
13855
|
try {
|
|
13840
13856
|
if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
|
|
13841
|
-
l.current = [],
|
|
13857
|
+
l.current = [], Ce.current = "", Oe.current = !1, je.current = !1, Me.current = !1, Ne.current = "minimized", Nr({ onBeforeNavigate: () => {
|
|
13842
13858
|
if (i && l.current.length > 0) try {
|
|
13843
13859
|
let e = o_(l.current);
|
|
13844
|
-
e &&
|
|
13860
|
+
e && Te(i, e);
|
|
13845
13861
|
} catch {}
|
|
13846
13862
|
if (!$n()) {
|
|
13847
|
-
let e =
|
|
13863
|
+
let e = Fe.current, t = Ie.current;
|
|
13848
13864
|
if (e && s && a) try {
|
|
13849
13865
|
let n = t ? Math.round((Date.now() - t) / 1e3) : 0, r = JSON.stringify({
|
|
13850
13866
|
chatId: s,
|
|
@@ -13857,31 +13873,31 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13857
13873
|
headers: { "Content-Type": "application/json" },
|
|
13858
13874
|
body: r,
|
|
13859
13875
|
keepalive: !0
|
|
13860
|
-
}).catch(() => {}),
|
|
13876
|
+
}).catch(() => {}), Fe.current = null, Ie.current = null;
|
|
13861
13877
|
} catch {}
|
|
13862
13878
|
}
|
|
13863
|
-
|
|
13879
|
+
ke();
|
|
13864
13880
|
} });
|
|
13865
13881
|
let t = k_(E_({
|
|
13866
13882
|
siteId: i || null,
|
|
13867
13883
|
apiBaseUrl: a || null,
|
|
13868
13884
|
chatId: s || null,
|
|
13869
|
-
getLastUserVoiceText: () =>
|
|
13885
|
+
getLastUserVoiceText: () => Ce.current,
|
|
13870
13886
|
beaconSyncFullVoiceHistory: () => d?.(l.current),
|
|
13871
|
-
isWalkthroughActive: () =>
|
|
13887
|
+
isWalkthroughActive: () => he.current && !ge.current,
|
|
13872
13888
|
requestEndSession: () => {
|
|
13873
|
-
|
|
13889
|
+
ze.current = !0;
|
|
13874
13890
|
},
|
|
13875
13891
|
requestEmailCollection: () => {
|
|
13876
|
-
S && (
|
|
13892
|
+
S && (P.current || F.current || (F.current = !0, de.current = 0, ie(!0), Ye()));
|
|
13877
13893
|
}
|
|
13878
|
-
})), n = !!(i ?
|
|
13894
|
+
})), n = !!(i ? Ee(i) : null)?.transcript, r = i ? Le(i) : null, u = !!r, m = typeof window < "u" ? window.location.pathname : "/", h = typeof document < "u" ? document.title : "", g = m.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i, "") || "/", _ = g === "/" || g === "", b = {
|
|
13879
13895
|
apiBaseUrl: a,
|
|
13880
13896
|
siteId: i,
|
|
13881
13897
|
chatId: s,
|
|
13882
13898
|
clientTools: t
|
|
13883
13899
|
};
|
|
13884
|
-
|
|
13900
|
+
Se.current = t;
|
|
13885
13901
|
let C = (m.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()), w = "";
|
|
13886
13902
|
h && h.includes("|") && (w = h.split("|").map((e) => e.trim()).filter(Boolean).reduce((e, t) => e.length <= t.length ? e : t));
|
|
13887
13903
|
let T = w || C || "", E = T ? `the ${T} page` : "this page", D = (() => {
|
|
@@ -13897,21 +13913,24 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13897
13913
|
let e = v || "";
|
|
13898
13914
|
b.greeting = y || (_ ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to ${E}! How may I help you?`), _ || console.log(`[FlowEngage] 🏠 Page-context greeting: "${T}" for ${m}`);
|
|
13899
13915
|
}
|
|
13900
|
-
let k = !1, ee = !1, te = S && !!x && !
|
|
13916
|
+
let k = !1, ee = !1, te = S && !!x && !_e.current, ne = await kh.startSession({
|
|
13901
13917
|
...b,
|
|
13902
13918
|
onConnect: ({ conversationId: e }) => {
|
|
13903
|
-
|
|
13919
|
+
Fe.current = e, Ie.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
|
|
13904
13920
|
},
|
|
13905
13921
|
onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
|
|
13906
13922
|
onSessionInfo: ({ emailOnFile: e }) => {
|
|
13907
|
-
|
|
13923
|
+
_e.current = !!e, e && (P.current = !0, F.current = !1, ie(!1), V(), console.log("[FlowEngage] email already on file per server — gate disabled"));
|
|
13908
13924
|
},
|
|
13909
13925
|
onAgentTurnEnd: () => {
|
|
13910
|
-
e ||
|
|
13926
|
+
e || he.current && (ge.current || pe.current || setTimeout(() => xe.current?.(), 250));
|
|
13911
13927
|
},
|
|
13912
13928
|
onSessionEnding: () => {
|
|
13913
13929
|
e || Ue("minimized");
|
|
13914
13930
|
},
|
|
13931
|
+
onStartWalkthrough: () => {
|
|
13932
|
+
e || (typeof window < "u" && (window.__fe_user_nav_during_speech = null), I(!0), ge.current = !1, me.current = 0, L.current = -1, ve.current = O_(), ye.current = typeof window < "u" ? window.location.pathname : null, console.log(`[FlowEngage] walkthrough started — ${ve.current.length} sections on this page`), xe.current?.());
|
|
13933
|
+
},
|
|
13915
13934
|
onPanel: ({ title: t, items: n }) => {
|
|
13916
13935
|
e || Kh(n, {
|
|
13917
13936
|
title: t || "Products",
|
|
@@ -13922,99 +13941,97 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
13922
13941
|
onModeChange: ({ mode: t, tentative: n }) => {
|
|
13923
13942
|
if (!e) {
|
|
13924
13943
|
if (t === "speaking") {
|
|
13925
|
-
|
|
13944
|
+
Ve.current &&= (clearTimeout(Ve.current), null), He.current &&= (clearTimeout(He.current), null), O("speaking"), Be.current = "speaking", B.current = !1;
|
|
13926
13945
|
return;
|
|
13927
13946
|
}
|
|
13928
13947
|
if (t === "user-speaking") {
|
|
13929
|
-
if (
|
|
13948
|
+
if (F.current && !P.current && Ye(), He.current &&= (clearTimeout(He.current), null), Be.current === "speaking") return;
|
|
13930
13949
|
try {
|
|
13931
13950
|
Pn();
|
|
13932
13951
|
} catch {}
|
|
13933
|
-
|
|
13952
|
+
Ve.current &&= (clearTimeout(Ve.current), null), Be.current !== "listening" && (O("listening"), Be.current = "listening");
|
|
13934
13953
|
return;
|
|
13935
13954
|
}
|
|
13936
13955
|
if (t === "thinking") {
|
|
13937
|
-
if (
|
|
13938
|
-
O("thinking"),
|
|
13939
|
-
He.current = null, !(e ||
|
|
13956
|
+
if (Ve.current &&= (clearTimeout(Ve.current), null), He.current &&= (clearTimeout(He.current), null), Be.current === "speaking") return;
|
|
13957
|
+
O("thinking"), Be.current = "thinking", n && (He.current = setTimeout(() => {
|
|
13958
|
+
He.current = null, !(e || Be.current !== "thinking") && (Be.current = "listening", O("listening"));
|
|
13940
13959
|
}, 4e3));
|
|
13941
13960
|
return;
|
|
13942
13961
|
}
|
|
13943
|
-
if (
|
|
13944
|
-
|
|
13962
|
+
if (Be.current = "listening", ze.current) {
|
|
13963
|
+
ze.current = !1, Ue();
|
|
13945
13964
|
return;
|
|
13946
13965
|
}
|
|
13947
|
-
if (te && !ee && !
|
|
13966
|
+
if (te && !ee && !P.current && !_e.current) {
|
|
13948
13967
|
ee = !0;
|
|
13949
13968
|
try {
|
|
13950
|
-
|
|
13969
|
+
R.current?.sendContextualUpdate?.("The visitor hasn't given their email yet; the app will ask for it when they first speak.");
|
|
13951
13970
|
} catch {}
|
|
13952
13971
|
}
|
|
13953
|
-
|
|
13954
|
-
e ||
|
|
13972
|
+
Ve.current && clearTimeout(Ve.current), Ve.current = setTimeout(() => {
|
|
13973
|
+
e || Be.current !== "speaking" && (B.current || (Ve.current = null, Be.current = "listening", O("listening")));
|
|
13955
13974
|
}, 1200);
|
|
13956
13975
|
}
|
|
13957
13976
|
},
|
|
13958
13977
|
onMessage: (t) => {
|
|
13959
|
-
if (e ||
|
|
13978
|
+
if (e || pe.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
|
|
13960
13979
|
let n = t.role === "user" && /^(Describe the section titled "|\[SYSTEM:|Give the visitor a complete spoken overview|That was the last section)/.test(String(t.message || "").trim());
|
|
13961
13980
|
if (t.role === "user" && !n) try {
|
|
13962
13981
|
Jh();
|
|
13963
13982
|
} catch {}
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
let e = String(t.message || "").trim(), n = Ye(e), r = (e) => !!e && (Ke.test(e) || Je.test(e));
|
|
13968
|
-
qe.test(xe.current || "") ? (console.log("[FlowEngage] walkthrough ended — visitor accepted a navigation offer"), be.current = null, ye.current = [], F(!1)) : !n || r(e) || r(n) ? _e.current && (_e.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => Se.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), be.current = null, ye.current = [], F(!1));
|
|
13983
|
+
if (!n && t.role === "user" && he.current) {
|
|
13984
|
+
let e = String(t.message || "").trim(), n = Je(e), r = (e) => !!e && (Ge.test(e) || qe.test(e));
|
|
13985
|
+
Ke.test(be.current || "") ? (console.log("[FlowEngage] walkthrough ended — visitor accepted a navigation offer"), ye.current = null, ve.current = [], I(!1)) : !n || r(e) || r(n) ? ge.current && (ge.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => xe.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), ye.current = null, ve.current = [], I(!1));
|
|
13969
13986
|
}
|
|
13970
|
-
if (t.role !== "user" && !n && (
|
|
13971
|
-
let e =
|
|
13972
|
-
!e ||
|
|
13987
|
+
if (t.role !== "user" && !n && (be.current = String(t.message || "")), t.role !== "user" && We.test(String(t.message || ""))) {
|
|
13988
|
+
let e = ve.current.length;
|
|
13989
|
+
!e || L.current >= e - 1 ? I(!1) : console.debug(`[FlowEngage] agent claimed completion at step ${L.current + 1}/${e} — ignoring, tour continues`);
|
|
13973
13990
|
}
|
|
13974
|
-
let
|
|
13975
|
-
if (
|
|
13976
|
-
if (
|
|
13977
|
-
sender:
|
|
13978
|
-
message:
|
|
13991
|
+
let r = t.role === "user" ? "user" : "bot", a = t.message || t.text || t.content || "";
|
|
13992
|
+
if (a) {
|
|
13993
|
+
if (r === "user" && (Ce.current = a, typeof window < "u" && (window.__fe_user_nav_during_speech = null), B.current = !0, Ve.current &&= (clearTimeout(Ve.current), null), Be.current !== "speaking" && (O("thinking"), Be.current = "thinking"), te && !k && !P.current && !_e.current && (k = !0, fe.current = a, pe.current = !0, R.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), R.current?.setMicMuted?.(!0), F.current || (F.current = !0, de.current = 0, ie(!0), Ye()))), l.current = [...l.current, {
|
|
13994
|
+
sender: r,
|
|
13995
|
+
message: a,
|
|
13979
13996
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13980
13997
|
debug: t.debug
|
|
13981
13998
|
}], i) try {
|
|
13982
13999
|
let e = o_(l.current);
|
|
13983
|
-
e &&
|
|
14000
|
+
e && Te(i, e);
|
|
13984
14001
|
} catch {}
|
|
13985
|
-
if (
|
|
13986
|
-
|
|
14002
|
+
if (z_(r, a)) {
|
|
14003
|
+
ze.current = !0;
|
|
13987
14004
|
return;
|
|
13988
14005
|
}
|
|
13989
|
-
|
|
14006
|
+
Ae.current && r === "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(a) && (Re.current += 1, Re.current >= 5 && Ue("minimized"));
|
|
13990
14007
|
}
|
|
13991
14008
|
},
|
|
13992
14009
|
onError: (t) => {
|
|
13993
|
-
if (!e && !
|
|
13994
|
-
|
|
14010
|
+
if (!e && !Me.current && !je.current && !Pe()) {
|
|
14011
|
+
je.current = !0, console.error("[FlowEngageVoiceCall] session:error", {
|
|
13995
14012
|
message: t?.message,
|
|
13996
14013
|
name: t?.name,
|
|
13997
14014
|
raw: t
|
|
13998
14015
|
});
|
|
13999
14016
|
try {
|
|
14000
|
-
|
|
14017
|
+
R.current?.setMicMuted?.(!0);
|
|
14001
14018
|
} catch {}
|
|
14002
14019
|
A(!0), O("error"), Ue("chat");
|
|
14003
14020
|
}
|
|
14004
14021
|
},
|
|
14005
14022
|
onDisconnect: (t) => {
|
|
14006
|
-
if (e ||
|
|
14023
|
+
if (e || Me.current || je.current || Pe()) return;
|
|
14007
14024
|
let n = l.current?.length || 0;
|
|
14008
14025
|
console.warn("[FlowEngageVoiceCall] session:disconnected", {
|
|
14009
14026
|
historyCount: n,
|
|
14010
14027
|
reason: t?.reason,
|
|
14011
14028
|
closeCode: t?.context?.code,
|
|
14012
14029
|
closeReason: t?.context?.reason || t?.message,
|
|
14013
|
-
lastUserText:
|
|
14014
|
-
wasMuted:
|
|
14015
|
-
}),
|
|
14030
|
+
lastUserText: Ce.current || "",
|
|
14031
|
+
wasMuted: Ae.current
|
|
14032
|
+
}), je.current = !0;
|
|
14016
14033
|
try {
|
|
14017
|
-
|
|
14034
|
+
R.current?.setMicMuted?.(!0);
|
|
14018
14035
|
} catch {}
|
|
14019
14036
|
A(!0), Ue("chat");
|
|
14020
14037
|
}
|
|
@@ -14023,7 +14040,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14023
14040
|
console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), ne.endSession().catch(() => {});
|
|
14024
14041
|
return;
|
|
14025
14042
|
}
|
|
14026
|
-
o = ne,
|
|
14043
|
+
o = ne, R.current = ne, O("listening");
|
|
14027
14044
|
try {
|
|
14028
14045
|
sessionStorage.setItem(`el_conv_${i}`, ne.getId());
|
|
14029
14046
|
} catch {}
|
|
@@ -14038,7 +14055,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14038
14055
|
let e = "#flowengage-root, .flowengage-shell, .flowengage-widget-root", t = document.querySelector("main, [role='main']") || document.body, n = Array.from(t.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);
|
|
14039
14056
|
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 && (r = [...new Set(n)].slice(0, 15).join(" | "));
|
|
14040
14057
|
} catch {}
|
|
14041
|
-
x || ne.sendContextualUpdate("The visitor's email is already on file from an earlier session."), ne
|
|
14058
|
+
x || ne.sendContextualUpdate("The visitor's email is already on file from an earlier session."), M_(ne, e, r, n);
|
|
14042
14059
|
} catch {}
|
|
14043
14060
|
if (typeof window < "u") {
|
|
14044
14061
|
let t = window.location.pathname, n = Date.now(), r = (e) => {
|
|
@@ -14071,7 +14088,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14071
14088
|
if (o) {
|
|
14072
14089
|
typeof window < "u" && (window.__fe_agent_nav = null), console.log(`[FlowEngage] agent-driven navigation settled: "${s}" → "${i}"`);
|
|
14073
14090
|
try {
|
|
14074
|
-
|
|
14091
|
+
M_(R.current, c, u);
|
|
14075
14092
|
} catch {}
|
|
14076
14093
|
return;
|
|
14077
14094
|
}
|
|
@@ -14083,7 +14100,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14083
14100
|
ts: Date.now()
|
|
14084
14101
|
}), console.log(`[FlowEngage] visitor navigation detected: "${s}" → "${i}" (agent target: ${D || "none"})`);
|
|
14085
14102
|
try {
|
|
14086
|
-
|
|
14103
|
+
M_(R.current, c, u, null, f);
|
|
14087
14104
|
} catch {}
|
|
14088
14105
|
};
|
|
14089
14106
|
c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
|
|
@@ -14091,7 +14108,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14091
14108
|
}, p = () => setTimeout(i, 50), window.addEventListener("popstate", p);
|
|
14092
14109
|
}
|
|
14093
14110
|
} catch (r) {
|
|
14094
|
-
e || (console.error("[FlowEngage] startSession failed", r), r.message && r.message.includes("Too many voice sessions") ? (alert(r.message), n && n("minimized")) : (O("error"),
|
|
14111
|
+
e || (console.error("[FlowEngage] startSession failed", r), r.message && r.message.includes("Too many voice sessions") ? (alert(r.message), n && n("minimized")) : (O("error"), Ne.current = "chat", window.setTimeout(() => {
|
|
14095
14112
|
e || t?.();
|
|
14096
14113
|
}, 0)));
|
|
14097
14114
|
}
|
|
@@ -14100,15 +14117,15 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14100
14117
|
agentId: r,
|
|
14101
14118
|
siteId: i,
|
|
14102
14119
|
apiBaseUrl: a
|
|
14103
|
-
}), e = !0,
|
|
14120
|
+
}), e = !0, Me.current = !0;
|
|
14104
14121
|
try {
|
|
14105
14122
|
Pn();
|
|
14106
14123
|
} catch {}
|
|
14107
14124
|
if (i) try {
|
|
14108
|
-
|
|
14125
|
+
Le(i);
|
|
14109
14126
|
} catch {}
|
|
14110
|
-
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Pr(),
|
|
14111
|
-
let t = o ||
|
|
14127
|
+
typeof window < "u" && (window.__fe_user_nav_during_speech = null), Pr(), Ve.current &&= (clearTimeout(Ve.current), null), He.current &&= (clearTimeout(He.current), null), ue.current &&= (clearTimeout(ue.current), null), B.current = !1, Be.current = "idle", c && typeof window < "u" && (window.history.pushState = c), p && typeof window < "u" && window.removeEventListener("popstate", p);
|
|
14128
|
+
let t = o || R.current, n = Fe.current, d = Ie.current;
|
|
14112
14129
|
if (t?.endSession?.().catch(() => {}), n && s && a) {
|
|
14113
14130
|
let e = d ? Math.round((Date.now() - d) / 1e3) : 0, t = JSON.stringify({
|
|
14114
14131
|
chatId: s,
|
|
@@ -14121,7 +14138,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14121
14138
|
headers: { "Content-Type": "application/json" },
|
|
14122
14139
|
body: t,
|
|
14123
14140
|
keepalive: !0
|
|
14124
|
-
}).catch(() => {}),
|
|
14141
|
+
}).catch(() => {}), Fe.current = null, Ie.current = null;
|
|
14125
14142
|
}
|
|
14126
14143
|
typeof u == "function" && l.current.length > 0 && u(l.current).catch?.(() => {});
|
|
14127
14144
|
};
|
|
@@ -14134,48 +14151,48 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14134
14151
|
if (!ee) return;
|
|
14135
14152
|
let e = (e) => {
|
|
14136
14153
|
let t = e.composedPath?.()?.[0] || e.target;
|
|
14137
|
-
|
|
14154
|
+
z.current && !z.current.contains(t) && te(!1);
|
|
14138
14155
|
};
|
|
14139
14156
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
14140
14157
|
}, [ee]);
|
|
14141
|
-
let
|
|
14142
|
-
if (
|
|
14158
|
+
let Ze = async () => {
|
|
14159
|
+
if (R.current) try {
|
|
14143
14160
|
if (k) {
|
|
14144
|
-
|
|
14161
|
+
Re.current = 0, await R.current.setMicMuted?.(!1), A(!1);
|
|
14145
14162
|
try {
|
|
14146
|
-
|
|
14163
|
+
R.current.sendContextualUpdate?.("[MIC] The visitor unmuted their microphone.");
|
|
14147
14164
|
} catch {}
|
|
14148
14165
|
} else {
|
|
14149
|
-
|
|
14166
|
+
Re.current = 0, await R.current.setMicMuted?.(!0), A(!0);
|
|
14150
14167
|
try {
|
|
14151
|
-
|
|
14168
|
+
R.current.sendContextualUpdate?.("[MIC] The visitor muted their microphone.");
|
|
14152
14169
|
} catch {}
|
|
14153
14170
|
}
|
|
14154
14171
|
} catch {}
|
|
14155
|
-
},
|
|
14172
|
+
}, H = o(async (e) => {
|
|
14156
14173
|
e?.preventDefault?.();
|
|
14157
|
-
let t =
|
|
14174
|
+
let t = ae.trim().toLowerCase();
|
|
14158
14175
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
|
|
14159
|
-
|
|
14176
|
+
se("Please enter a valid email address.");
|
|
14160
14177
|
return;
|
|
14161
14178
|
}
|
|
14162
|
-
|
|
14179
|
+
se(""), P.current = !0, F.current = !1, V(), ie(!1), N(""), pe.current = !1;
|
|
14163
14180
|
try {
|
|
14164
14181
|
typeof b == "function" && await b(t);
|
|
14165
14182
|
} catch {}
|
|
14166
|
-
|
|
14167
|
-
let n =
|
|
14168
|
-
|
|
14183
|
+
R.current?.setMicMuted?.(!1);
|
|
14184
|
+
let n = fe.current;
|
|
14185
|
+
fe.current = "";
|
|
14169
14186
|
try {
|
|
14170
|
-
|
|
14187
|
+
R.current?.injectAgentSpeech?.("Thank you for submitting your email."), R.current?.sendUserMessage?.(n || "The visitor's email is on file. Carry on helping them and never ask for it again.");
|
|
14171
14188
|
} catch {}
|
|
14172
14189
|
}, [
|
|
14173
|
-
|
|
14190
|
+
ae,
|
|
14174
14191
|
b,
|
|
14175
14192
|
V
|
|
14176
|
-
]),
|
|
14193
|
+
]), U = Array.isArray(e) && e[0] || "#3B82F6";
|
|
14177
14194
|
return /* @__PURE__ */ _("div", {
|
|
14178
|
-
ref:
|
|
14195
|
+
ref: z,
|
|
14179
14196
|
style: {
|
|
14180
14197
|
position: "relative",
|
|
14181
14198
|
display: "flex",
|
|
@@ -14185,8 +14202,8 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14185
14202
|
animation: "fe-orb-slide-up 0.42s cubic-bezier(0.16,1,0.3,1)"
|
|
14186
14203
|
},
|
|
14187
14204
|
children: [
|
|
14188
|
-
|
|
14189
|
-
onSubmit:
|
|
14205
|
+
re && /* @__PURE__ */ _("form", {
|
|
14206
|
+
onSubmit: H,
|
|
14190
14207
|
style: {
|
|
14191
14208
|
width: "270px",
|
|
14192
14209
|
maxWidth: "calc(100vw - 40px)",
|
|
@@ -14217,9 +14234,9 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14217
14234
|
inputMode: "email",
|
|
14218
14235
|
autoComplete: "email",
|
|
14219
14236
|
autoFocus: !0,
|
|
14220
|
-
value:
|
|
14237
|
+
value: ae,
|
|
14221
14238
|
onChange: (e) => {
|
|
14222
|
-
|
|
14239
|
+
N(e.target.value), oe && se("");
|
|
14223
14240
|
},
|
|
14224
14241
|
placeholder: "you@example.com",
|
|
14225
14242
|
style: {
|
|
@@ -14227,33 +14244,33 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14227
14244
|
boxSizing: "border-box",
|
|
14228
14245
|
padding: "10px 12px",
|
|
14229
14246
|
borderRadius: "10px",
|
|
14230
|
-
border:
|
|
14247
|
+
border: oe ? "1.5px solid #ef4444" : "1.5px solid #4b5563",
|
|
14231
14248
|
background: "#1f2937",
|
|
14232
14249
|
color: "white",
|
|
14233
14250
|
fontSize: "14px",
|
|
14234
14251
|
outline: "none"
|
|
14235
14252
|
}
|
|
14236
14253
|
}),
|
|
14237
|
-
|
|
14254
|
+
oe && /* @__PURE__ */ g("span", {
|
|
14238
14255
|
style: {
|
|
14239
14256
|
color: "#f87171",
|
|
14240
14257
|
fontSize: "12px"
|
|
14241
14258
|
},
|
|
14242
|
-
children:
|
|
14259
|
+
children: oe
|
|
14243
14260
|
}),
|
|
14244
14261
|
/* @__PURE__ */ g("button", {
|
|
14245
14262
|
type: "submit",
|
|
14246
|
-
disabled: !
|
|
14263
|
+
disabled: !ae.trim(),
|
|
14247
14264
|
style: {
|
|
14248
14265
|
width: "100%",
|
|
14249
14266
|
padding: "10px 12px",
|
|
14250
14267
|
borderRadius: "10px",
|
|
14251
14268
|
border: "none",
|
|
14252
|
-
background:
|
|
14269
|
+
background: ae.trim() ? U : "#374151",
|
|
14253
14270
|
color: "white",
|
|
14254
14271
|
fontSize: "14px",
|
|
14255
14272
|
fontWeight: 600,
|
|
14256
|
-
cursor:
|
|
14273
|
+
cursor: ae.trim() ? "pointer" : "default",
|
|
14257
14274
|
transition: "background 0.2s ease"
|
|
14258
14275
|
},
|
|
14259
14276
|
children: "Submit"
|
|
@@ -14295,7 +14312,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14295
14312
|
},
|
|
14296
14313
|
children: "Muted"
|
|
14297
14314
|
}),
|
|
14298
|
-
/* @__PURE__ */ g(
|
|
14315
|
+
/* @__PURE__ */ g(B_, {
|
|
14299
14316
|
size: 72,
|
|
14300
14317
|
voiceState: D,
|
|
14301
14318
|
isMuted: k,
|
|
@@ -14318,7 +14335,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14318
14335
|
alignItems: "center"
|
|
14319
14336
|
},
|
|
14320
14337
|
children: [/* @__PURE__ */ g("button", {
|
|
14321
|
-
onClick:
|
|
14338
|
+
onClick: Ze,
|
|
14322
14339
|
title: k ? "Unmute" : "Mute",
|
|
14323
14340
|
style: {
|
|
14324
14341
|
width: "24px",
|
|
@@ -14413,7 +14430,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14413
14430
|
children: [
|
|
14414
14431
|
/* @__PURE__ */ _("button", {
|
|
14415
14432
|
onClick: () => {
|
|
14416
|
-
te(!1),
|
|
14433
|
+
te(!1), Ne.current = "chat", Xe(t);
|
|
14417
14434
|
},
|
|
14418
14435
|
style: {
|
|
14419
14436
|
display: "flex",
|
|
@@ -14441,7 +14458,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14441
14458
|
children: [/* @__PURE__ */ g(vg, {}), T]
|
|
14442
14459
|
}),
|
|
14443
14460
|
i && /* @__PURE__ */ _("button", {
|
|
14444
|
-
onClick: () =>
|
|
14461
|
+
onClick: () => M(),
|
|
14445
14462
|
style: {
|
|
14446
14463
|
display: "flex",
|
|
14447
14464
|
alignItems: "center",
|
|
@@ -14517,7 +14534,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14517
14534
|
}),
|
|
14518
14535
|
/* @__PURE__ */ _("button", {
|
|
14519
14536
|
onClick: () => {
|
|
14520
|
-
te(!1),
|
|
14537
|
+
te(!1), Ne.current = "minimized", Xe(n);
|
|
14521
14538
|
},
|
|
14522
14539
|
style: {
|
|
14523
14540
|
display: "flex",
|
|
@@ -14594,7 +14611,7 @@ function H_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
14594
14611
|
]
|
|
14595
14612
|
});
|
|
14596
14613
|
}
|
|
14597
|
-
function
|
|
14614
|
+
function W_({ orbColors: e }) {
|
|
14598
14615
|
let t = Array.isArray(e) && e.length > 0 ? e : [
|
|
14599
14616
|
"#135bd8",
|
|
14600
14617
|
"#ef334b",
|
|
@@ -14613,7 +14630,7 @@ function U_({ orbColors: e }) {
|
|
|
14613
14630
|
`.replace(/\s+/g, " ").trim()
|
|
14614
14631
|
} });
|
|
14615
14632
|
}
|
|
14616
|
-
var
|
|
14633
|
+
var G_ = () => /* @__PURE__ */ g("div", {
|
|
14617
14634
|
style: {
|
|
14618
14635
|
display: "flex",
|
|
14619
14636
|
marginBottom: "12px",
|
|
@@ -14643,11 +14660,11 @@ var W_ = () => /* @__PURE__ */ g("div", {
|
|
|
14643
14660
|
} }, e))
|
|
14644
14661
|
})
|
|
14645
14662
|
});
|
|
14646
|
-
function
|
|
14647
|
-
let
|
|
14648
|
-
let e =
|
|
14649
|
-
|
|
14650
|
-
}, [
|
|
14663
|
+
function K_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: N, webRTCError: oe, micError: se, setMicError: P, dismissCallError: F, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: _e, onCollapse: ve, onStartVoice: ye, voiceEnabled: be, headerBgColor: xe, onNewChat: I, showPoweredBy: L, privacyPolicyUrl: R, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: we, isClosing: Te }) {
|
|
14664
|
+
let Ee = l.length > 0, De = T || E || w, Oe = !!ue, [ke, Ae] = m(!1), { resolvedConfig: je } = kn(), Me = je?.siteId || null, [Ne, Pe] = m(() => ce(Me) === "auto"), Fe = () => {
|
|
14665
|
+
let e = Ne ? "ask" : "auto";
|
|
14666
|
+
le(Me, e), Pe(e === "auto");
|
|
14667
|
+
}, [Ie, Le] = m(!1), [z, Re] = m([]), [ze, Be] = m(!1), Ve = p(null), [B, He] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Ue, V] = m(0);
|
|
14651
14668
|
c(() => {
|
|
14652
14669
|
if (!s) return;
|
|
14653
14670
|
let e = window.visualViewport;
|
|
@@ -14660,26 +14677,26 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14660
14677
|
};
|
|
14661
14678
|
}, [s]);
|
|
14662
14679
|
let We = s && window.innerHeight - B > 150, Ge = async () => {
|
|
14663
|
-
|
|
14680
|
+
Ae(!1), Le(!0), Be(!0);
|
|
14664
14681
|
try {
|
|
14665
|
-
let e = await
|
|
14666
|
-
e?.data &&
|
|
14682
|
+
let e = await Se();
|
|
14683
|
+
e?.data && Re(e.data);
|
|
14667
14684
|
} catch (e) {
|
|
14668
14685
|
console.error(e);
|
|
14669
14686
|
} finally {
|
|
14670
|
-
|
|
14687
|
+
Be(!1);
|
|
14671
14688
|
}
|
|
14672
14689
|
}, Ke = async (e) => {
|
|
14673
|
-
|
|
14690
|
+
Le(!1), Ce?.(e.chatId);
|
|
14674
14691
|
};
|
|
14675
14692
|
return c(() => {
|
|
14676
|
-
if (!
|
|
14693
|
+
if (!ke) return;
|
|
14677
14694
|
let e = (e) => {
|
|
14678
14695
|
let t = e.composedPath?.()?.[0] || e.target;
|
|
14679
|
-
|
|
14696
|
+
Ve.current && !Ve.current.contains(t) && Ae(!1);
|
|
14680
14697
|
};
|
|
14681
14698
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
14682
|
-
}, [
|
|
14699
|
+
}, [ke]), /* @__PURE__ */ _("div", {
|
|
14683
14700
|
style: s ? {
|
|
14684
14701
|
"--flowengage-primary": n,
|
|
14685
14702
|
"--flowengage-accent": n,
|
|
@@ -14693,7 +14710,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14693
14710
|
display: "flex",
|
|
14694
14711
|
flexDirection: "column",
|
|
14695
14712
|
overflow: "hidden",
|
|
14696
|
-
animation:
|
|
14713
|
+
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)"
|
|
14697
14714
|
} : {
|
|
14698
14715
|
"--flowengage-primary": n,
|
|
14699
14716
|
"--flowengage-accent": n,
|
|
@@ -14706,7 +14723,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14706
14723
|
flexDirection: "column",
|
|
14707
14724
|
overflow: "hidden",
|
|
14708
14725
|
position: "relative",
|
|
14709
|
-
animation:
|
|
14726
|
+
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)"
|
|
14710
14727
|
},
|
|
14711
14728
|
children: [
|
|
14712
14729
|
/* @__PURE__ */ _("div", {
|
|
@@ -14716,7 +14733,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14716
14733
|
alignItems: "center",
|
|
14717
14734
|
columnGap: "14px",
|
|
14718
14735
|
padding: "16px 10px 14px",
|
|
14719
|
-
background:
|
|
14736
|
+
background: xe || "transparent",
|
|
14720
14737
|
flexShrink: 0,
|
|
14721
14738
|
position: "relative",
|
|
14722
14739
|
zIndex: 30
|
|
@@ -14729,7 +14746,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14729
14746
|
alignItems: "center"
|
|
14730
14747
|
},
|
|
14731
14748
|
children: /* @__PURE__ */ g("button", {
|
|
14732
|
-
onClick:
|
|
14749
|
+
onClick: ve,
|
|
14733
14750
|
style: {
|
|
14734
14751
|
width: "40px",
|
|
14735
14752
|
height: "40px",
|
|
@@ -14786,7 +14803,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14786
14803
|
justifyContent: "center",
|
|
14787
14804
|
height: "40px"
|
|
14788
14805
|
},
|
|
14789
|
-
children: i ? /* @__PURE__ */ g(
|
|
14806
|
+
children: i ? /* @__PURE__ */ g(L_, {
|
|
14790
14807
|
logo: i,
|
|
14791
14808
|
style: {
|
|
14792
14809
|
height: "34px",
|
|
@@ -14799,7 +14816,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14799
14816
|
height: "40px",
|
|
14800
14817
|
flexShrink: 0
|
|
14801
14818
|
},
|
|
14802
|
-
children: /* @__PURE__ */ g(
|
|
14819
|
+
children: /* @__PURE__ */ g(R_, { title: e.chatTitle })
|
|
14803
14820
|
})
|
|
14804
14821
|
}), o && /* @__PURE__ */ g("div", {
|
|
14805
14822
|
style: {
|
|
@@ -14831,10 +14848,10 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14831
14848
|
isolation: "isolate",
|
|
14832
14849
|
zIndex: 10
|
|
14833
14850
|
},
|
|
14834
|
-
ref:
|
|
14851
|
+
ref: Ve,
|
|
14835
14852
|
children: [/* @__PURE__ */ g("button", {
|
|
14836
14853
|
type: "button",
|
|
14837
|
-
onClick: () =>
|
|
14854
|
+
onClick: () => Ae((e) => !e),
|
|
14838
14855
|
style: {
|
|
14839
14856
|
width: "40px",
|
|
14840
14857
|
height: "40px",
|
|
@@ -14880,7 +14897,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14880
14897
|
})
|
|
14881
14898
|
]
|
|
14882
14899
|
})
|
|
14883
|
-
}),
|
|
14900
|
+
}), ke && /* @__PURE__ */ _("div", {
|
|
14884
14901
|
style: {
|
|
14885
14902
|
position: "absolute",
|
|
14886
14903
|
top: "34px",
|
|
@@ -14896,10 +14913,10 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14896
14913
|
animation: "fe-orb-fade-in 0.18s ease"
|
|
14897
14914
|
},
|
|
14898
14915
|
children: [
|
|
14899
|
-
|
|
14916
|
+
be && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
|
|
14900
14917
|
type: "button",
|
|
14901
14918
|
onClick: () => {
|
|
14902
|
-
|
|
14919
|
+
Ae(!1), ye?.();
|
|
14903
14920
|
},
|
|
14904
14921
|
style: {
|
|
14905
14922
|
display: "flex",
|
|
@@ -14941,7 +14958,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14941
14958
|
/* @__PURE__ */ _("button", {
|
|
14942
14959
|
type: "button",
|
|
14943
14960
|
onClick: () => {
|
|
14944
|
-
|
|
14961
|
+
Ae(!1), I?.();
|
|
14945
14962
|
},
|
|
14946
14963
|
style: {
|
|
14947
14964
|
display: "flex",
|
|
@@ -14976,7 +14993,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
14976
14993
|
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" })]
|
|
14977
14994
|
}), "Start new chat"]
|
|
14978
14995
|
}),
|
|
14979
|
-
|
|
14996
|
+
Se && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", { style: {
|
|
14980
14997
|
height: "1px",
|
|
14981
14998
|
background: "rgba(255,255,255,0.07)",
|
|
14982
14999
|
margin: "0 14px"
|
|
@@ -15016,14 +15033,14 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15016
15033
|
children: /* @__PURE__ */ g("path", { d: "M12 8v4l3 3M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" })
|
|
15017
15034
|
}), "Chat history"]
|
|
15018
15035
|
})] }),
|
|
15019
|
-
|
|
15036
|
+
Me && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", { style: {
|
|
15020
15037
|
height: "1px",
|
|
15021
15038
|
background: "rgba(255,255,255,0.07)",
|
|
15022
15039
|
margin: "0 14px"
|
|
15023
15040
|
} }), /* @__PURE__ */ _("button", {
|
|
15024
15041
|
type: "button",
|
|
15025
15042
|
onClick: () => {
|
|
15026
|
-
|
|
15043
|
+
Fe(), Ae(!1);
|
|
15027
15044
|
},
|
|
15028
15045
|
style: {
|
|
15029
15046
|
display: "flex",
|
|
@@ -15080,7 +15097,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15080
15097
|
width: "34px",
|
|
15081
15098
|
height: "19px",
|
|
15082
15099
|
borderRadius: "999px",
|
|
15083
|
-
background:
|
|
15100
|
+
background: Ne ? "#22c55e" : "rgba(255,255,255,0.2)",
|
|
15084
15101
|
position: "relative",
|
|
15085
15102
|
flexShrink: 0,
|
|
15086
15103
|
transition: "background 0.15s ease"
|
|
@@ -15088,7 +15105,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15088
15105
|
children: /* @__PURE__ */ g("span", { style: {
|
|
15089
15106
|
position: "absolute",
|
|
15090
15107
|
top: "2px",
|
|
15091
|
-
left:
|
|
15108
|
+
left: Ne ? "17px" : "2px",
|
|
15092
15109
|
width: "15px",
|
|
15093
15110
|
height: "15px",
|
|
15094
15111
|
borderRadius: "50%",
|
|
@@ -15105,7 +15122,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15105
15122
|
/* @__PURE__ */ _("button", {
|
|
15106
15123
|
type: "button",
|
|
15107
15124
|
onClick: () => {
|
|
15108
|
-
|
|
15125
|
+
Ae(!1), ve?.();
|
|
15109
15126
|
},
|
|
15110
15127
|
style: {
|
|
15111
15128
|
display: "flex",
|
|
@@ -15164,23 +15181,23 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15164
15181
|
]
|
|
15165
15182
|
}),
|
|
15166
15183
|
/* @__PURE__ */ g(Hg, {
|
|
15167
|
-
webRTCError:
|
|
15168
|
-
micError:
|
|
15169
|
-
setMicError:
|
|
15170
|
-
dismissCallError:
|
|
15184
|
+
webRTCError: oe,
|
|
15185
|
+
micError: se,
|
|
15186
|
+
setMicError: P,
|
|
15187
|
+
dismissCallError: F,
|
|
15171
15188
|
isRateLimited: E,
|
|
15172
15189
|
rateLimitMessage: D
|
|
15173
15190
|
}),
|
|
15174
|
-
|
|
15191
|
+
ge && /* @__PURE__ */ g(a_, {
|
|
15175
15192
|
agentName: v,
|
|
15176
15193
|
agentHeadshot: y,
|
|
15177
15194
|
fallbackAgentName: b,
|
|
15178
|
-
callDurationSeconds:
|
|
15179
|
-
isCallMuted:
|
|
15180
|
-
formatCallDuration:
|
|
15181
|
-
toggleCallMute:
|
|
15182
|
-
endWebRTCCall:
|
|
15183
|
-
onExpand:
|
|
15195
|
+
callDurationSeconds: he,
|
|
15196
|
+
isCallMuted: de,
|
|
15197
|
+
formatCallDuration: me,
|
|
15198
|
+
toggleCallMute: fe,
|
|
15199
|
+
endWebRTCCall: pe,
|
|
15200
|
+
onExpand: _e,
|
|
15184
15201
|
primaryColor: n
|
|
15185
15202
|
}),
|
|
15186
15203
|
/* @__PURE__ */ _("div", {
|
|
@@ -15192,7 +15209,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15192
15209
|
background: "transparent",
|
|
15193
15210
|
position: "relative"
|
|
15194
15211
|
},
|
|
15195
|
-
children: [
|
|
15212
|
+
children: [Ie ? /* @__PURE__ */ _("div", {
|
|
15196
15213
|
style: {
|
|
15197
15214
|
position: "absolute",
|
|
15198
15215
|
inset: 0,
|
|
@@ -15211,7 +15228,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15211
15228
|
flexShrink: 0
|
|
15212
15229
|
},
|
|
15213
15230
|
children: /* @__PURE__ */ _("button", {
|
|
15214
|
-
onClick: () =>
|
|
15231
|
+
onClick: () => Le(!1),
|
|
15215
15232
|
style: {
|
|
15216
15233
|
background: "none",
|
|
15217
15234
|
border: "none",
|
|
@@ -15245,7 +15262,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15245
15262
|
overflowY: "auto",
|
|
15246
15263
|
position: "relative"
|
|
15247
15264
|
},
|
|
15248
|
-
children:
|
|
15265
|
+
children: ze ? /* @__PURE__ */ g("div", {
|
|
15249
15266
|
style: {
|
|
15250
15267
|
padding: "40px 20px",
|
|
15251
15268
|
textAlign: "center",
|
|
@@ -15253,7 +15270,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15253
15270
|
fontSize: "14px"
|
|
15254
15271
|
},
|
|
15255
15272
|
children: "Loading past conversations..."
|
|
15256
|
-
}) :
|
|
15273
|
+
}) : z.length > 0 ? /* @__PURE__ */ g("div", { children: z.map((e) => /* @__PURE__ */ _("div", {
|
|
15257
15274
|
onClick: () => Ke(e),
|
|
15258
15275
|
style: {
|
|
15259
15276
|
padding: "16px 20px",
|
|
@@ -15305,18 +15322,18 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15305
15322
|
children: "No previous chats found."
|
|
15306
15323
|
})
|
|
15307
15324
|
})]
|
|
15308
|
-
}) : null,
|
|
15325
|
+
}) : null, Ee ? /* @__PURE__ */ g(zg, {
|
|
15309
15326
|
chatHistory: l,
|
|
15310
15327
|
isAiTyping: u,
|
|
15311
15328
|
isLoading: T,
|
|
15312
15329
|
isAgentTyping: d,
|
|
15313
|
-
setReplyContext:
|
|
15314
|
-
TypingDots:
|
|
15330
|
+
setReplyContext: N,
|
|
15331
|
+
TypingDots: G_,
|
|
15315
15332
|
primaryColor: n,
|
|
15316
15333
|
agentHeadshot: y,
|
|
15317
15334
|
agentDisplayName: v || b,
|
|
15318
|
-
botAvatarNode: /* @__PURE__ */ g(
|
|
15319
|
-
}) :
|
|
15335
|
+
botAvatarNode: /* @__PURE__ */ g(W_, { orbColors: t })
|
|
15336
|
+
}) : we ? /* @__PURE__ */ _("div", {
|
|
15320
15337
|
style: {
|
|
15321
15338
|
flex: 1,
|
|
15322
15339
|
display: "flex",
|
|
@@ -15356,7 +15373,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15356
15373
|
padding: "28px 24px"
|
|
15357
15374
|
},
|
|
15358
15375
|
children: [
|
|
15359
|
-
/* @__PURE__ */ g(
|
|
15376
|
+
/* @__PURE__ */ g(B_, {
|
|
15360
15377
|
size: 94,
|
|
15361
15378
|
orbColors: t
|
|
15362
15379
|
}),
|
|
@@ -15406,7 +15423,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15406
15423
|
]
|
|
15407
15424
|
})]
|
|
15408
15425
|
}),
|
|
15409
|
-
|
|
15426
|
+
ie && /* @__PURE__ */ _("div", {
|
|
15410
15427
|
style: {
|
|
15411
15428
|
margin: "0 16px 8px",
|
|
15412
15429
|
padding: "9px 14px",
|
|
@@ -15452,13 +15469,13 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15452
15469
|
setInput: S,
|
|
15453
15470
|
onSubmit: C,
|
|
15454
15471
|
isConversationEnded: w,
|
|
15455
|
-
callUiActive:
|
|
15456
|
-
handleToggleVoice:
|
|
15472
|
+
callUiActive: Oe,
|
|
15473
|
+
handleToggleVoice: ye,
|
|
15457
15474
|
showVoiceToggle: f === "agent",
|
|
15458
15475
|
activeScreen: f,
|
|
15459
|
-
inputDisabled:
|
|
15460
|
-
replyContext:
|
|
15461
|
-
clearReplyContext: () =>
|
|
15476
|
+
inputDisabled: De,
|
|
15477
|
+
replyContext: ae,
|
|
15478
|
+
clearReplyContext: () => N(null),
|
|
15462
15479
|
onFileSelect: k,
|
|
15463
15480
|
selectedFile: O,
|
|
15464
15481
|
onRemoveSelectedFile: A,
|
|
@@ -15466,8 +15483,8 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15466
15483
|
isUploadingAttachment: te,
|
|
15467
15484
|
requiresEmail: ne,
|
|
15468
15485
|
emailInput: j,
|
|
15469
|
-
setEmailInput:
|
|
15470
|
-
emailError:
|
|
15486
|
+
setEmailInput: M,
|
|
15487
|
+
emailError: re,
|
|
15471
15488
|
inputPlaceholder: e.inputPlaceholder
|
|
15472
15489
|
})
|
|
15473
15490
|
}),
|
|
@@ -15479,7 +15496,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15479
15496
|
paddingBottom: "max(12px, env(safe-area-inset-bottom, 12px))",
|
|
15480
15497
|
pointerEvents: "none"
|
|
15481
15498
|
},
|
|
15482
|
-
children: [
|
|
15499
|
+
children: [R && /* @__PURE__ */ _("p", {
|
|
15483
15500
|
style: {
|
|
15484
15501
|
margin: "0 0 4px",
|
|
15485
15502
|
fontSize: "10px",
|
|
@@ -15492,7 +15509,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15492
15509
|
"This conversation is recorded for quality assurance purposes.",
|
|
15493
15510
|
" ",
|
|
15494
15511
|
/* @__PURE__ */ g("a", {
|
|
15495
|
-
href:
|
|
15512
|
+
href: R,
|
|
15496
15513
|
target: "_blank",
|
|
15497
15514
|
rel: "noopener noreferrer",
|
|
15498
15515
|
style: {
|
|
@@ -15502,7 +15519,7 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15502
15519
|
children: "See our privacy policy"
|
|
15503
15520
|
})
|
|
15504
15521
|
]
|
|
15505
|
-
}),
|
|
15522
|
+
}), L && /* @__PURE__ */ _("span", {
|
|
15506
15523
|
style: {
|
|
15507
15524
|
fontSize: "11px",
|
|
15508
15525
|
color: "#9ca3af",
|
|
@@ -15521,34 +15538,34 @@ function G_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
15521
15538
|
]
|
|
15522
15539
|
});
|
|
15523
15540
|
}
|
|
15524
|
-
function
|
|
15525
|
-
let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, beaconSyncVoiceTranscript: j, sendMessage:
|
|
15541
|
+
function q_() {
|
|
15542
|
+
let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, beaconSyncVoiceTranscript: j, sendMessage: M, uploadChatFile: re, openWidget: ie, captureVisitorEmail: ae, setVoiceMode: N, endConversation: P, startNewChat: F, acceptCall: ce, rejectCall: le, endWebRTCCall: ue, toggleCallMute: de, dismissCallError: fe, startTyping: pe, stopTyping: me, updateTypingDraft: he, getVisitorChatHistory: ge, resumeChat: _e, isSessionRestoring: ve, openToChatCounter: ye, voiceEndCounter: be } = kn();
|
|
15526
15543
|
c(() => {
|
|
15527
15544
|
try {
|
|
15528
15545
|
fr();
|
|
15529
15546
|
} catch {}
|
|
15530
15547
|
}, []), c(() => {
|
|
15531
|
-
|
|
15532
|
-
}, [
|
|
15533
|
-
let
|
|
15534
|
-
...
|
|
15535
|
-
...
|
|
15536
|
-
},
|
|
15537
|
-
...
|
|
15538
|
-
...
|
|
15539
|
-
},
|
|
15540
|
-
...
|
|
15541
|
-
...
|
|
15542
|
-
},
|
|
15548
|
+
ye && W !== "voice_mode" && W !== "text_chat" && W !== "call_screen" && (N?.(!1), et("text_chat"));
|
|
15549
|
+
}, [ye]);
|
|
15550
|
+
let xe = t?.widgetSettings || {}, I = n?.widgetSettings || {}, L = {
|
|
15551
|
+
...xe.branding || {},
|
|
15552
|
+
...I.branding || {}
|
|
15553
|
+
}, R = {
|
|
15554
|
+
...xe.theme || {},
|
|
15555
|
+
...I.theme || {}
|
|
15556
|
+
}, Se = {
|
|
15557
|
+
...xe.features || {},
|
|
15558
|
+
...I.features || {}
|
|
15559
|
+
}, Ce = Se.voice !== !1, we = Array.isArray(R.orbColors) && R.orbColors.length > 0 ? R.orbColors : null, Te = R.buttonColor || R.primaryColor || we?.[0] || "#3B82F6", Oe = {
|
|
15543
15560
|
small: 50,
|
|
15544
15561
|
medium: 64,
|
|
15545
15562
|
large: 80
|
|
15546
|
-
},
|
|
15563
|
+
}, ke = Oe[R.orbSize] || Oe.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", Pe = P_(we ?? R.chatBgColors), Fe = L.logo || L.logoUrl || null, Ie = A || "en", Le = xe.recommendations?.[Ie] || [], z = (I.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
|
|
15547
15564
|
id: e.key || `qr-${t}`,
|
|
15548
15565
|
label: e.label,
|
|
15549
15566
|
message: e.label,
|
|
15550
15567
|
text: e.label
|
|
15551
|
-
})),
|
|
15568
|
+
})), Re = Array.isArray(L.quickChatOptions) && L.quickChatOptions.length > 0 ? L.quickChatOptions : z, ze = L.hideWatermark === !0 ? !1 : L.showPoweredBy !== !1, Be = L.headerBgColor || null, Ve = R.bottomPosition == null ? "1.5rem" : `${R.bottomPosition}px`, B = L.privacyPolicyUrl || null, He = L.chatbotEnabled !== !1 && R.chatbotEnabled !== !1, [Ue, V] = m(() => typeof window < "u" ? window.location.pathname : "/");
|
|
15552
15569
|
c(() => {
|
|
15553
15570
|
if (typeof window > "u") return;
|
|
15554
15571
|
let e = () => V(window.location.pathname), t = window.history.pushState.bind(window.history);
|
|
@@ -15560,24 +15577,24 @@ function K_() {
|
|
|
15560
15577
|
}, []);
|
|
15561
15578
|
let We = (() => {
|
|
15562
15579
|
let e = {
|
|
15563
|
-
...
|
|
15564
|
-
...
|
|
15580
|
+
...xe.pageVisibility || {},
|
|
15581
|
+
...I.pageVisibility || {}
|
|
15565
15582
|
};
|
|
15566
15583
|
return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
|
|
15567
|
-
})(), Ge = We.length === 0 || We.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ue.startsWith(e.slice(0, -1)) : Ue.replace(/\/$/, "") === e.replace(/\/$/, "")), Ke =
|
|
15568
|
-
entryPrompt:
|
|
15569
|
-
yesLabel:
|
|
15570
|
-
laterLabel:
|
|
15571
|
-
connectionTitle:
|
|
15572
|
-
connectionSubtitle:
|
|
15573
|
-
voiceLabel:
|
|
15574
|
-
textLabel:
|
|
15575
|
-
chatTitle:
|
|
15576
|
-
hasCustomTitle: !!(
|
|
15584
|
+
})(), Ge = We.length === 0 || We.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ue.startsWith(e.slice(0, -1)) : Ue.replace(/\/$/, "") === e.replace(/\/$/, "")), Ke = xe.greetings?.[A] || I.greetings?.[A] || L.introGreeting || (t?.websiteName && String(t.websiteName).trim() ? `Hello, I'm here to help you know more about ${String(t.websiteName).trim()}.` : "Hello, I'm here to help — what would you like to know?"), qe = {
|
|
15585
|
+
entryPrompt: L.entryPrompt || "Do you want to explore in a new way?",
|
|
15586
|
+
yesLabel: L.yesLabel || "Yes",
|
|
15587
|
+
laterLabel: L.laterLabel || "Later",
|
|
15588
|
+
connectionTitle: L.connectionTitle || "How would you like to connect?",
|
|
15589
|
+
connectionSubtitle: L.connectionSubtitle || "",
|
|
15590
|
+
voiceLabel: L.voiceLabel || "Voice",
|
|
15591
|
+
textLabel: L.textLabel || "Text",
|
|
15592
|
+
chatTitle: L.headerName || "Chat with FlowEngage",
|
|
15593
|
+
hasCustomTitle: !!(L.headerName && String(L.headerName).trim()),
|
|
15577
15594
|
introGreeting: Ke,
|
|
15578
|
-
inputPlaceholder:
|
|
15579
|
-
analysingLabel:
|
|
15580
|
-
}, Je =
|
|
15595
|
+
inputPlaceholder: L.inputPlaceholder || "Type your message",
|
|
15596
|
+
analysingLabel: L.analysingLabel || "analysing..."
|
|
15597
|
+
}, Je = I.elevenLabsAgentId || t?.elevenLabsAgentId || null, Ye = t?.siteId || n?.siteId || null, Xe = t?.apiBaseUrl || "";
|
|
15581
15598
|
c(() => {
|
|
15582
15599
|
Qn(t?.siteType || null);
|
|
15583
15600
|
}, [t?.siteType]);
|
|
@@ -15588,10 +15605,10 @@ function K_() {
|
|
|
15588
15605
|
]), H = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, U = r.some((e) => e.sender === "user"), Qe = f(() => {
|
|
15589
15606
|
let e = r.findIndex((e) => e.sender === "user");
|
|
15590
15607
|
return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
|
|
15591
|
-
}, [r]), $e = !!(
|
|
15608
|
+
}, [r]), $e = !!(I._dashboardLivePreview || xe._dashboardLivePreview), [W, et] = m(() => $e ? "text_chat" : "entry_prompt"), [tt, nt] = m(""), [rt, it] = m(null), [at, ot] = m(h || ""), [st, ct] = m(""), [G, lt] = m(!1), [ut, dt] = m(0), [ft, pt] = m(null), [mt, ht] = m(null), [gt, _t] = m(""), [vt, yt] = m(!1), [bt, xt] = m(!1), [St, Ct] = m(!1), wt = p(null), Tt = p(!1), Et = !h && U && Qe && W !== "voice_mode";
|
|
15592
15609
|
d(() => {
|
|
15593
15610
|
if (e !== "ready" || Tt.current) return;
|
|
15594
|
-
if (Tt.current = !0, !
|
|
15611
|
+
if (Tt.current = !0, !Ce) {
|
|
15595
15612
|
et("minimized_orb");
|
|
15596
15613
|
return;
|
|
15597
15614
|
}
|
|
@@ -15599,13 +15616,13 @@ function K_() {
|
|
|
15599
15616
|
try {
|
|
15600
15617
|
t = wr().shouldResumeVoice;
|
|
15601
15618
|
} catch {}
|
|
15602
|
-
let n =
|
|
15619
|
+
let n = Ae(), r = Ye ? Ee(Ye) : null, i = n || !!r?.transcript;
|
|
15603
15620
|
if (t) {
|
|
15604
|
-
|
|
15621
|
+
ie?.({ notifyChatInitiated: !0 }), N?.(!0), et("voice_mode");
|
|
15605
15622
|
return;
|
|
15606
15623
|
}
|
|
15607
|
-
if (
|
|
15608
|
-
|
|
15624
|
+
if (Ne()) {
|
|
15625
|
+
ie?.({ notifyChatInitiated: !1 }), et("text_chat");
|
|
15609
15626
|
return;
|
|
15610
15627
|
}
|
|
15611
15628
|
if (i) {
|
|
@@ -15613,13 +15630,13 @@ function K_() {
|
|
|
15613
15630
|
et("minimized_orb");
|
|
15614
15631
|
return;
|
|
15615
15632
|
}
|
|
15616
|
-
|
|
15633
|
+
ie?.({ notifyChatInitiated: !0 }), N?.(!0), et("voice_mode");
|
|
15617
15634
|
return;
|
|
15618
15635
|
}
|
|
15619
15636
|
if (Ye) try {
|
|
15620
|
-
|
|
15637
|
+
De(Ye);
|
|
15621
15638
|
} catch {}
|
|
15622
|
-
if (
|
|
15639
|
+
if (oe(Ye)) {
|
|
15623
15640
|
et("minimized_orb");
|
|
15624
15641
|
return;
|
|
15625
15642
|
}
|
|
@@ -15677,7 +15694,7 @@ function K_() {
|
|
|
15677
15694
|
hasIncomingCall: !!w?.callId,
|
|
15678
15695
|
activeCallId: T,
|
|
15679
15696
|
callConnectionState: E
|
|
15680
|
-
}), wt.current = e, W === "voice_mode" &&
|
|
15697
|
+
}), wt.current = e, W === "voice_mode" && N?.(!1), ie?.(), jt());
|
|
15681
15698
|
}
|
|
15682
15699
|
}, [
|
|
15683
15700
|
T,
|
|
@@ -15685,8 +15702,8 @@ function K_() {
|
|
|
15685
15702
|
jt,
|
|
15686
15703
|
w?.callId,
|
|
15687
15704
|
i,
|
|
15688
|
-
|
|
15689
|
-
|
|
15705
|
+
ie,
|
|
15706
|
+
N,
|
|
15690
15707
|
W
|
|
15691
15708
|
]), c(() => {
|
|
15692
15709
|
!w && !T && W === "call_screen" && et("text_chat");
|
|
@@ -15698,16 +15715,16 @@ function K_() {
|
|
|
15698
15715
|
!T && bt && xt(!1);
|
|
15699
15716
|
}, [T, bt]), c(() => {
|
|
15700
15717
|
if (!s || C) {
|
|
15701
|
-
|
|
15718
|
+
he?.(""), me?.();
|
|
15702
15719
|
return;
|
|
15703
15720
|
}
|
|
15704
15721
|
if (!tt.trim() || mt) {
|
|
15705
|
-
|
|
15706
|
-
let e = window.setTimeout(() =>
|
|
15722
|
+
he?.("");
|
|
15723
|
+
let e = window.setTimeout(() => me?.(), 100);
|
|
15707
15724
|
return () => window.clearTimeout(e);
|
|
15708
15725
|
}
|
|
15709
|
-
|
|
15710
|
-
let e = window.setTimeout(() =>
|
|
15726
|
+
pe?.();
|
|
15727
|
+
let e = window.setTimeout(() => he?.(tt), 120), t = window.setTimeout(() => me?.(), 1200);
|
|
15711
15728
|
return () => {
|
|
15712
15729
|
window.clearTimeout(e), window.clearTimeout(t);
|
|
15713
15730
|
};
|
|
@@ -15716,9 +15733,9 @@ function K_() {
|
|
|
15716
15733
|
mt,
|
|
15717
15734
|
s,
|
|
15718
15735
|
C,
|
|
15736
|
+
pe,
|
|
15719
15737
|
me,
|
|
15720
|
-
he
|
|
15721
|
-
ge
|
|
15738
|
+
he
|
|
15722
15739
|
]);
|
|
15723
15740
|
let Nt = (e) => e ? {
|
|
15724
15741
|
replyTo: e.messageId || e.id || null,
|
|
@@ -15732,7 +15749,7 @@ function K_() {
|
|
|
15732
15749
|
ct("Please enter a valid email so we can continue helping you.");
|
|
15733
15750
|
return;
|
|
15734
15751
|
}
|
|
15735
|
-
await
|
|
15752
|
+
await ae(e), ct(""), lt(!0), setTimeout(() => lt(!1), 3e3);
|
|
15736
15753
|
return;
|
|
15737
15754
|
}
|
|
15738
15755
|
let t = Nt(rt);
|
|
@@ -15740,8 +15757,8 @@ function K_() {
|
|
|
15740
15757
|
if (mt) {
|
|
15741
15758
|
try {
|
|
15742
15759
|
yt(!0), _t("");
|
|
15743
|
-
let e = await
|
|
15744
|
-
nt(""), it(null), kt(), await
|
|
15760
|
+
let e = await re(mt), n = e?.data || e, r = tt.trim() || `Shared file: ${Fg(mt)}`;
|
|
15761
|
+
nt(""), it(null), kt(), await M(r, "", t, {
|
|
15745
15762
|
type: "file",
|
|
15746
15763
|
metadata: {
|
|
15747
15764
|
fileUrl: n?.fileUrl,
|
|
@@ -15758,20 +15775,20 @@ function K_() {
|
|
|
15758
15775
|
return;
|
|
15759
15776
|
}
|
|
15760
15777
|
let n = tt.trim();
|
|
15761
|
-
nt(""), it(null), await
|
|
15778
|
+
nt(""), it(null), await M(n, "", t);
|
|
15762
15779
|
}, Ft = o(() => {
|
|
15763
|
-
r.length !== 0 &&
|
|
15764
|
-
}, [r.length,
|
|
15780
|
+
r.length !== 0 && F?.();
|
|
15781
|
+
}, [r.length, F]), It = (e) => {
|
|
15765
15782
|
let t = Math.floor(e / 60);
|
|
15766
15783
|
return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
|
|
15767
15784
|
}, Lt = o(async (e) => {
|
|
15768
15785
|
if (C || b) return;
|
|
15769
15786
|
let t = e.message || e.label || e.text || "";
|
|
15770
|
-
t.trim() && await
|
|
15787
|
+
t.trim() && await M(t.trim(), "");
|
|
15771
15788
|
}, [
|
|
15772
15789
|
C,
|
|
15773
15790
|
b,
|
|
15774
|
-
|
|
15791
|
+
M
|
|
15775
15792
|
]), Rt = Dt && W === "entry_prompt" ? { inset: 0 } : Dt && W === "text_chat" ? {
|
|
15776
15793
|
left: 0,
|
|
15777
15794
|
right: 0,
|
|
@@ -15792,19 +15809,19 @@ function K_() {
|
|
|
15792
15809
|
height: "min(640px, calc(100vh - 120px))",
|
|
15793
15810
|
borderRadius: "22px",
|
|
15794
15811
|
overflow: "hidden",
|
|
15795
|
-
...
|
|
15812
|
+
...je === "bottom-left" ? {
|
|
15796
15813
|
left: "1.5rem",
|
|
15797
|
-
bottom:
|
|
15814
|
+
bottom: Ve
|
|
15798
15815
|
} : {
|
|
15799
15816
|
right: "1.5rem",
|
|
15800
|
-
bottom:
|
|
15817
|
+
bottom: Ve
|
|
15801
15818
|
}
|
|
15802
|
-
} :
|
|
15819
|
+
} : je === "bottom-left" ? {
|
|
15803
15820
|
left: "1.5rem",
|
|
15804
|
-
bottom:
|
|
15821
|
+
bottom: Ve
|
|
15805
15822
|
} : {
|
|
15806
15823
|
right: "1.5rem",
|
|
15807
|
-
bottom:
|
|
15824
|
+
bottom: Ve
|
|
15808
15825
|
}, zt = o(() => {
|
|
15809
15826
|
W !== "minimized_orb" && (Ct(!0), setTimeout(() => {
|
|
15810
15827
|
et("minimized_orb"), Ct(!1), T && xt(!0);
|
|
@@ -15817,13 +15834,13 @@ function K_() {
|
|
|
15817
15834
|
t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
|
|
15818
15835
|
}
|
|
15819
15836
|
} catch {}
|
|
15820
|
-
|
|
15837
|
+
ie({ notifyChatInitiated: !0 }), N?.(!0), et("voice_mode");
|
|
15821
15838
|
}, Ht = () => {
|
|
15822
|
-
|
|
15839
|
+
ie({ notifyChatInitiated: !0 }), N?.(!1), et("text_chat");
|
|
15823
15840
|
}, Ut = () => {
|
|
15824
|
-
|
|
15841
|
+
N?.(!1), zt();
|
|
15825
15842
|
};
|
|
15826
|
-
return e !== "ready" || !He ||
|
|
15843
|
+
return e !== "ready" || !He || Se.chat === !1 || !Ge ? null : /* @__PURE__ */ _("div", {
|
|
15827
15844
|
className: "flowengage-widget-root",
|
|
15828
15845
|
style: {
|
|
15829
15846
|
position: "fixed",
|
|
@@ -15833,15 +15850,15 @@ function K_() {
|
|
|
15833
15850
|
onWheel: (e) => e.stopPropagation(),
|
|
15834
15851
|
onTouchMove: (e) => e.stopPropagation(),
|
|
15835
15852
|
children: [
|
|
15836
|
-
W === "entry_prompt" && /* @__PURE__ */ g(
|
|
15853
|
+
W === "entry_prompt" && /* @__PURE__ */ g(V_, {
|
|
15837
15854
|
copy: qe,
|
|
15838
|
-
orbColors:
|
|
15839
|
-
primaryColor:
|
|
15855
|
+
orbColors: we,
|
|
15856
|
+
primaryColor: Te,
|
|
15840
15857
|
onYes: () => {
|
|
15841
|
-
|
|
15858
|
+
se(Ye), Vt();
|
|
15842
15859
|
},
|
|
15843
15860
|
onLater: () => {
|
|
15844
|
-
|
|
15861
|
+
se(Ye), zt();
|
|
15845
15862
|
},
|
|
15846
15863
|
isMobile: Dt,
|
|
15847
15864
|
isClosing: St
|
|
@@ -15865,7 +15882,7 @@ function K_() {
|
|
|
15865
15882
|
transformOrigin: "bottom right",
|
|
15866
15883
|
display: "inline-flex",
|
|
15867
15884
|
flexDirection: "column",
|
|
15868
|
-
alignItems:
|
|
15885
|
+
alignItems: je === "bottom-left" ? "flex-start" : "flex-end",
|
|
15869
15886
|
gap: "10px"
|
|
15870
15887
|
},
|
|
15871
15888
|
children: [T && /* @__PURE__ */ _("button", {
|
|
@@ -15916,24 +15933,24 @@ function K_() {
|
|
|
15916
15933
|
children: E === "connected" ? `${It(ut)} with ${Ze}` : `Tap to return to ${Ze}`
|
|
15917
15934
|
})]
|
|
15918
15935
|
})]
|
|
15919
|
-
}), /* @__PURE__ */ g(
|
|
15920
|
-
size:
|
|
15921
|
-
orbColors:
|
|
15922
|
-
onClick: T ? jt :
|
|
15936
|
+
}), /* @__PURE__ */ g(B_, {
|
|
15937
|
+
size: ke,
|
|
15938
|
+
orbColors: we,
|
|
15939
|
+
onClick: T ? jt : Ce ? Bt : Ht
|
|
15923
15940
|
})]
|
|
15924
15941
|
}),
|
|
15925
|
-
W === "connection_modal" && /* @__PURE__ */ g(
|
|
15942
|
+
W === "connection_modal" && /* @__PURE__ */ g(H_, {
|
|
15926
15943
|
copy: qe,
|
|
15927
|
-
orbColors:
|
|
15928
|
-
primaryColor:
|
|
15944
|
+
orbColors: we,
|
|
15945
|
+
primaryColor: Te,
|
|
15929
15946
|
onVoice: Vt,
|
|
15930
15947
|
onText: Ht,
|
|
15931
15948
|
onClose: zt,
|
|
15932
15949
|
isMobile: Dt,
|
|
15933
15950
|
isClosing: St
|
|
15934
15951
|
}),
|
|
15935
|
-
W === "voice_mode" && /* @__PURE__ */ g(
|
|
15936
|
-
orbColors:
|
|
15952
|
+
W === "voice_mode" && /* @__PURE__ */ g(U_, {
|
|
15953
|
+
orbColors: we,
|
|
15937
15954
|
onEnterChat: Ht,
|
|
15938
15955
|
onEndChat: Ut,
|
|
15939
15956
|
agentId: Je,
|
|
@@ -15943,17 +15960,17 @@ function K_() {
|
|
|
15943
15960
|
historyRef: te,
|
|
15944
15961
|
onMessageSync: ne,
|
|
15945
15962
|
beaconSyncVoiceTranscript: j,
|
|
15946
|
-
widgetPosition:
|
|
15947
|
-
voiceEndCounter:
|
|
15963
|
+
widgetPosition: je,
|
|
15964
|
+
voiceEndCounter: be,
|
|
15948
15965
|
websiteName: t?.websiteName,
|
|
15949
|
-
voiceFirstMessage:
|
|
15950
|
-
captureVisitorEmail:
|
|
15966
|
+
voiceFirstMessage: xe.voiceFirstMessage || null,
|
|
15967
|
+
captureVisitorEmail: ae,
|
|
15951
15968
|
emailRequired: !h,
|
|
15952
|
-
emailCaptureEnabled:
|
|
15953
|
-
listeningLabel:
|
|
15954
|
-
thinkingLabel:
|
|
15955
|
-
enterChatModeLabel:
|
|
15956
|
-
endConversationLabel:
|
|
15969
|
+
emailCaptureEnabled: Se.emailCapture !== !1 && L.disableEmailCapture !== !0,
|
|
15970
|
+
listeningLabel: L.voiceListeningLabel || "Listening...",
|
|
15971
|
+
thinkingLabel: L.voiceThinkingLabel || "Thinking...",
|
|
15972
|
+
enterChatModeLabel: L.voiceEnterChatLabel || "Enter Chat Mode",
|
|
15973
|
+
endConversationLabel: L.voiceEndConversationLabel || "End Conversation"
|
|
15957
15974
|
}, "voice"),
|
|
15958
15975
|
W === "call_screen" && /* @__PURE__ */ g(i_, {
|
|
15959
15976
|
incomingCall: w,
|
|
@@ -15963,25 +15980,25 @@ function K_() {
|
|
|
15963
15980
|
isCallMuted: O,
|
|
15964
15981
|
agentName: Ze,
|
|
15965
15982
|
agentHeadshot: H,
|
|
15966
|
-
fallbackAgentName:
|
|
15967
|
-
acceptCall:
|
|
15968
|
-
rejectCall:
|
|
15969
|
-
endWebRTCCall:
|
|
15970
|
-
toggleCallMute:
|
|
15983
|
+
fallbackAgentName: Me,
|
|
15984
|
+
acceptCall: ce,
|
|
15985
|
+
rejectCall: le,
|
|
15986
|
+
endWebRTCCall: ue,
|
|
15987
|
+
toggleCallMute: de,
|
|
15971
15988
|
formatCallDuration: It,
|
|
15972
15989
|
onMinimize: Mt,
|
|
15973
|
-
primaryColor:
|
|
15974
|
-
orbColors:
|
|
15990
|
+
primaryColor: Te,
|
|
15991
|
+
orbColors: we,
|
|
15975
15992
|
chatHistory: r
|
|
15976
15993
|
}),
|
|
15977
|
-
W === "text_chat" && /* @__PURE__ */ g(
|
|
15994
|
+
W === "text_chat" && /* @__PURE__ */ g(K_, {
|
|
15978
15995
|
isClosing: St,
|
|
15979
15996
|
copy: qe,
|
|
15980
|
-
orbColors:
|
|
15981
|
-
primaryColor:
|
|
15982
|
-
chatBgGradient:
|
|
15983
|
-
logo:
|
|
15984
|
-
quickChatOptions:
|
|
15997
|
+
orbColors: we,
|
|
15998
|
+
primaryColor: Te,
|
|
15999
|
+
chatBgGradient: Pe,
|
|
16000
|
+
logo: Fe,
|
|
16001
|
+
quickChatOptions: Re,
|
|
15985
16002
|
onQuickChatSelect: Lt,
|
|
15986
16003
|
isMobile: Dt,
|
|
15987
16004
|
chatHistory: r,
|
|
@@ -15990,7 +16007,7 @@ function K_() {
|
|
|
15990
16007
|
activeScreen: a,
|
|
15991
16008
|
agentName: Ze,
|
|
15992
16009
|
agentHeadshot: H,
|
|
15993
|
-
fallbackAgentName:
|
|
16010
|
+
fallbackAgentName: Me,
|
|
15994
16011
|
input: tt,
|
|
15995
16012
|
setInput: nt,
|
|
15996
16013
|
onSubmit: Pt,
|
|
@@ -16013,26 +16030,26 @@ function K_() {
|
|
|
16013
16030
|
webRTCError: k,
|
|
16014
16031
|
micError: ft,
|
|
16015
16032
|
setMicError: pt,
|
|
16016
|
-
dismissCallError:
|
|
16033
|
+
dismissCallError: fe,
|
|
16017
16034
|
activeCallId: T,
|
|
16018
16035
|
isCallMuted: O,
|
|
16019
|
-
toggleCallMute:
|
|
16020
|
-
endWebRTCCall:
|
|
16036
|
+
toggleCallMute: de,
|
|
16037
|
+
endWebRTCCall: ue,
|
|
16021
16038
|
formatCallDuration: It,
|
|
16022
16039
|
callDurationSeconds: ut,
|
|
16023
16040
|
onCollapse: zt,
|
|
16024
16041
|
onStartVoice: Vt,
|
|
16025
|
-
voiceEnabled:
|
|
16042
|
+
voiceEnabled: Ce,
|
|
16026
16043
|
onNewChat: Ft,
|
|
16027
16044
|
onMinimize: Mt,
|
|
16028
16045
|
onExpand: jt,
|
|
16029
16046
|
isCallMinimized: !!T,
|
|
16030
|
-
showPoweredBy:
|
|
16047
|
+
showPoweredBy: ze,
|
|
16031
16048
|
privacyPolicyUrl: B,
|
|
16032
|
-
headerBgColor:
|
|
16033
|
-
getVisitorChatHistory:
|
|
16034
|
-
resumeChat:
|
|
16035
|
-
isSessionRestoring:
|
|
16049
|
+
headerBgColor: Be,
|
|
16050
|
+
getVisitorChatHistory: ge,
|
|
16051
|
+
resumeChat: _e,
|
|
16052
|
+
isSessionRestoring: ve
|
|
16036
16053
|
}),
|
|
16037
16054
|
/* @__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 " })
|
|
16038
16055
|
]
|
|
@@ -16040,7 +16057,7 @@ function K_() {
|
|
|
16040
16057
|
}
|
|
16041
16058
|
//#endregion
|
|
16042
16059
|
//#region src/components/ErrorBoundary.jsx
|
|
16043
|
-
var
|
|
16060
|
+
var J_ = class extends e.Component {
|
|
16044
16061
|
constructor(e) {
|
|
16045
16062
|
super(e), this.state = { hasError: !1 };
|
|
16046
16063
|
}
|
|
@@ -16055,4 +16072,4 @@ var q_ = class extends e.Component {
|
|
|
16055
16072
|
}
|
|
16056
16073
|
};
|
|
16057
16074
|
//#endregion
|
|
16058
|
-
export { Zg as AnimatedOrb,
|
|
16075
|
+
export { Zg as AnimatedOrb, J_ as ErrorBoundary, yi as FlowEngageProvider, q_ as FlowEngageWidget, kn as useFlowEngage };
|