@flowengage/react-chatbot 5.0.50 → 5.0.52

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.
@@ -198,11 +198,12 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
198
198
  } catch {
199
199
  return !1;
200
200
  }
201
- }, ze = (e) => e ? `flowengage.voice.navState.${e}.${De()}` : null, Be = (e, t) => {
201
+ }, ze = (e) => e ? `flowengage.voice.navState.${e}.${De()}` : null, Be = (e, t, n) => {
202
202
  if (!(!D || !e || !t)) try {
203
- let n = ze(e);
204
- n && window.sessionStorage.setItem(n, JSON.stringify({
203
+ let r = ze(e);
204
+ r && window.sessionStorage.setItem(r, JSON.stringify({
205
205
  previousPage: String(t),
206
+ targetPath: n ? new URL(String(n), window.location.href).pathname : null,
206
207
  ts: Date.now()
207
208
  }));
208
209
  } catch {}
@@ -215,7 +216,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
215
216
  if (!n) return null;
216
217
  window.sessionStorage.removeItem(t);
217
218
  let r = JSON.parse(n);
218
- return !r || typeof r.previousPage != "string" || Number.isFinite(r.ts) && Date.now() - r.ts > 6e4 ? null : { previousPage: r.previousPage };
219
+ return !r || typeof r.previousPage != "string" || Number.isFinite(r.ts) && Date.now() - r.ts > 6e4 || r.targetPath && (window.location.pathname.replace(/\/$/, "") || "/") !== (r.targetPath.replace(/\/$/, "") || "/") ? null : { previousPage: r.previousPage };
219
220
  } catch {
220
221
  return null;
221
222
  }
@@ -29377,16 +29378,14 @@ function Ck(e) {
29377
29378
  n && Ae(t, n);
29378
29379
  }
29379
29380
  } catch {}
29380
- Ne(), t && typeof window < "u" && Be(t, window.location.href);
29381
+ Ne();
29382
+ let e = a;
29381
29383
  try {
29382
- let e = new URL(a, typeof window < "u" ? window.location.href : "").href;
29383
- Cr(e);
29384
- } catch {
29385
- Cr(a);
29386
- }
29387
- $("flowengage_navigate → real navigation", a);
29388
- let e = typeof window < "u" && !!(window.next?.router || window.__NEXT_ROUTER__ || window.__remixRouter || window.__staticRouterHydrationData || window.___gatsby || window.___navigate || window.__VUE_ROUTER__ || window.__NUXT__ || window.$nuxt || window.ng?.getComponent || typeof document < "u" && document.querySelector("[ng-version]") || window.__sveltekit_data || typeof document < "u" && document.querySelector("[data-sveltekit-hydrate]"));
29389
- if (typeof window < "u" && window.__fe_triggerVoiceNavHooks && window.__fe_triggerVoiceNavHooks(), e && qn(3e3), Tr(a, { voiceActive: !0 }).catch(() => {}), e) try {
29384
+ e = new URL(a, typeof window < "u" ? window.location.href : "").href;
29385
+ } catch {}
29386
+ t && typeof window < "u" && Be(t, window.location.href, e), Cr(e), $("flowengage_navigate → real navigation", a);
29387
+ let n = typeof window < "u" && !!(window.next?.router || window.__NEXT_ROUTER__ || window.__remixRouter || window.__staticRouterHydrationData || window.___gatsby || window.___navigate || window.__VUE_ROUTER__ || window.__NUXT__ || window.$nuxt || window.ng?.getComponent || typeof document < "u" && document.querySelector("[ng-version]") || window.__sveltekit_data || typeof document < "u" && document.querySelector("[data-sveltekit-hydrate]"));
29388
+ if (typeof window < "u" && window.__fe_triggerVoiceNavHooks && window.__fe_triggerVoiceNavHooks(), n && qn(3e3), Tr(a, { voiceActive: !0 }).catch(() => {}), n) try {
29390
29389
  let e = new URL(a, window.location.origin).pathname, t = Date.now() + 2e3;
29391
29390
  for (; Date.now() < t && !(typeof window < "u" && window.location.pathname === e);) await new Promise((e) => setTimeout(e, 80));
29392
29391
  let n = typeof window < "u" ? window.location.pathname : e, r = typeof window < "u" ? window.location.href : a, i = n === e, o = (n.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home";
@@ -30006,6 +30005,9 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30006
30005
  try {
30007
30006
  CD();
30008
30007
  } catch {}
30008
+ if (a) try {
30009
+ Ve(a);
30010
+ } catch {}
30009
30011
  try {
30010
30012
  await C.current?.endSession?.();
30011
30013
  } catch {}
@@ -30229,6 +30231,9 @@ function Pk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30229
30231
  try {
30230
30232
  CD();
30231
30233
  } catch {}
30234
+ if (a) try {
30235
+ Ve(a);
30236
+ } catch {}
30232
30237
  kr(), ue.current &&= (clearTimeout(ue.current), null), de.current &&= (clearTimeout(de.current), null), le.current = !1, fe.current = !1, ce.current = "idle", o && typeof window < "u" && (window.history.pushState = o), c && typeof window < "u" && window.removeEventListener("popstate", c);
30233
30238
  let t = i || C.current, n = ie.current, r = ae.current;
30234
30239
  if (t?.endSession?.().catch(() => {}), n && l && s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowengage/react-chatbot",
3
- "version": "5.0.50",
3
+ "version": "5.0.52",
4
4
  "description": "Embeddable AI chat widget for React — powered by FlowEngage. Drop it in with a single siteId.",
5
5
  "keywords": [
6
6
  "chatbot",