@wexio/messenger-widget-react 1.1.5 → 1.2.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.
- package/CHANGELOG.md +603 -0
- package/dist/widget-react--D5-TDqS.js +475 -0
- package/dist/{widget-react-D9b9f-j_2.js → widget-react-2tTH7-bO.js} +1 -1
- package/dist/{widget-react-GkCAcRz0.js → widget-react-B8rXZyxg.js} +1 -1
- package/dist/widget-react-B9X7Tn7t.js +125 -0
- package/dist/{widget-react-D7Q1S5E02.js → widget-react-BPNfTldJ.js} +134 -121
- package/dist/{widget-react-NffhFueH.js → widget-react-BlTmXnei.js} +2 -2
- package/dist/{widget-react-D_1wQTaz.js → widget-react-CIy9jXND.js} +2 -2
- package/dist/widget-react-CVLHwRZh.js +21619 -0
- package/dist/{widget-react-DWO5MXt62.js → widget-react-CtvdaJvy.js} +5 -5
- package/dist/widget-react-D8-Z8fvu.js +323 -0
- package/dist/{widget-react-NUWScxeE2.js → widget-react-DF5yY9sQ.js} +120 -108
- package/dist/widget-react-DNFROpaS.js +262 -0
- package/dist/{widget-react-BhdM1EXE2.js → widget-react-DXP6EOCM.js} +1 -1
- package/dist/{widget-react-BDd1HJHs.js → widget-react-DejnNTzJ.js} +36 -36
- package/dist/{widget-react-Br8qtj152.js → widget-react-DubCiNev.js} +5 -5
- package/dist/{widget-react-BVRYDaf5.js → widget-react-faSyVXFQ.js} +2 -2
- package/dist/{widget-react-BGCZpMUT.js → widget-react-krPPnv02.js} +1 -1
- package/dist/widget-react.js +14513 -6394
- package/package.json +3 -2
- package/dist/widget-react--A4IVF5N2.js +0 -359
- package/dist/widget-react-BFgpQWPW.js +0 -7733
- package/dist/widget-react-BGmjRit12.js +0 -359
- package/dist/widget-react-BJN4_XqD.js +0 -359
- package/dist/widget-react-BepZON2O.js +0 -359
- package/dist/widget-react-BirV4fjr.js +0 -359
- package/dist/widget-react-BjeN5jDi.js +0 -359
- package/dist/widget-react-Blj9taMI2.js +0 -359
- package/dist/widget-react-Bpjcku_E.js +0 -359
- package/dist/widget-react-Br-jpQBt.js +0 -359
- package/dist/widget-react-C4jVLX4O.js +0 -359
- package/dist/widget-react-CMn2M4G7.js +0 -359
- package/dist/widget-react-CPIqSc_J.js +0 -359
- package/dist/widget-react-CPnUEeex.js +0 -9907
- package/dist/widget-react-CVrATfkA.js +0 -359
- package/dist/widget-react-CeQaem4N2.js +0 -126
- package/dist/widget-react-CkDPMun5.js +0 -359
- package/dist/widget-react-Cp0KM0D6.js +0 -359
- package/dist/widget-react-Cs_ooZdD.js +0 -359
- package/dist/widget-react-Csr68eN1.js +0 -359
- package/dist/widget-react-CxzW4Bam.js +0 -359
- package/dist/widget-react-D00lhVJW.js +0 -359
- package/dist/widget-react-DM5ptbez2.js +0 -359
- package/dist/widget-react-DU5Wg6Cl.js +0 -359
- package/dist/widget-react-DYBhHaDC.js +0 -359
- package/dist/widget-react-DZxVgDlM2.js +0 -359
- package/dist/widget-react-Dhi-efUB2.js +0 -359
- package/dist/widget-react-DmQP1bcj.js +0 -4293
- package/dist/widget-react-Dvze5gXC.js +0 -359
- package/dist/widget-react-H0QV1X13.js +0 -359
- package/dist/widget-react-JcQ9Xwb6.js +0 -359
- package/dist/widget-react-LjYTh4EJ.js +0 -359
- package/dist/widget-react-M3D_BLuT.js +0 -359
- package/dist/widget-react-O_BU6qSC.js +0 -359
- package/dist/widget-react-TB2Eoyvi2.js +0 -263
- package/dist/widget-react-WSHbDgKs.js +0 -359
- package/dist/widget-react-_6vfCiAZ.js +0 -359
- package/dist/widget-react-e8MoPThS2.js +0 -359
|
@@ -11,10 +11,10 @@ import "react";
|
|
|
11
11
|
import "react-dom";
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
|
-
import { i as e, n as t } from "./widget-react-
|
|
15
|
-
import { t as n } from "./widget-react-
|
|
16
|
-
import { n as r, r as i, t as a } from "./widget-react-
|
|
17
|
-
import { t as o } from "./widget-react-
|
|
14
|
+
import { i as e, n as t } from "./widget-react-krPPnv02.js";
|
|
15
|
+
import { t as n } from "./widget-react-CIy9jXND.js";
|
|
16
|
+
import { n as r, r as i, t as a } from "./widget-react-faSyVXFQ.js";
|
|
17
|
+
import { t as o } from "./widget-react-2tTH7-bO.js";
|
|
18
18
|
import { memo as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
19
19
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
20
20
|
//#region node_modules/@wavesurfer/react/dist/index.js
|
|
@@ -361,4 +361,4 @@ function A(e, t) {
|
|
|
361
361
|
//#endregion
|
|
362
362
|
export { O as AudioBubblePlayer };
|
|
363
363
|
|
|
364
|
-
//# sourceMappingURL=widget-react-
|
|
364
|
+
//# sourceMappingURL=widget-react-CtvdaJvy.js.map
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
nextTick: function(e) {
|
|
4
|
+
setTimeout(e, 0);
|
|
5
|
+
},
|
|
6
|
+
emit: function() {
|
|
7
|
+
return !1;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
import "react";
|
|
11
|
+
import "react-dom";
|
|
12
|
+
import "react/jsx-runtime";
|
|
13
|
+
import "react-dom/client";
|
|
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-CVLHwRZh.js";
|
|
16
|
+
import { i as p, n as m } from "./widget-react-krPPnv02.js";
|
|
17
|
+
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
18
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
19
|
+
//#region lib/detect-html.ts
|
|
20
|
+
function S(e) {
|
|
21
|
+
if (!e) return !1;
|
|
22
|
+
let t = e.trimStart().slice(0, 200);
|
|
23
|
+
return /^<(?:[a-z!][^>]*|!--)/i.test(t);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region lib/graphql/generated/types.ts
|
|
27
|
+
var C = /* @__PURE__ */ function(e) {
|
|
28
|
+
return e.HTML = "HTML", e.MARKDOWN = "MARKDOWN", e;
|
|
29
|
+
}({}), w = /* @__PURE__ */ function(e) {
|
|
30
|
+
return e.HELP = "HELP", e.NEWS = "NEWS", e;
|
|
31
|
+
}({});
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region lib/use-article-title-sink.ts
|
|
34
|
+
function T(e, t) {
|
|
35
|
+
g(() => {
|
|
36
|
+
if (t) return e && t(e), () => t(null);
|
|
37
|
+
}, [e, t]);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region lib/use-demo-translator.ts
|
|
41
|
+
var E = ["en", "uk"];
|
|
42
|
+
async function D(e) {
|
|
43
|
+
switch (e) {
|
|
44
|
+
case "uk": return (await import("./widget-react-B9X7Tn7t.js")).default;
|
|
45
|
+
default: return (await import("./widget-react-DNFROpaS.js")).default;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function O(e) {
|
|
49
|
+
return (t) => {
|
|
50
|
+
let n = e;
|
|
51
|
+
for (let e of t.split(".")) if (n && typeof n == "object" && e in n) n = n[e];
|
|
52
|
+
else return;
|
|
53
|
+
return n;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function k(e, t) {
|
|
57
|
+
let [n, r] = y(null);
|
|
58
|
+
return g(() => {
|
|
59
|
+
let t = !0;
|
|
60
|
+
return D(e).then((e) => {
|
|
61
|
+
t && r({ raw: O(e) });
|
|
62
|
+
}), () => {
|
|
63
|
+
t = !1;
|
|
64
|
+
};
|
|
65
|
+
}, [e]), n ?? t;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region lib/article-prose.ts
|
|
69
|
+
var A = (/* @__PURE__ */ "prose max-w-none text-sm leading-relaxed text-wx-fg,[&_p]:my-3 [&_strong]:font-semibold [&_em]:italic,[&_a]:text-wx-primary [&_a]:underline [&_a]:underline-offset-2,[&_a]:transition-opacity [&_a:hover]:opacity-70,[&_code]:rounded-[6px] [&_code]:bg-wx-bg-elevated [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em],[&_pre]:my-4 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:border [&_pre]:border-wx-border,[&_pre]:bg-[#0f1115] [&_pre]:text-zinc-100 [&_pre]:p-4 [&_pre]:text-[12.5px] [&_pre]:leading-relaxed,[&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-zinc-100,[&_.hljs-keyword]:text-violet-300 [&_.hljs-built_in]:text-violet-300 [&_.hljs-type]:text-violet-300,[&_.hljs-string]:text-emerald-300,[&_.hljs-number]:text-amber-300 [&_.hljs-literal]:text-amber-300,[&_.hljs-comment]:text-zinc-500 [&_.hljs-comment]:italic,[&_.hljs-attr]:text-sky-300 [&_.hljs-attribute]:text-sky-300,[&_.hljs-title]:text-zinc-100 [&_.hljs-title]:font-medium,[&_.hljs-tag]:text-rose-300 [&_.hljs-name]:text-rose-300,[&_h1]:mt-6 [&_h1]:mb-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:tracking-tight,[&_h2]:mt-5 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold [&_h2]:tracking-tight,[&_h3]:mt-4 [&_h3]:mb-1.5 [&_h3]:text-sm [&_h3]:font-semibold,[&_h1]:scroll-mt-16 [&_h2]:scroll-mt-16 [&_h3]:scroll-mt-16,[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:marker:text-wx-fg-subtle,[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:marker:text-wx-fg-subtle,[&_li]:my-1,[&_ul[data-type=taskList]]:list-none! [&_ul[data-type=taskList]]:pl-0!,[&_ul[data-type=taskList]_li]:my-1.5 [&_ul[data-type=taskList]_li]:flex! [&_ul[data-type=taskList]_li]:items-start [&_ul[data-type=taskList]_li]:gap-2 [&_ul[data-type=taskList]_li]:pl-0,[&_ul[data-type=taskList]_li]:marker:content-none,[&_ul[data-type=taskList]_li>label]:m-0 [&_ul[data-type=taskList]_li>label]:inline-flex [&_ul[data-type=taskList]_li>label]:h-5 [&_ul[data-type=taskList]_li>label]:items-center [&_ul[data-type=taskList]_li>label]:shrink-0 [&_ul[data-type=taskList]_li>label]:select-none,[&_ul[data-type=taskList]_li>label]:pointer-events-none [&_ul[data-type=taskList]_li>label]:cursor-default,[&_ul[data-type=taskList]_input]:accent-wx-primary [&_ul[data-type=taskList]_input]:h-3.5 [&_ul[data-type=taskList]_input]:w-3.5,[&_ul[data-type=taskList]_li>label>span]:hidden,[&_ul[data-type=taskList]_li>div]:min-w-0 [&_ul[data-type=taskList]_li>div]:flex-1,[&_ul[data-type=taskList]_li>div>p]:my-0! [&_ul[data-type=taskList]_li>div>p]:leading-snug,[&_ul[data-type=taskList]_li[data-checked=true]>div]:text-wx-fg-muted [&_ul[data-type=taskList]_li[data-checked=true]>div]:line-through,[&_blockquote]:my-4 [&_blockquote]:border-l-2 [&_blockquote]:border-wx-primary/40,[&_blockquote]:pl-3 [&_blockquote]:italic [&_blockquote]:text-wx-fg-muted,[&_hr]:my-6 [&_hr]:border-wx-border,[&_img]:my-3 [&_img]:mx-auto [&_img]:block [&_img]:max-w-full,[&_figure]:my-5 [&_figure]:flex [&_figure]:flex-col [&_figure]:items-center [&_figure]:text-center,[&_figure_img]:my-0,[&_figcaption]:mt-2 [&_figcaption]:text-xs [&_figcaption]:italic [&_figcaption]:text-wx-fg-muted,[&_table]:my-3 [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse [&_table]:text-xs,[&_table]:overflow-hidden [&_table]:rounded-lg [&_table]:border [&_table]:border-wx-border,[&_thead]:bg-wx-bg-elevated,[&_th]:px-2.5 [&_th]:py-1.5 [&_th]:text-left [&_th]:font-medium [&_th]:text-wx-fg,[&_th]:border-b [&_th]:border-wx-border,[&_th+th]:border-l [&_th+th]:border-wx-border,[&_td]:px-2.5 [&_td]:py-1.5 [&_td]:text-wx-fg [&_td]:align-top,[&_td+td]:border-l [&_td+td]:border-wx-border,[&_tbody_tr]:border-t [&_tbody_tr]:border-wx-border,[&_tbody_tr:nth-child(odd)]:bg-wx-bg-elevated/40,[&_th_p]:my-0 [&_td_p]:my-0 [&_th_p]:inline [&_td_p]:inline,[&_details]:my-2 [&_details]:overflow-hidden [&_details]:rounded-lg [&_details]:border [&_details]:border-wx-border [&_details]:bg-wx-bg-elevated/40,[&_details+details]:mt-2,[&_summary]:relative [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:px-4 [&_summary]:py-3,[&_summary]:pr-10 [&_summary]:text-sm [&_summary]:font-medium [&_summary]:text-wx-fg,[&_summary::-webkit-details-marker]:hidden [&_summary::marker]:hidden,[&_summary]:after:absolute [&_summary]:after:right-4 [&_summary]:after:top-1/2,[&_summary]:after:-translate-y-1/2 [&_summary]:after:text-wx-fg-subtle,[&_summary]:after:text-base [&_summary]:after:leading-none,[&_summary]:after:transition-transform [&_summary]:after:content-['\\203A'],[&_details[open]_summary]:after:rotate-90,[&_details[open]_summary]:border-b [&_details[open]_summary]:border-wx-border,[&_details]:[&>:not(summary)]:px-4 [&_details]:[&>:not(summary)]:py-3,[&_details]:[&>:not(summary):first-of-type]:pt-3".split(",")).join(" ");
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region components/widget/article-body.tsx
|
|
72
|
+
function j({ content: e, isHtml: t, markdownMarginClass: n }) {
|
|
73
|
+
return t ? /* @__PURE__ */ b(c, {
|
|
74
|
+
html: e,
|
|
75
|
+
className: `mt-0 ${A}`
|
|
76
|
+
}) : /* @__PURE__ */ b("div", {
|
|
77
|
+
className: `${n} ${A}`,
|
|
78
|
+
children: /* @__PURE__ */ b(i, {
|
|
79
|
+
remarkPlugins: [o],
|
|
80
|
+
children: e
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region components/widget/language-selector/index.tsx
|
|
86
|
+
function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, className: c }) {
|
|
87
|
+
let l = p("languageSelector"), [d, h] = y(!1), _ = v(null);
|
|
88
|
+
g(() => {
|
|
89
|
+
if (!d) return;
|
|
90
|
+
let e = (e) => {
|
|
91
|
+
_.current && !_.current.contains(e.target) && h(!1);
|
|
92
|
+
}, t = (e) => {
|
|
93
|
+
e.key === "Escape" && h(!1);
|
|
94
|
+
};
|
|
95
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
96
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
97
|
+
};
|
|
98
|
+
}, [d]);
|
|
99
|
+
let S = o && o.length > 0 ? new Set(o.map((e) => e.split("-")[0].toLowerCase())) : null, C = Array.from(new Set(a.filter(Boolean))).filter((e) => !S || S.has(e.split("-")[0].toLowerCase()));
|
|
100
|
+
if (C.length <= 1) return null;
|
|
101
|
+
let w = i.split("-")[0].toLowerCase();
|
|
102
|
+
return /* @__PURE__ */ x("div", {
|
|
103
|
+
ref: _,
|
|
104
|
+
className: m("relative", c),
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ b("p", {
|
|
107
|
+
className: "mb-1.5 text-xs font-semibold tracking-wide text-wx-fg-muted uppercase",
|
|
108
|
+
children: l("title")
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ x("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
onClick: () => h((e) => !e),
|
|
113
|
+
"aria-haspopup": "listbox",
|
|
114
|
+
"aria-expanded": d,
|
|
115
|
+
"aria-label": l("ariaLabel"),
|
|
116
|
+
className: m("flex w-full items-center gap-2 rounded-wx-sm border border-wx-border bg-wx-bg px-3 py-2", "text-sm font-medium text-wx-fg transition-colors hover:bg-wx-bg-elevated", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary"),
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ b(r, {
|
|
119
|
+
size: 15,
|
|
120
|
+
className: "shrink-0 text-wx-fg-muted"
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ b("span", {
|
|
123
|
+
className: "min-w-0 flex-1 truncate text-left",
|
|
124
|
+
children: f(i)
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ b(t, {
|
|
127
|
+
size: 15,
|
|
128
|
+
className: m("shrink-0 text-wx-fg-subtle transition-transform", d && "rotate-180")
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ b(u, { children: d && /* @__PURE__ */ b(e.ul, {
|
|
133
|
+
initial: {
|
|
134
|
+
opacity: 0,
|
|
135
|
+
y: 4
|
|
136
|
+
},
|
|
137
|
+
animate: {
|
|
138
|
+
opacity: 1,
|
|
139
|
+
y: 0
|
|
140
|
+
},
|
|
141
|
+
exit: {
|
|
142
|
+
opacity: 0,
|
|
143
|
+
y: 4
|
|
144
|
+
},
|
|
145
|
+
transition: { duration: .14 },
|
|
146
|
+
className: m("absolute bottom-full left-0 z-20 mb-1 max-h-56 w-full overflow-auto", "rounded-wx-sm border border-wx-border bg-wx-bg py-1 shadow-[0_12px_32px_rgba(0,0,0,0.16)]"),
|
|
147
|
+
role: "listbox",
|
|
148
|
+
children: C.map((e) => {
|
|
149
|
+
let t = e.split("-")[0].toLowerCase() === w;
|
|
150
|
+
return /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
role: "option",
|
|
153
|
+
"aria-selected": t,
|
|
154
|
+
onClick: () => {
|
|
155
|
+
s(e), h(!1);
|
|
156
|
+
},
|
|
157
|
+
className: m("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors", t ? "font-semibold text-wx-primary" : "text-wx-fg hover:bg-wx-bg-elevated"),
|
|
158
|
+
children: [/* @__PURE__ */ b("span", {
|
|
159
|
+
className: "min-w-0 flex-1 truncate",
|
|
160
|
+
children: f(e)
|
|
161
|
+
}), t && /* @__PURE__ */ b(n, {
|
|
162
|
+
size: 15,
|
|
163
|
+
className: "shrink-0 text-wx-primary"
|
|
164
|
+
})]
|
|
165
|
+
}) }, e);
|
|
166
|
+
})
|
|
167
|
+
}) })
|
|
168
|
+
]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region lib/graphql/queries/generated/reactions.generated.tsx
|
|
173
|
+
var N = {}, P = l`
|
|
174
|
+
query VisitorReactionSet($surface: ReactionSurface!) {
|
|
175
|
+
visitorReactionSet(surface: $surface) {
|
|
176
|
+
_id
|
|
177
|
+
surface
|
|
178
|
+
enabled
|
|
179
|
+
slots {
|
|
180
|
+
slotIndex
|
|
181
|
+
emoji
|
|
182
|
+
sentiment
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
`;
|
|
187
|
+
function F(e) {
|
|
188
|
+
return a(P, {
|
|
189
|
+
...N,
|
|
190
|
+
...e
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
var I = l`
|
|
194
|
+
mutation SubmitVisitorReaction($input: VisitorReactionInput!) {
|
|
195
|
+
submitVisitorReaction(input: $input) {
|
|
196
|
+
ok
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
function L(e) {
|
|
201
|
+
return s(I, {
|
|
202
|
+
...N,
|
|
203
|
+
...e
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region components/widget/reaction-bar.tsx
|
|
208
|
+
var R = (e, t) => `wexio:reaction:${e}:${t}`, z = [
|
|
209
|
+
{
|
|
210
|
+
slotIndex: 0,
|
|
211
|
+
emoji: "🎉"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
slotIndex: 1,
|
|
215
|
+
emoji: "❤️"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
slotIndex: 2,
|
|
219
|
+
emoji: "👍"
|
|
220
|
+
}
|
|
221
|
+
], B = {
|
|
222
|
+
[w.NEWS]: "NewsPost",
|
|
223
|
+
[w.HELP]: "HelpArticle"
|
|
224
|
+
};
|
|
225
|
+
function V({ surface: t, itemId: n, reactionCounts: r, viewerReaction: i, groupItemIds: a, readonly: o = !1, showCounts: s = !0, isDummy: c = !1, className: l }) {
|
|
226
|
+
let u = p("reactions"), f = d(), { data: v, loading: S } = F({
|
|
227
|
+
variables: { surface: t },
|
|
228
|
+
fetchPolicy: "cache-first",
|
|
229
|
+
skip: c
|
|
230
|
+
}), [C, { loading: w }] = L(), T = _(() => c ? z : v?.visitorReactionSet?.slots ?? [], [c, v]), E = c ? !0 : v?.visitorReactionSet?.enabled ?? !0, D = R(t, n), [O, k] = y(null);
|
|
231
|
+
g(() => {
|
|
232
|
+
if (!c) {
|
|
233
|
+
k(i ?? null);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (typeof window > "u") return;
|
|
237
|
+
let e = window.localStorage.getItem(D);
|
|
238
|
+
k(e === null ? null : Number(e));
|
|
239
|
+
}, [
|
|
240
|
+
c,
|
|
241
|
+
D,
|
|
242
|
+
i
|
|
243
|
+
]);
|
|
244
|
+
let [A, j] = y({}), M = (e) => (r?.[String(e)] ?? 0) + (c ? A[e] ?? 0 : 0), N = h((e, r) => {
|
|
245
|
+
let i = B[t], o = a?.length ? a : [n];
|
|
246
|
+
for (let t of o) {
|
|
247
|
+
let n = f.cache.identify({
|
|
248
|
+
__typename: i,
|
|
249
|
+
_id: t
|
|
250
|
+
});
|
|
251
|
+
n && f.cache.modify({
|
|
252
|
+
id: n,
|
|
253
|
+
fields: {
|
|
254
|
+
viewerReaction: () => r,
|
|
255
|
+
reactionCounts: (t) => {
|
|
256
|
+
let n = { ...t ?? {} };
|
|
257
|
+
return r !== null && (n[r] = (n[r] ?? 0) + 1), e !== null && (n[e] = Math.max(0, (n[e] ?? 0) - 1)), n;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}, [
|
|
263
|
+
f,
|
|
264
|
+
t,
|
|
265
|
+
a,
|
|
266
|
+
n
|
|
267
|
+
]), P = async (e) => {
|
|
268
|
+
if (o || w || O === e) return;
|
|
269
|
+
let r = O;
|
|
270
|
+
if (k(e), c) {
|
|
271
|
+
typeof window < "u" && window.localStorage.setItem(D, String(e)), j((t) => ({
|
|
272
|
+
...t,
|
|
273
|
+
[e]: (t[e] ?? 0) + 1,
|
|
274
|
+
...r === null ? {} : { [r]: (t[r] ?? 0) - 1 }
|
|
275
|
+
}));
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
N(r, e);
|
|
279
|
+
try {
|
|
280
|
+
await C({ variables: { input: {
|
|
281
|
+
surface: t,
|
|
282
|
+
itemId: n,
|
|
283
|
+
slotIndex: e
|
|
284
|
+
} } });
|
|
285
|
+
} catch {
|
|
286
|
+
N(e, r), k(r);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
return S || !E || T.length === 0 ? null : /* @__PURE__ */ b("div", {
|
|
290
|
+
className: m("flex flex-wrap items-center justify-center gap-2", l),
|
|
291
|
+
role: "group",
|
|
292
|
+
"aria-label": u("ariaLabel"),
|
|
293
|
+
children: T.map((t) => {
|
|
294
|
+
let n = O === t.slotIndex, r = M(t.slotIndex);
|
|
295
|
+
return /* @__PURE__ */ x(e.button, {
|
|
296
|
+
type: "button",
|
|
297
|
+
disabled: o || w,
|
|
298
|
+
onClick: () => void P(t.slotIndex),
|
|
299
|
+
whileTap: { scale: .9 },
|
|
300
|
+
whileHover: { scale: 1.06 },
|
|
301
|
+
transition: {
|
|
302
|
+
type: "spring",
|
|
303
|
+
stiffness: 400,
|
|
304
|
+
damping: 18
|
|
305
|
+
},
|
|
306
|
+
className: m("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-2xl leading-none transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary", n ? "bg-wx-primary/10 ring-1 ring-wx-primary/40" : "hover:bg-wx-bg-elevated", o && "cursor-default opacity-70"),
|
|
307
|
+
"aria-pressed": n,
|
|
308
|
+
"aria-label": u("tapAria", { emoji: t.emoji }),
|
|
309
|
+
children: [/* @__PURE__ */ b("span", {
|
|
310
|
+
"aria-hidden": "true",
|
|
311
|
+
children: t.emoji
|
|
312
|
+
}), s && r > 0 && /* @__PURE__ */ b("span", {
|
|
313
|
+
className: "text-xs font-medium text-wx-fg-muted",
|
|
314
|
+
children: r
|
|
315
|
+
})]
|
|
316
|
+
}, t.slotIndex);
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
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
|
+
|
|
323
|
+
//# sourceMappingURL=widget-react-D8-Z8fvu.js.map
|