@wexio/messenger-widget-react 1.2.1 → 1.2.3
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.
- package/CHANGELOG.md +18 -0
- package/README.md +4 -0
- package/dist/{widget-react--D5-TDqS.js → widget-react-AwEaD0v2.js} +2 -2
- package/dist/{widget-react-DF5yY9sQ.js → widget-react-CAsPo1rw.js} +4 -4
- package/dist/{widget-react-CVLHwRZh.js → widget-react-CK8xTxwO.js} +34 -22
- package/dist/{widget-react-D8-Z8fvu.js → widget-react-DDEFbIbU.js} +2 -2
- package/dist/{widget-react-DejnNTzJ.js → widget-react-DV3UnggB.js} +2 -2
- package/dist/{widget-react-BPNfTldJ.js → widget-react-yTVzOzaU.js} +4 -4
- package/dist/widget-react.js +7 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @wexio/messenger-widget-react
|
|
2
2
|
|
|
3
|
+
## 1.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 146aa5f: Make notification sounds far lighter, two changes:
|
|
8
|
+
|
|
9
|
+
1. **Lazy loading.** The inbound/outbound `Audio` elements were built with `preload="auto"`, so both sound files were fetched on every page load the widget was embedded on, even for visitors who never opened the chat. They now use `preload="none"` (with `src` set after `preload`), so a sound downloads lazily on its first `play()`, which is always user-gesture triggered.
|
|
10
|
+
|
|
11
|
+
2. **MP3 instead of WAV.** The 21 preset sounds were uncompressed WAV (~17MB total, individual files up to ~1.7MB). They are now 128kbps MP3 (~2MB total, ~16-52KB each). Preset ids resolve to `/sounds/wx-nt_*.mp3`; operator-uploaded custom sounds (full URLs) are unaffected.
|
|
12
|
+
|
|
13
|
+
Together this removes ~3.6MB from the host page's initial load and makes the lazy first-play near-instant. No API or behavior change.
|
|
14
|
+
|
|
15
|
+
## 1.2.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 948dbaf: Fix website page-view tracking reporting the PREVIOUS page's title after a SPA navigation. The host router changes the URL synchronously but updates `document.title` a tick later, so the title was read too early. Both capture paths (the iframe `loader.js` and the web-component provider) now wait for `<title>` to actually update (via a `MutationObserver`, with a short timeout fallback) before reporting, so the title matches the new URL.
|
|
20
|
+
|
|
3
21
|
## 1.2.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -177,6 +177,10 @@ For plain HTML / script-injection setups, paste the loader snippet from https://
|
|
|
177
177
|
|
|
178
178
|
Give a ⭐️ if this package helped you!
|
|
179
179
|
|
|
180
|
+
## Changelog
|
|
181
|
+
|
|
182
|
+
See the [Releases](https://github.com/wexiohub/messenger-widget-react/releases) page for the full changelog.
|
|
183
|
+
|
|
180
184
|
## 📝 License
|
|
181
185
|
|
|
182
186
|
This project is [MIT](./LICENSE) licensed.
|
|
@@ -11,7 +11,7 @@ import "react";
|
|
|
11
11
|
import "react-dom";
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
|
-
import { S as e, at as t, it as n, j as r, ot as i } from "./widget-react-
|
|
14
|
+
import { S as e, at as t, it as n, j as r, ot as i } from "./widget-react-CK8xTxwO.js";
|
|
15
15
|
import { n as a, r as o } from "./widget-react-krPPnv02.js";
|
|
16
16
|
import * as s from "react";
|
|
17
17
|
import { jsx as c } from "react/jsx-runtime";
|
|
@@ -472,4 +472,4 @@ function G(e) {
|
|
|
472
472
|
//#endregion
|
|
473
473
|
export { G as a, U as c, _ as d, f, L as i, z as l, V as n, j as o, u as p, F as r, N as s, k as t, D as u };
|
|
474
474
|
|
|
475
|
-
//# sourceMappingURL=widget-react
|
|
475
|
+
//# sourceMappingURL=widget-react-AwEaD0v2.js.map
|
|
@@ -12,11 +12,11 @@ import "react-dom";
|
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
14
|
import { i as e } from "./widget-react-B9XrHKqv.js";
|
|
15
|
-
import { I as t, N as n, c as r, k as i, l as a, v as o, y as s } from "./widget-react-
|
|
15
|
+
import { I as t, N as n, c as r, k as i, l as a, v as o, y as s } from "./widget-react-CK8xTxwO.js";
|
|
16
16
|
import { i as c, n as l } from "./widget-react-krPPnv02.js";
|
|
17
|
-
import { f as u, l as d, n as f, r as p, u as m } from "./widget-react
|
|
17
|
+
import { f as u, l as d, n as f, r as p, u as m } from "./widget-react-AwEaD0v2.js";
|
|
18
18
|
import { t as h } from "./widget-react-B8rXZyxg.js";
|
|
19
|
-
import { a as g, c as ee, i as te, l as ne, n as _, o as v, r as y, s as b, t as x } from "./widget-react-
|
|
19
|
+
import { a as g, c as ee, i as te, l as ne, n as _, o as v, r as y, s as b, t as x } from "./widget-react-DDEFbIbU.js";
|
|
20
20
|
import { useEffect as S, useMemo as C, useRef as w, useState as re } from "react";
|
|
21
21
|
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
22
22
|
//#region components/widget/help-article-view/helpers.ts
|
|
@@ -303,4 +303,4 @@ function ie() {
|
|
|
303
303
|
//#endregion
|
|
304
304
|
export { O as HelpArticleView };
|
|
305
305
|
|
|
306
|
-
//# sourceMappingURL=widget-react-
|
|
306
|
+
//# sourceMappingURL=widget-react-CAsPo1rw.js.map
|
|
@@ -9957,7 +9957,7 @@ function ip() {
|
|
|
9957
9957
|
return w(rp);
|
|
9958
9958
|
}
|
|
9959
9959
|
function ap({ children: e, tracking: t, enabled: n, token: r }) {
|
|
9960
|
-
let i = md(), [a] = Mu(), [o] = Pu(), s = n && (t?.trackWebsitePages ?? !0), c = n && (t?.trackWidgetLinks ?? !0), l = ne([]), u = ne(null), d = ne(null), f = C((e) => {
|
|
9960
|
+
let i = md(), [a] = Mu(), [o] = Pu(), s = n && (t?.trackWebsitePages ?? !0), c = n && (t?.trackWidgetLinks ?? !0), l = ne([]), u = ne(null), d = ne(null), f = ne(null), p = C((e) => {
|
|
9961
9961
|
td() ? e.kind === "page" ? a({ variables: { input: e.input } }).catch(() => {}) : o({ variables: { input: e.input } }).catch(() => {}) : l.current = np(l.current, e, 50);
|
|
9962
9962
|
}, [a, o]);
|
|
9963
9963
|
T(() => {
|
|
@@ -9972,9 +9972,9 @@ function ap({ children: e, tracking: t, enabled: n, token: r }) {
|
|
|
9972
9972
|
]), T(() => () => {
|
|
9973
9973
|
d.current && clearTimeout(d.current);
|
|
9974
9974
|
}, []);
|
|
9975
|
-
let
|
|
9975
|
+
let m = C((e, t) => {
|
|
9976
9976
|
!s || !e || u.current && tp(u.current, e) || (d.current && clearTimeout(d.current), d.current = setTimeout(() => {
|
|
9977
|
-
u.current = e,
|
|
9977
|
+
u.current = e, p({
|
|
9978
9978
|
kind: "page",
|
|
9979
9979
|
input: {
|
|
9980
9980
|
url: e,
|
|
@@ -9984,8 +9984,8 @@ function ap({ children: e, tracking: t, enabled: n, token: r }) {
|
|
|
9984
9984
|
}
|
|
9985
9985
|
});
|
|
9986
9986
|
}, 500));
|
|
9987
|
-
}, [s,
|
|
9988
|
-
!c || !e.url ||
|
|
9987
|
+
}, [s, p]), h = C((e) => {
|
|
9988
|
+
!c || !e.url || p({
|
|
9989
9989
|
kind: "link",
|
|
9990
9990
|
input: {
|
|
9991
9991
|
url: e.url,
|
|
@@ -9996,42 +9996,54 @@ function ap({ children: e, tracking: t, enabled: n, token: r }) {
|
|
|
9996
9996
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
9997
9997
|
}
|
|
9998
9998
|
});
|
|
9999
|
-
}, [c,
|
|
9999
|
+
}, [c, p]);
|
|
10000
10000
|
return T(() => {
|
|
10001
10001
|
if (!s || typeof window > "u") return;
|
|
10002
10002
|
if (i.kind === "iframe") {
|
|
10003
10003
|
let e = (e) => {
|
|
10004
10004
|
let t = e.data;
|
|
10005
|
-
!t || typeof t != "object" || t.type !== "wexio:host-navigation:v1" || typeof t.url == "string" &&
|
|
10005
|
+
!t || typeof t != "object" || t.type !== "wexio:host-navigation:v1" || typeof t.url == "string" && m(t.url, {
|
|
10006
10006
|
title: typeof t.title == "string" ? t.title : void 0,
|
|
10007
10007
|
referrer: typeof t.referrer == "string" ? t.referrer : void 0
|
|
10008
10008
|
});
|
|
10009
10009
|
};
|
|
10010
10010
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
10011
10011
|
}
|
|
10012
|
-
let e = () =>
|
|
10012
|
+
let e = () => m(window.location.href, {
|
|
10013
10013
|
title: document.title,
|
|
10014
10014
|
referrer: document.referrer
|
|
10015
|
-
})
|
|
10015
|
+
}), t = () => {
|
|
10016
|
+
f.current?.();
|
|
10017
|
+
let t = document.querySelector("title"), n = !1, r = () => {
|
|
10018
|
+
o?.disconnect(), clearTimeout(a), f.current = null;
|
|
10019
|
+
}, i = () => {
|
|
10020
|
+
n || (n = !0, r(), e());
|
|
10021
|
+
}, a = setTimeout(i, 600), o = null;
|
|
10022
|
+
t && typeof MutationObserver < "u" && (o = new MutationObserver(i), o.observe(t, {
|
|
10023
|
+
childList: !0,
|
|
10024
|
+
characterData: !0,
|
|
10025
|
+
subtree: !0
|
|
10026
|
+
})), f.current = r;
|
|
10027
|
+
};
|
|
10016
10028
|
e();
|
|
10017
|
-
let
|
|
10018
|
-
return window.history.pushState = function(...
|
|
10019
|
-
let r =
|
|
10020
|
-
return
|
|
10021
|
-
}, window.history.replaceState = function(...
|
|
10022
|
-
let
|
|
10023
|
-
return
|
|
10024
|
-
}, window.addEventListener("popstate",
|
|
10025
|
-
window.history.pushState =
|
|
10029
|
+
let n = window.history.pushState, r = window.history.replaceState;
|
|
10030
|
+
return window.history.pushState = function(...e) {
|
|
10031
|
+
let r = n.apply(this, e);
|
|
10032
|
+
return t(), r;
|
|
10033
|
+
}, window.history.replaceState = function(...e) {
|
|
10034
|
+
let n = r.apply(this, e);
|
|
10035
|
+
return t(), n;
|
|
10036
|
+
}, window.addEventListener("popstate", t), window.addEventListener("hashchange", t), () => {
|
|
10037
|
+
f.current?.(), window.history.pushState = n, window.history.replaceState = r, window.removeEventListener("popstate", t), window.removeEventListener("hashchange", t);
|
|
10026
10038
|
};
|
|
10027
10039
|
}, [
|
|
10028
10040
|
s,
|
|
10029
10041
|
i.kind,
|
|
10030
|
-
|
|
10042
|
+
m
|
|
10031
10043
|
]), /* @__PURE__ */ O(rp.Provider, {
|
|
10032
10044
|
value: {
|
|
10033
|
-
trackPageView:
|
|
10034
|
-
trackLinkClick:
|
|
10045
|
+
trackPageView: m,
|
|
10046
|
+
trackLinkClick: h
|
|
10035
10047
|
},
|
|
10036
10048
|
children: e
|
|
10037
10049
|
});
|
|
@@ -21616,4 +21628,4 @@ function RC(e) {
|
|
|
21616
21628
|
//#endregion
|
|
21617
21629
|
export { wu as $, bd as A, ed as B, Rd as C, jd as D, Nd as E, cd as F, Au as G, Tu as H, td as I, ou as J, uu as K, ad as L, pd as M, md as N, Ad as O, ud as P, Ou as Q, rd as R, Ld as S, Pd as T, fu as U, Bu as V, bu as W, Su as X, cu as Y, vu as Z, $d as _, Ly as a, xl as at, Ud as b, ip as c, Ja as ct, ff as d, A as dt, Eu as et, df as f, le as ft, Qd as g, ef as h, VS as i, Gl as it, gd as j, xd as k, $f as l, Me as lt, sf as m, FC as n, ru as nt, op as o, G as ot, lf as p, j as pt, gu as q, IC as r, tu as rt, ap as s, Ya as st, RC as t, mu as tt, pf as u, M as ut, zd as v, Fd as w, Hd as x, Wd as y, sd as z };
|
|
21618
21630
|
|
|
21619
|
-
//# sourceMappingURL=widget-react-
|
|
21631
|
+
//# sourceMappingURL=widget-react-CK8xTxwO.js.map
|
|
@@ -12,7 +12,7 @@ import "react-dom";
|
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
14
|
import { d as e } from "./widget-react-B9XrHKqv.js";
|
|
15
|
-
import { D as t, O as n, T as r, a as i, at as a, i as o, it as s, n as c, ot as l, rt as u, st as d, t as f } from "./widget-react-
|
|
15
|
+
import { D as t, O as n, T as r, a as i, at as a, i as o, it as s, n as c, ot as l, rt as u, st as d, t as f } from "./widget-react-CK8xTxwO.js";
|
|
16
16
|
import { i as p, n as m } from "./widget-react-krPPnv02.js";
|
|
17
17
|
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
18
18
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
@@ -320,4 +320,4 @@ function V({ surface: t, itemId: n, reactionCounts: r, viewerReaction: i, groupI
|
|
|
320
320
|
//#endregion
|
|
321
321
|
export { k as a, w as c, E as i, S as l, M as n, T as o, j as r, C as s, V as t };
|
|
322
322
|
|
|
323
|
-
//# sourceMappingURL=widget-react-
|
|
323
|
+
//# sourceMappingURL=widget-react-DDEFbIbU.js.map
|
|
@@ -12,7 +12,7 @@ import "react-dom";
|
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
14
|
import { c as e, d as t } from "./widget-react-B9XrHKqv.js";
|
|
15
|
-
import { N as n, at as r, b as i, j as a, l as o, ot as s, x as c } from "./widget-react-
|
|
15
|
+
import { N as n, at as r, b as i, j as a, l as o, ot as s, x as c } from "./widget-react-CK8xTxwO.js";
|
|
16
16
|
import { i as l, n as u, o as d, t as f } from "./widget-react-krPPnv02.js";
|
|
17
17
|
import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
18
18
|
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
@@ -652,4 +652,4 @@ function Y({ item: e, locale: n, delay: r, onClick: a }) {
|
|
|
652
652
|
//#endregion
|
|
653
653
|
export { z as a, I as c, N as d, j as f, k as h, V as i, F as l, D as m, U as n, R as o, T as p, H as r, L as s, K as t, P as u };
|
|
654
654
|
|
|
655
|
-
//# sourceMappingURL=widget-react-
|
|
655
|
+
//# sourceMappingURL=widget-react-DV3UnggB.js.map
|
|
@@ -11,11 +11,11 @@ import "react";
|
|
|
11
11
|
import "react-dom";
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
|
-
import { N as e, c as t, k as n, l as r } from "./widget-react-
|
|
14
|
+
import { N as e, c as t, k as n, l as r } from "./widget-react-CK8xTxwO.js";
|
|
15
15
|
import { i, n as a, o } from "./widget-react-krPPnv02.js";
|
|
16
|
-
import { d as s, h as c, m as l, n as u, r as d } from "./widget-react-
|
|
16
|
+
import { d as s, h as c, m as l, n as u, r as d } from "./widget-react-DV3UnggB.js";
|
|
17
17
|
import { t as f } from "./widget-react-CIy9jXND.js";
|
|
18
|
-
import { a as p, c as ee, i as m, l as h, n as g, o as _, r as v, t as y } from "./widget-react-
|
|
18
|
+
import { a as p, c as ee, i as m, l as h, n as g, o as _, r as v, t as y } from "./widget-react-DDEFbIbU.js";
|
|
19
19
|
import { useEffect as b, useRef as x, useState as S } from "react";
|
|
20
20
|
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
21
21
|
//#region components/widget/news-article-view/helpers.ts
|
|
@@ -353,4 +353,4 @@ function O() {
|
|
|
353
353
|
//#endregion
|
|
354
354
|
export { D as NewsArticleView };
|
|
355
355
|
|
|
356
|
-
//# sourceMappingURL=widget-react-
|
|
356
|
+
//# sourceMappingURL=widget-react-yTVzOzaU.js.map
|
package/dist/widget-react.js
CHANGED
|
@@ -12,10 +12,10 @@ import "react-dom";
|
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
14
|
import { S as e, a as t, d as n, i as r, l as i, n as a, r as o, t as s, u as c, w as l, y as u } from "./widget-react-B9XrHKqv.js";
|
|
15
|
-
import { $ as d, A as f, B as p, C as m, D as h, E as g, F as _, G as v, H as y, J as b, K as x, L as S, M as C, N as w, O as T, P as E, Q as ee, R as D, S as O, T as k, U as te, V as A, W as j, X as M, Y as N, Z as ne, _ as re, a as ie, at as ae, c as oe, ct as se, d as P, dt as F, et as ce, f as le, ft as ue, g as I, h as L, i as de, it as R, k as fe, l as z, lt as pe, m as me, nt as he, o as ge, ot as _e, p as ve, pt as ye, q as be, r as xe, rt as Se, s as Ce, st as we, t as Te, tt as Ee, u as B, ut as De, v as Oe, w as ke, y as Ae, z as je } from "./widget-react-
|
|
15
|
+
import { $ as d, A as f, B as p, C as m, D as h, E as g, F as _, G as v, H as y, J as b, K as x, L as S, M as C, N as w, O as T, P as E, Q as ee, R as D, S as O, T as k, U as te, V as A, W as j, X as M, Y as N, Z as ne, _ as re, a as ie, at as ae, c as oe, ct as se, d as P, dt as F, et as ce, f as le, ft as ue, g as I, h as L, i as de, it as R, k as fe, l as z, lt as pe, m as me, nt as he, o as ge, ot as _e, p as ve, pt as ye, q as be, r as xe, rt as Se, s as Ce, st as we, t as Te, tt as Ee, u as B, ut as De, v as Oe, w as ke, y as Ae, z as je } from "./widget-react-CK8xTxwO.js";
|
|
16
16
|
import { a as Me, i as V, n as H, o as Ne, s as Pe, t as U } from "./widget-react-krPPnv02.js";
|
|
17
|
-
import { a as Fe, c as W, d as Ie, f as Le, i as Re, l as ze, o as Be, p as Ve, s as He, t as Ue, u as We } from "./widget-react-
|
|
18
|
-
import { a as Ge, c as Ke, d as qe, f as Je, i as Ye, o as Xe, p as Ze, s as Qe, t as $e, u as et } from "./widget-react
|
|
17
|
+
import { a as Fe, c as W, d as Ie, f as Le, i as Re, l as ze, o as Be, p as Ve, s as He, t as Ue, u as We } from "./widget-react-DV3UnggB.js";
|
|
18
|
+
import { a as Ge, c as Ke, d as qe, f as Je, i as Ye, o as Xe, p as Ze, s as Qe, t as $e, u as et } from "./widget-react-AwEaD0v2.js";
|
|
19
19
|
import { t as tt } from "./widget-react-CIy9jXND.js";
|
|
20
20
|
import { n as nt, r as rt, t as it } from "./widget-react-faSyVXFQ.js";
|
|
21
21
|
import { t as at } from "./widget-react-BlTmXnei.js";
|
|
@@ -154,7 +154,7 @@ function jt({ enabled: e, locale: t }) {
|
|
|
154
154
|
Array.from({ length: 21 }, (e, t) => `wx-nt_${t + 1}`);
|
|
155
155
|
var Mt = "wx-nt_";
|
|
156
156
|
function Nt(e) {
|
|
157
|
-
return e ? e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith(Mt) ? he(`/sounds/${e}.
|
|
157
|
+
return e ? e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith(Mt) ? he(`/sounds/${e}.mp3`) : null : null;
|
|
158
158
|
}
|
|
159
159
|
var Pt = "wexio:sound-muted";
|
|
160
160
|
//#endregion
|
|
@@ -192,8 +192,8 @@ function Ft(e) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
function It(e, t) {
|
|
195
|
-
let n = new Audio(
|
|
196
|
-
return n.preload = "
|
|
195
|
+
let n = new Audio();
|
|
196
|
+
return n.preload = "none", n.volume = t, n.src = e, n;
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region lib/use-theme-mode.ts
|
|
@@ -20127,7 +20127,7 @@ var fv = {
|
|
|
20127
20127
|
x: e > 0 ? -28 : e < 0 ? 28 : 0,
|
|
20128
20128
|
opacity: 0
|
|
20129
20129
|
})
|
|
20130
|
-
}, pv = ut(() => import("./widget-react-
|
|
20130
|
+
}, pv = ut(() => import("./widget-react-CAsPo1rw.js").then((e) => ({ default: e.HelpArticleView }))), mv = ut(() => import("./widget-react-yTVzOzaU.js").then((e) => ({ default: e.NewsArticleView }))), hv = "wexio:panel-expanded", gv = 32, _v = 112;
|
|
20131
20131
|
function vv() {
|
|
20132
20132
|
if (typeof window > "u") return !1;
|
|
20133
20133
|
try {
|
package/package.json
CHANGED