@wexio/messenger-widget-react 1.2.4 → 1.3.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 +61 -1
- package/README.md +15 -1
- package/dist/{widget-react-DubCiNev.js → widget-react--IUy5lNt.js} +21 -20
- package/dist/{widget-react-CIy9jXND.js → widget-react-B7es3n1-.js} +1 -1
- package/dist/{widget-react-2tTH7-bO.js → widget-react-BAUpSGhZ.js} +1 -1
- package/dist/widget-react-BS9kUSRS.js +255 -0
- package/dist/{widget-react-CtvdaJvy.js → widget-react-BXf2Ty8d.js} +4 -4
- package/dist/{widget-react-DDEFbIbU.js → widget-react-BfO-uP4o.js} +89 -139
- package/dist/{widget-react-faSyVXFQ.js → widget-react-BgALABDe.js} +1 -1
- package/dist/{widget-react-DXP6EOCM.js → widget-react-BkXA6ytR.js} +1 -1
- package/dist/{widget-react-yTVzOzaU.js → widget-react-Bop75Z1t.js} +87 -87
- package/dist/widget-react-BxEjM2it.js +118 -0
- package/dist/{widget-react-CK8xTxwO.js → widget-react-C6lzldez.js} +4936 -4455
- package/dist/widget-react-CN_FIvMD.js +834 -0
- package/dist/{widget-react-CAsPo1rw.js → widget-react-DRER1XF_.js} +112 -112
- package/dist/widget-react-DSAyUf2U.js +229 -0
- package/dist/{widget-react-B9XrHKqv.js → widget-react-DbOJZl9F.js} +1238 -2052
- package/dist/{widget-react-BlTmXnei.js → widget-react-DgIxSjv7.js} +1 -1
- package/dist/widget-react-Ds5J9FbQ.js +27 -0
- package/dist/{widget-react-DV3UnggB.js → widget-react-MXOCL3Mg.js} +148 -237
- package/dist/{widget-react-B8rXZyxg.js → widget-react-SI7deQTE.js} +1 -1
- package/dist/{widget-react-AwEaD0v2.js → widget-react-bPokx9L5.js} +169 -273
- package/dist/widget-react-wSc9gIfG.js +198 -0
- package/dist/widget-react.d.ts +2 -2
- package/dist/widget-react.js +9387 -4696
- package/package.json +1 -1
- package/dist/widget-react-B9X7Tn7t.js +0 -125
- package/dist/widget-react-DNFROpaS.js +0 -262
|
@@ -11,9 +11,10 @@ import "react";
|
|
|
11
11
|
import "react-dom";
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
|
-
import {
|
|
15
|
-
import { D as t,
|
|
16
|
-
import { i as
|
|
14
|
+
import { t as e } from "./widget-react-DbOJZl9F.js";
|
|
15
|
+
import { D as t, Dt as n, H as r, O as i, R as a, T as o, V as s, a as c, i as l, n as u, t as d } from "./widget-react-C6lzldez.js";
|
|
16
|
+
import { i as f, n as p } from "./widget-react-krPPnv02.js";
|
|
17
|
+
import { n as m } from "./widget-react-wSc9gIfG.js";
|
|
17
18
|
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
18
19
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
19
20
|
//#region lib/detect-html.ts
|
|
@@ -37,71 +38,43 @@ function T(e, t) {
|
|
|
37
38
|
}, [e, t]);
|
|
38
39
|
}
|
|
39
40
|
//#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
41
|
//#region lib/article-prose.ts
|
|
69
|
-
var
|
|
42
|
+
var E = (/* @__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
43
|
//#endregion
|
|
71
44
|
//#region components/widget/article-body.tsx
|
|
72
|
-
function
|
|
73
|
-
return t ? /* @__PURE__ */ b(
|
|
45
|
+
function D({ content: e, isHtml: t, markdownMarginClass: n }) {
|
|
46
|
+
return t ? /* @__PURE__ */ b(u, {
|
|
74
47
|
html: e,
|
|
75
|
-
className: `mt-0 ${
|
|
48
|
+
className: `mt-0 ${E}`
|
|
76
49
|
}) : /* @__PURE__ */ b("div", {
|
|
77
|
-
className: `${n} ${
|
|
78
|
-
children: /* @__PURE__ */ b(
|
|
79
|
-
remarkPlugins: [
|
|
50
|
+
className: `${n} ${E}`,
|
|
51
|
+
children: /* @__PURE__ */ b(c, {
|
|
52
|
+
remarkPlugins: [l],
|
|
80
53
|
children: e
|
|
81
54
|
})
|
|
82
55
|
});
|
|
83
56
|
}
|
|
84
57
|
//#endregion
|
|
85
58
|
//#region components/widget/language-selector/index.tsx
|
|
86
|
-
function
|
|
87
|
-
let l =
|
|
59
|
+
function O({ currentLocale: n, locales: r, allowedLocales: a, onSelect: s, className: c }) {
|
|
60
|
+
let l = f("languageSelector"), [u, h] = y(!1), _ = v(null);
|
|
88
61
|
g(() => {
|
|
89
|
-
if (!
|
|
62
|
+
if (!u) return;
|
|
90
63
|
let e = (e) => {
|
|
91
|
-
_.current && !
|
|
64
|
+
_.current && !e.composedPath().includes(_.current) && h(!1);
|
|
92
65
|
}, t = (e) => {
|
|
93
66
|
e.key === "Escape" && h(!1);
|
|
94
67
|
};
|
|
95
68
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
96
69
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
97
70
|
};
|
|
98
|
-
}, [
|
|
99
|
-
let S =
|
|
71
|
+
}, [u]);
|
|
72
|
+
let S = a && a.length > 0 ? new Set(a.map((e) => e.split("-")[0].toLowerCase())) : null, C = Array.from(new Set(r.filter(Boolean))).filter((e) => !S || S.has(e.split("-")[0].toLowerCase()));
|
|
100
73
|
if (C.length <= 1) return null;
|
|
101
|
-
let w =
|
|
74
|
+
let w = n.split("-")[0].toLowerCase();
|
|
102
75
|
return /* @__PURE__ */ x("div", {
|
|
103
76
|
ref: _,
|
|
104
|
-
className:
|
|
77
|
+
className: p("relative", c),
|
|
105
78
|
children: [
|
|
106
79
|
/* @__PURE__ */ b("p", {
|
|
107
80
|
className: "mb-1.5 text-xs font-semibold tracking-wide text-wx-fg-muted uppercase",
|
|
@@ -111,25 +84,25 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
111
84
|
type: "button",
|
|
112
85
|
onClick: () => h((e) => !e),
|
|
113
86
|
"aria-haspopup": "listbox",
|
|
114
|
-
"aria-expanded":
|
|
87
|
+
"aria-expanded": u,
|
|
115
88
|
"aria-label": l("ariaLabel"),
|
|
116
|
-
className:
|
|
89
|
+
className: p("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
90
|
children: [
|
|
118
|
-
/* @__PURE__ */ b(
|
|
91
|
+
/* @__PURE__ */ b(o, {
|
|
119
92
|
size: 15,
|
|
120
93
|
className: "shrink-0 text-wx-fg-muted"
|
|
121
94
|
}),
|
|
122
95
|
/* @__PURE__ */ b("span", {
|
|
123
96
|
className: "min-w-0 flex-1 truncate text-left",
|
|
124
|
-
children:
|
|
97
|
+
children: d(n)
|
|
125
98
|
}),
|
|
126
99
|
/* @__PURE__ */ b(t, {
|
|
127
100
|
size: 15,
|
|
128
|
-
className:
|
|
101
|
+
className: p("shrink-0 text-wx-fg-subtle transition-transform", u && "rotate-180")
|
|
129
102
|
})
|
|
130
103
|
]
|
|
131
104
|
}),
|
|
132
|
-
/* @__PURE__ */ b(
|
|
105
|
+
/* @__PURE__ */ b(m, { children: u && /* @__PURE__ */ b(e.ul, {
|
|
133
106
|
initial: {
|
|
134
107
|
opacity: 0,
|
|
135
108
|
y: 4
|
|
@@ -143,7 +116,7 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
143
116
|
y: 4
|
|
144
117
|
},
|
|
145
118
|
transition: { duration: .14 },
|
|
146
|
-
className:
|
|
119
|
+
className: p("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
120
|
role: "listbox",
|
|
148
121
|
children: C.map((e) => {
|
|
149
122
|
let t = e.split("-")[0].toLowerCase() === w;
|
|
@@ -154,11 +127,11 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
154
127
|
onClick: () => {
|
|
155
128
|
s(e), h(!1);
|
|
156
129
|
},
|
|
157
|
-
className:
|
|
130
|
+
className: p("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
131
|
children: [/* @__PURE__ */ b("span", {
|
|
159
132
|
className: "min-w-0 flex-1 truncate",
|
|
160
|
-
children:
|
|
161
|
-
}), t && /* @__PURE__ */ b(
|
|
133
|
+
children: d(e)
|
|
134
|
+
}), t && /* @__PURE__ */ b(i, {
|
|
162
135
|
size: 15,
|
|
163
136
|
className: "shrink-0 text-wx-primary"
|
|
164
137
|
})]
|
|
@@ -169,43 +142,8 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
169
142
|
});
|
|
170
143
|
}
|
|
171
144
|
//#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
145
|
//#region components/widget/reaction-bar.tsx
|
|
208
|
-
var
|
|
146
|
+
var k = (e, t) => `wexio:reaction:${e}:${t}`, A = [
|
|
209
147
|
{
|
|
210
148
|
slotIndex: 0,
|
|
211
149
|
emoji: "🎉"
|
|
@@ -218,84 +156,96 @@ var R = (e, t) => `wexio:reaction:${e}:${t}`, z = [
|
|
|
218
156
|
slotIndex: 2,
|
|
219
157
|
emoji: "👍"
|
|
220
158
|
}
|
|
221
|
-
],
|
|
159
|
+
], j = {
|
|
222
160
|
[w.NEWS]: "NewsPost",
|
|
223
161
|
[w.HELP]: "HelpArticle"
|
|
224
162
|
};
|
|
225
|
-
function
|
|
226
|
-
let
|
|
163
|
+
function M({ surface: t, itemId: i, reactionCounts: o, viewerReaction: c, groupItemIds: l, readonly: u = !1, showCounts: d = !0, isDummy: m = !1, className: v }) {
|
|
164
|
+
let S = f("reactions"), C = n(), { data: w, loading: T } = r({
|
|
227
165
|
variables: { surface: t },
|
|
228
166
|
fetchPolicy: "cache-first",
|
|
229
|
-
skip:
|
|
230
|
-
}), [
|
|
167
|
+
skip: m
|
|
168
|
+
}), [E, { loading: D }] = s(), O = a(), M = _(() => m ? A : w?.visitorReactionSet?.slots ?? [], [m, w]), N = m ? !0 : w?.visitorReactionSet?.enabled ?? !0, P = k(t, i), [F, I] = y(null);
|
|
231
169
|
g(() => {
|
|
232
|
-
if (!
|
|
233
|
-
|
|
170
|
+
if (!m) {
|
|
171
|
+
I(c ?? null);
|
|
234
172
|
return;
|
|
235
173
|
}
|
|
236
174
|
if (typeof window > "u") return;
|
|
237
|
-
let e = window.localStorage.getItem(
|
|
238
|
-
|
|
175
|
+
let e = window.localStorage.getItem(P);
|
|
176
|
+
I(e === null ? null : Number(e));
|
|
239
177
|
}, [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
178
|
+
m,
|
|
179
|
+
P,
|
|
180
|
+
c
|
|
243
181
|
]);
|
|
244
|
-
let [
|
|
245
|
-
let
|
|
246
|
-
for (let t of
|
|
247
|
-
let
|
|
248
|
-
__typename:
|
|
182
|
+
let [L, R] = y({}), z = (e) => (o?.[String(e)] ?? 0) + (m ? L[e] ?? 0 : 0), B = h((e, n) => {
|
|
183
|
+
let r = j[t], a = l?.length ? l : [i];
|
|
184
|
+
for (let t of a) {
|
|
185
|
+
let i = C.cache.identify({
|
|
186
|
+
__typename: r,
|
|
249
187
|
_id: t
|
|
250
188
|
});
|
|
251
|
-
|
|
252
|
-
id:
|
|
189
|
+
i && C.cache.modify({
|
|
190
|
+
id: i,
|
|
253
191
|
fields: {
|
|
254
|
-
viewerReaction: () =>
|
|
192
|
+
viewerReaction: () => n,
|
|
255
193
|
reactionCounts: (t) => {
|
|
256
|
-
let
|
|
257
|
-
return
|
|
194
|
+
let r = { ...t ?? {} };
|
|
195
|
+
return n !== null && (r[n] = (r[n] ?? 0) + 1), e !== null && (r[e] = Math.max(0, (r[e] ?? 0) - 1)), r;
|
|
258
196
|
}
|
|
259
197
|
}
|
|
260
198
|
});
|
|
261
199
|
}
|
|
262
200
|
}, [
|
|
263
|
-
|
|
201
|
+
C,
|
|
264
202
|
t,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
]),
|
|
268
|
-
if (
|
|
269
|
-
let
|
|
270
|
-
if (
|
|
271
|
-
typeof window < "u" && window.localStorage.setItem(
|
|
203
|
+
l,
|
|
204
|
+
i
|
|
205
|
+
]), V = async (e) => {
|
|
206
|
+
if (u || D || F === e) return;
|
|
207
|
+
let n = F;
|
|
208
|
+
if (I(e), m) {
|
|
209
|
+
typeof window < "u" && window.localStorage.setItem(P, String(e)), R((t) => ({
|
|
272
210
|
...t,
|
|
273
211
|
[e]: (t[e] ?? 0) + 1,
|
|
274
|
-
...
|
|
212
|
+
...n === null ? {} : { [n]: (t[n] ?? 0) - 1 }
|
|
275
213
|
}));
|
|
276
214
|
return;
|
|
277
215
|
}
|
|
278
|
-
|
|
216
|
+
if (B(n, e), O) {
|
|
217
|
+
O.enqueue({
|
|
218
|
+
op: "reaction",
|
|
219
|
+
semantics: "convergence",
|
|
220
|
+
convergenceKey: `reaction:${t}:${i}`,
|
|
221
|
+
payload: {
|
|
222
|
+
surface: t,
|
|
223
|
+
itemId: i,
|
|
224
|
+
slotIndex: e
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
279
229
|
try {
|
|
280
|
-
await
|
|
230
|
+
await E({ variables: { input: {
|
|
281
231
|
surface: t,
|
|
282
|
-
itemId:
|
|
232
|
+
itemId: i,
|
|
283
233
|
slotIndex: e
|
|
284
234
|
} } });
|
|
285
235
|
} catch {
|
|
286
|
-
|
|
236
|
+
B(e, n), I(n);
|
|
287
237
|
}
|
|
288
238
|
};
|
|
289
|
-
return
|
|
290
|
-
className:
|
|
239
|
+
return T || !N || M.length === 0 ? null : /* @__PURE__ */ b("div", {
|
|
240
|
+
className: p("flex flex-wrap items-center justify-center gap-2", v),
|
|
291
241
|
role: "group",
|
|
292
|
-
"aria-label":
|
|
293
|
-
children:
|
|
294
|
-
let n =
|
|
242
|
+
"aria-label": S("ariaLabel"),
|
|
243
|
+
children: M.map((t) => {
|
|
244
|
+
let n = F === t.slotIndex, r = z(t.slotIndex);
|
|
295
245
|
return /* @__PURE__ */ x(e.button, {
|
|
296
246
|
type: "button",
|
|
297
|
-
disabled:
|
|
298
|
-
onClick: () => void
|
|
247
|
+
disabled: u || D,
|
|
248
|
+
onClick: () => void V(t.slotIndex),
|
|
299
249
|
whileTap: { scale: .9 },
|
|
300
250
|
whileHover: { scale: 1.06 },
|
|
301
251
|
transition: {
|
|
@@ -303,13 +253,13 @@ function V({ surface: t, itemId: n, reactionCounts: r, viewerReaction: i, groupI
|
|
|
303
253
|
stiffness: 400,
|
|
304
254
|
damping: 18
|
|
305
255
|
},
|
|
306
|
-
className:
|
|
256
|
+
className: p("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", u && "cursor-default opacity-70"),
|
|
307
257
|
"aria-pressed": n,
|
|
308
|
-
"aria-label":
|
|
258
|
+
"aria-label": S("tapAria", { emoji: t.emoji }),
|
|
309
259
|
children: [/* @__PURE__ */ b("span", {
|
|
310
260
|
"aria-hidden": "true",
|
|
311
261
|
children: t.emoji
|
|
312
|
-
}),
|
|
262
|
+
}), d && r > 0 && /* @__PURE__ */ b("span", {
|
|
313
263
|
className: "text-xs font-medium text-wx-fg-muted",
|
|
314
264
|
children: r
|
|
315
265
|
})]
|
|
@@ -318,6 +268,6 @@ function V({ surface: t, itemId: n, reactionCounts: r, viewerReaction: i, groupI
|
|
|
318
268
|
});
|
|
319
269
|
}
|
|
320
270
|
//#endregion
|
|
321
|
-
export {
|
|
271
|
+
export { C as a, T as i, O as n, w as o, D as r, S as s, M as t };
|
|
322
272
|
|
|
323
|
-
//# sourceMappingURL=widget-react-
|
|
273
|
+
//# sourceMappingURL=widget-react-BfO-uP4o.js.map
|
|
@@ -23853,4 +23853,4 @@ function mo(e) {
|
|
|
23853
23853
|
//#endregion
|
|
23854
23854
|
export { A as Categories, po as Emoji, D as EmojiStyle, j as SkinTonePickerLocation, k as SkinTones, E as SuggestionMode, O as Theme, mo as default, jt as emojiByUnified };
|
|
23855
23855
|
|
|
23856
|
-
//# sourceMappingURL=widget-react-
|
|
23856
|
+
//# sourceMappingURL=widget-react-BkXA6ytR.js.map
|