@flowengage/react-chatbot 1.1.0 → 1.1.1
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.
|
@@ -171,12 +171,14 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
171
171
|
body: JSON.stringify({ session_id: e })
|
|
172
172
|
});
|
|
173
173
|
},
|
|
174
|
-
async syncVoice(e,
|
|
174
|
+
async syncVoice(e, r) {
|
|
175
175
|
return i("/api/ai/voice/sync", {
|
|
176
176
|
method: "POST",
|
|
177
177
|
body: JSON.stringify({
|
|
178
178
|
session_id: e,
|
|
179
|
-
messages:
|
|
179
|
+
messages: r,
|
|
180
|
+
...t ? { userId: String(t) } : {},
|
|
181
|
+
...n ? { siteId: String(n) } : {}
|
|
180
182
|
})
|
|
181
183
|
});
|
|
182
184
|
},
|
|
@@ -264,13 +266,15 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
264
266
|
site_id: n
|
|
265
267
|
});
|
|
266
268
|
},
|
|
267
|
-
beaconSyncVoice(
|
|
269
|
+
beaconSyncVoice(r, i) {
|
|
268
270
|
if (typeof navigator > "u" || !navigator.sendBeacon) return !1;
|
|
269
|
-
let
|
|
270
|
-
session_id:
|
|
271
|
-
messages:
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
let a = {
|
|
272
|
+
session_id: r,
|
|
273
|
+
messages: i,
|
|
274
|
+
...t ? { userId: String(t) } : {},
|
|
275
|
+
...n ? { siteId: String(n) } : {}
|
|
276
|
+
}, o = new Blob([JSON.stringify(a)], { type: "application/json" });
|
|
277
|
+
return navigator.sendBeacon(`${e}/api/ai/voice/sync`, o);
|
|
274
278
|
}
|
|
275
279
|
};
|
|
276
280
|
}, y = Object.create(null);
|
|
@@ -2423,8 +2427,8 @@ function vn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2423
2427
|
};
|
|
2424
2428
|
}, [c, r]), i(() => () => {
|
|
2425
2429
|
if (x && !ct.current && st.current.length > 0) {
|
|
2426
|
-
let e = T.current, t = st.current, n = w.current
|
|
2427
|
-
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(
|
|
2430
|
+
let e = T.current, t = st.current, n = w.current;
|
|
2431
|
+
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), ct.current = !0);
|
|
2428
2432
|
}
|
|
2429
2433
|
}, [x, _]), i(() => {
|
|
2430
2434
|
if (!w.current || !v || d !== "ready" || he) return;
|
|
@@ -22661,7 +22665,7 @@ function qg(e) {
|
|
|
22661
22665
|
}
|
|
22662
22666
|
function Jg(e) {
|
|
22663
22667
|
if (!e || typeof e != "object") return null;
|
|
22664
|
-
let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
|
|
22668
|
+
let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords ?? e.search_query ?? e.searchQuery ?? e.question ?? e.prompt ?? e.topic ?? e.intent;
|
|
22665
22669
|
return t == null ? null : String(t).trim() || null;
|
|
22666
22670
|
}
|
|
22667
22671
|
function Yg(e) {
|
|
@@ -22755,7 +22759,8 @@ function Zg(e) {
|
|
|
22755
22759
|
let e = "Missing url: pass a string url, path like /pricing, or JSON with a url field.";
|
|
22756
22760
|
return $("navigate_to_page ✖", e), e;
|
|
22757
22761
|
}
|
|
22758
|
-
|
|
22762
|
+
let o = typeof window < "u" ? sn(i) : i;
|
|
22763
|
+
if (rg(`Navigating to ${String(o).replace(/^https?:\/\/[^/]+/, "") || "/"}…`), ag(), !await ln(o, {
|
|
22759
22764
|
siteId: t,
|
|
22760
22765
|
apiBaseUrl: e.apiBaseUrl
|
|
22761
22766
|
})) {
|
|
@@ -22764,7 +22769,7 @@ function Zg(e) {
|
|
|
22764
22769
|
return $("navigate_to_page ✖ blocked", e), e;
|
|
22765
22770
|
}
|
|
22766
22771
|
try {
|
|
22767
|
-
if ($("navigate_to_page → shadowNavigate",
|
|
22772
|
+
if ($("navigate_to_page → shadowNavigate", o), await dn(o, { sectionText: a || void 0 }), await new Promise((e) => setTimeout(e, 600)), og(), ig(300), a && typeof a == "string") {
|
|
22768
22773
|
let e = rn(null, a);
|
|
22769
22774
|
e && an(e), $("navigate_to_page · highlight", {
|
|
22770
22775
|
sectionText: a,
|
|
@@ -22779,7 +22784,7 @@ function Zg(e) {
|
|
|
22779
22784
|
e = ` This page has a form with fields: [${r}]` + (i ? ` and buttons: [${i}].` : ".") + " Call list_page_forms then start filling.";
|
|
22780
22785
|
}
|
|
22781
22786
|
} catch {}
|
|
22782
|
-
let t = `OK_NAVIGATION ${
|
|
22787
|
+
let t = `OK_NAVIGATION ${o}${e}`;
|
|
22783
22788
|
return $("navigate_to_page ✓", t), t;
|
|
22784
22789
|
} catch (e) {
|
|
22785
22790
|
og(), ig(200);
|
|
@@ -22960,7 +22965,14 @@ function Qg(e) {
|
|
|
22960
22965
|
return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
|
|
22961
22966
|
let r = Zt();
|
|
22962
22967
|
r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
|
|
22963
|
-
let i
|
|
22968
|
+
let i;
|
|
22969
|
+
try {
|
|
22970
|
+
i = await t(n);
|
|
22971
|
+
} catch (t) {
|
|
22972
|
+
let n = `Tool error: ${t?.message || String(t)}`;
|
|
22973
|
+
return console.error(`[FlowEngage] voice tool ${e} threw:`, t), n;
|
|
22974
|
+
}
|
|
22975
|
+
let a = typeof i == "string" ? i.length > 220 ? `${i.slice(0, 220)}…` : i : String(i);
|
|
22964
22976
|
return r ? console.log("[FlowEngage:voice-tool] ◀", e, a) : console.info(`[FlowEngage] voice tool « ${e}:`, a), i;
|
|
22965
22977
|
}]));
|
|
22966
22978
|
}
|