@wexio/messenger-widget-react 1.4.1 → 1.5.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 +130 -0
- package/README.md +2 -1
- package/dist/widget-react-0MqeP0VG2.js +201 -0
- package/dist/widget-react-12srXq362.js +201 -0
- package/dist/widget-react-13R6Vrt62.js +201 -0
- package/dist/widget-react-1FPhjaT7.js +2 -0
- package/dist/widget-react-1a5mHYv6.js +4 -0
- package/dist/widget-react-B-zdiXnI.js +2 -0
- package/dist/widget-react-B1v9X8dK2.js +201 -0
- package/dist/widget-react-B6W6yHa9.js +2 -0
- package/dist/widget-react-BAzh_M3R.js +201 -0
- package/dist/widget-react-BEeSy_sM.js +201 -0
- package/dist/widget-react-BGg29YDq.js +2 -0
- package/dist/widget-react-BKZZeBk72.js +201 -0
- package/dist/widget-react-BNsA7Hq8.js +2 -0
- package/dist/widget-react-BP_S1jOe2.js +2 -0
- package/dist/widget-react-BjVldSFi2.js +2 -0
- package/dist/widget-react-Bk8_ZpvK.js +2 -0
- package/dist/widget-react-BpSJW2vD2.js +201 -0
- package/dist/widget-react-BpfEg8PP.js +2 -0
- package/dist/widget-react-BtVbDkom.js +2 -0
- package/dist/widget-react-BxEMz2N0.js +2 -0
- package/dist/widget-react-BxYFNB-9.js +2 -0
- package/dist/widget-react-Bz5u8QHz.js +109 -0
- package/dist/widget-react-BzlFOEiU2.js +2 -0
- package/dist/widget-react-C-hnCqBf.js +2 -0
- package/dist/widget-react-C1rXlCoj.js +201 -0
- package/dist/widget-react-C1vTza-V2.js +201 -0
- package/dist/widget-react-C2_GJN-2.js +2 -0
- package/dist/widget-react-C40Ha_9C.js +2 -0
- package/dist/widget-react-C6OZyIh32.js +201 -0
- package/dist/widget-react-C78gQza62.js +201 -0
- package/dist/widget-react-C9D7iqrt.js +2 -0
- package/dist/widget-react-CJkUvFuJ2.js +2 -0
- package/dist/widget-react-CM6RqtRI2.js +2 -0
- package/dist/widget-react-COAvUm8D.js +140 -0
- package/dist/widget-react-COGNC9PO.js +2 -0
- package/dist/widget-react-CPEQKK8u.js +2 -0
- package/dist/widget-react-CZHkN2nG.js +2 -0
- package/dist/widget-react-CgvtA8Ek.js +201 -0
- package/dist/widget-react-Cil8Ajlh.js +201 -0
- package/dist/widget-react-CuJV_7PK.js +2 -0
- package/dist/widget-react-Cv42XaBB.js +2 -0
- package/dist/widget-react-Cw8StXTV2.js +201 -0
- package/dist/widget-react-CxTI2WNr.js +201 -0
- package/dist/widget-react-Cx_utOCH.js +2 -0
- package/dist/widget-react-D2sqPDts.js +2 -0
- package/dist/widget-react-D5s6TWhn.js +2 -0
- package/dist/widget-react-DBqY7BEB.js +163 -0
- package/dist/widget-react-DCnPzcmJ2.js +109 -0
- package/dist/widget-react-DFBIOPUo.js +2 -0
- package/dist/widget-react-DJTgpBXp.js +109 -0
- package/dist/widget-react-DJczk-Ax.js +2 -0
- package/dist/widget-react-DLK0giQJ2.js +201 -0
- package/dist/widget-react-DPf6mDAF2.js +201 -0
- package/dist/widget-react-DSyQ4JjS.js +2 -0
- package/dist/widget-react-DUnaBOfT.js +10 -0
- package/dist/widget-react-DW-XOzIR.js +2 -0
- package/dist/widget-react-DXnKk30y2.js +2 -0
- package/dist/widget-react-DfgfDdBf2.js +2 -0
- package/dist/widget-react-DhLRmjli.js +2 -0
- package/dist/widget-react-DjlwkwTM2.js +2 -0
- package/dist/widget-react-Dl2PevZk.js +2 -0
- package/dist/widget-react-DleQcmXy.js +2 -0
- package/dist/widget-react-DmRVdLdI.js +2 -0
- package/dist/widget-react-Ds-6CsP4.js +7 -0
- package/dist/widget-react-Dy2T3sIZ2.js +201 -0
- package/dist/widget-react-DzgDJMDl.js +2 -0
- package/dist/widget-react-FX5W7RyV.js +4 -0
- package/dist/widget-react-Fou9JP7u.js +201 -0
- package/dist/widget-react-GikUZ6_D.js +2 -0
- package/dist/widget-react-M6ZbU9Uk.js +2 -0
- package/dist/widget-react-RFGjueTQ.js +201 -0
- package/dist/widget-react-SG4_gli5.js +2 -0
- package/dist/widget-react-W_6RewLw2.js +2 -0
- package/dist/widget-react-YOrK-1WI2.js +201 -0
- package/dist/widget-react-YrYT-pD1.js +285 -0
- package/dist/widget-react-bEpDN5aA2.js +201 -0
- package/dist/widget-react-dWaXqKR32.js +2 -0
- package/dist/widget-react-iwANUtnB.js +201 -0
- package/dist/widget-react-llsiMoHr.js +2 -0
- package/dist/widget-react-tvX8XSZD.js +201 -0
- package/dist/widget-react-uWEOH9Lh.js +201 -0
- package/dist/widget-react-wMl4Kthk.js +2 -0
- package/dist/widget-react-yKWc1q98.js +2 -0
- package/dist/widget-react-zZslBPCS.js +2 -0
- package/dist/widget-react.js +50 -36283
- package/dist/widget-react.licenses.txt +3604 -0
- package/package.json +1 -1
- package/dist/widget-react--IUy5lNt.js +0 -510
- package/dist/widget-react-B7es3n1-.js +0 -32
- package/dist/widget-react-BAUpSGhZ.js +0 -1345
- package/dist/widget-react-BS9kUSRS.js +0 -255
- package/dist/widget-react-BT30ojz0.js +0 -371
- package/dist/widget-react-BXf2Ty8d.js +0 -364
- package/dist/widget-react-BgALABDe.js +0 -39
- package/dist/widget-react-BgunakAG.js +0 -566
- package/dist/widget-react-BkXA6ytR.js +0 -23856
- package/dist/widget-react-Bvtklo8g.js +0 -356
- package/dist/widget-react-BxEjM2it.js +0 -118
- package/dist/widget-react-CN_FIvMD.js +0 -834
- package/dist/widget-react-CTdz_dwX.js +0 -306
- package/dist/widget-react-Ck8JAYqT.js +0 -22122
- package/dist/widget-react-CyAVDflZ.js +0 -273
- package/dist/widget-react-DSAyUf2U.js +0 -229
- package/dist/widget-react-DbOJZl9F.js +0 -4932
- package/dist/widget-react-DgIxSjv7.js +0 -25
- package/dist/widget-react-Ds5J9FbQ.js +0 -27
- package/dist/widget-react-SI7deQTE.js +0 -35
- package/dist/widget-react-krPPnv02.js +0 -4438
- package/dist/widget-react-wSc9gIfG.js +0 -198
|
@@ -1,566 +0,0 @@
|
|
|
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 { t as e } from "./widget-react-DbOJZl9F.js";
|
|
15
|
-
import { Et as t, F as n, M as r, S as i, Tt as a, ht as o, l as s, st as c, u as l, x as u, z as d } from "./widget-react-Ck8JAYqT.js";
|
|
16
|
-
import { i as f, n as p, o as m, t as h } from "./widget-react-krPPnv02.js";
|
|
17
|
-
import { c as g } from "./widget-react-CN_FIvMD.js";
|
|
18
|
-
import { useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
19
|
-
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
20
|
-
//#region lib/graphql/queries/generated/news.generated.tsx
|
|
21
|
-
var T = {}, E = t`
|
|
22
|
-
query VisitorNewsList($args: VisitorNewsListArgs) {
|
|
23
|
-
visitorNewsList(args: $args) {
|
|
24
|
-
items {
|
|
25
|
-
_id
|
|
26
|
-
title
|
|
27
|
-
slug
|
|
28
|
-
excerpt
|
|
29
|
-
publishedAt
|
|
30
|
-
upstreamUpdatedAt
|
|
31
|
-
reactionCounts
|
|
32
|
-
coverImageUrl {
|
|
33
|
-
_id
|
|
34
|
-
url
|
|
35
|
-
}
|
|
36
|
-
externalCoverImageUrl
|
|
37
|
-
authors {
|
|
38
|
-
_id
|
|
39
|
-
name
|
|
40
|
-
photo {
|
|
41
|
-
_id
|
|
42
|
-
url
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
categories {
|
|
46
|
-
_id
|
|
47
|
-
slug
|
|
48
|
-
label
|
|
49
|
-
}
|
|
50
|
-
tags {
|
|
51
|
-
_id
|
|
52
|
-
slug
|
|
53
|
-
label
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
meta {
|
|
57
|
-
totalCount
|
|
58
|
-
currentPage
|
|
59
|
-
totalPages
|
|
60
|
-
hasNextPage
|
|
61
|
-
hasPreviousPage
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
function ee(e) {
|
|
67
|
-
return a(E, {
|
|
68
|
-
...T,
|
|
69
|
-
...e
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
var D = t`
|
|
73
|
-
query VisitorNewsPostCard($args: VisitorNewsPostArgs!) {
|
|
74
|
-
visitorNewsPost(args: $args) {
|
|
75
|
-
_id
|
|
76
|
-
title
|
|
77
|
-
excerpt
|
|
78
|
-
coverImageUrl {
|
|
79
|
-
_id
|
|
80
|
-
url
|
|
81
|
-
}
|
|
82
|
-
externalCoverImageUrl
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
`;
|
|
86
|
-
function O(e) {
|
|
87
|
-
return a(D, {
|
|
88
|
-
...T,
|
|
89
|
-
...e
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
var k = t`
|
|
93
|
-
query VisitorNewsPost($args: VisitorNewsPostArgs!) {
|
|
94
|
-
visitorNewsPost(args: $args) {
|
|
95
|
-
_id
|
|
96
|
-
title
|
|
97
|
-
slug
|
|
98
|
-
excerpt
|
|
99
|
-
contentMarkdown
|
|
100
|
-
bodyFormat
|
|
101
|
-
locale
|
|
102
|
-
publishedAt
|
|
103
|
-
upstreamUpdatedAt
|
|
104
|
-
viewCount
|
|
105
|
-
reactionCounts
|
|
106
|
-
viewerReaction
|
|
107
|
-
sourceUrl
|
|
108
|
-
coverImageUrl {
|
|
109
|
-
_id
|
|
110
|
-
url
|
|
111
|
-
}
|
|
112
|
-
externalCoverImageUrl
|
|
113
|
-
source {
|
|
114
|
-
_id
|
|
115
|
-
name
|
|
116
|
-
type
|
|
117
|
-
}
|
|
118
|
-
authors {
|
|
119
|
-
_id
|
|
120
|
-
name
|
|
121
|
-
photo {
|
|
122
|
-
_id
|
|
123
|
-
url
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
categories {
|
|
127
|
-
_id
|
|
128
|
-
slug
|
|
129
|
-
label
|
|
130
|
-
}
|
|
131
|
-
tags {
|
|
132
|
-
_id
|
|
133
|
-
slug
|
|
134
|
-
label
|
|
135
|
-
}
|
|
136
|
-
translations {
|
|
137
|
-
_id
|
|
138
|
-
locale
|
|
139
|
-
slug
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
function A(e) {
|
|
145
|
-
return a(k, {
|
|
146
|
-
...T,
|
|
147
|
-
...e
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
var j = t`
|
|
151
|
-
query VisitorNewsRelated($postId: ID!, $limit: Int, $locale: String) {
|
|
152
|
-
visitorNewsRelated(postId: $postId, limit: $limit, locale: $locale) {
|
|
153
|
-
_id
|
|
154
|
-
title
|
|
155
|
-
slug
|
|
156
|
-
excerpt
|
|
157
|
-
publishedAt
|
|
158
|
-
coverImageUrl {
|
|
159
|
-
_id
|
|
160
|
-
url
|
|
161
|
-
}
|
|
162
|
-
externalCoverImageUrl
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
`;
|
|
166
|
-
function M(e) {
|
|
167
|
-
return a(j, {
|
|
168
|
-
...T,
|
|
169
|
-
...e
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
t`
|
|
173
|
-
mutation RecordVisitorNewsView($postId: String!) {
|
|
174
|
-
recordVisitorNewsView(postId: $postId) {
|
|
175
|
-
ok
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
`;
|
|
179
|
-
var N = t`
|
|
180
|
-
query VisitorNewsListSlim($args: VisitorNewsListArgs) {
|
|
181
|
-
visitorNewsList(args: $args) {
|
|
182
|
-
items {
|
|
183
|
-
_id
|
|
184
|
-
title
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
`;
|
|
189
|
-
function P(e) {
|
|
190
|
-
return a(N, {
|
|
191
|
-
...T,
|
|
192
|
-
...e
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
var F = h("megaphone", [
|
|
196
|
-
["path", {
|
|
197
|
-
d: "M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",
|
|
198
|
-
key: "q8bfy3"
|
|
199
|
-
}],
|
|
200
|
-
["path", {
|
|
201
|
-
d: "M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",
|
|
202
|
-
key: "1853fq"
|
|
203
|
-
}],
|
|
204
|
-
["path", {
|
|
205
|
-
d: "M8 6v8",
|
|
206
|
-
key: "15ugcq"
|
|
207
|
-
}]
|
|
208
|
-
]);
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region components/ui/icon.tsx
|
|
211
|
-
function I({ icon: e, size: t = 20, strokeWidth: n = 2, className: r, ...i }) {
|
|
212
|
-
return /* @__PURE__ */ C(e, {
|
|
213
|
-
width: t,
|
|
214
|
-
height: t,
|
|
215
|
-
strokeWidth: n,
|
|
216
|
-
className: p("shrink-0", r),
|
|
217
|
-
...i
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
//#endregion
|
|
221
|
-
//#region components/ui/skeleton.tsx
|
|
222
|
-
function L({ className: e, ...t }) {
|
|
223
|
-
return /* @__PURE__ */ C("div", {
|
|
224
|
-
"data-slot": "skeleton",
|
|
225
|
-
className: p("animate-pulse rounded-wx-sm bg-wx-bg-elevated", e),
|
|
226
|
-
...t
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region components/widget/author-avatars.tsx
|
|
231
|
-
function R(e) {
|
|
232
|
-
if (!Array.isArray(e)) return;
|
|
233
|
-
let t = e.map((e) => {
|
|
234
|
-
if (!e || typeof e != "object") return null;
|
|
235
|
-
let t = e.name;
|
|
236
|
-
if (typeof t != "string") return null;
|
|
237
|
-
let n = e._id ?? e.id, r = e.photo?.url;
|
|
238
|
-
return {
|
|
239
|
-
id: String(n ?? t),
|
|
240
|
-
name: t,
|
|
241
|
-
photoUrl: typeof r == "string" ? r : null
|
|
242
|
-
};
|
|
243
|
-
}).filter((e) => !!e);
|
|
244
|
-
return t.length > 0 ? t : void 0;
|
|
245
|
-
}
|
|
246
|
-
function z({ authors: e, max: t = 3, className: n }) {
|
|
247
|
-
return !e || e.length === 0 ? null : /* @__PURE__ */ C("span", {
|
|
248
|
-
className: `flex items-center -space-x-1.5 ${n ?? ""}`,
|
|
249
|
-
children: e.slice(0, t).map((e) => e.photoUrl ? /* @__PURE__ */ C("img", {
|
|
250
|
-
src: e.photoUrl,
|
|
251
|
-
alt: e.name,
|
|
252
|
-
title: e.name,
|
|
253
|
-
className: "h-5 w-5 rounded-full border border-wx-bg object-cover"
|
|
254
|
-
}, e.id) : /* @__PURE__ */ C("span", {
|
|
255
|
-
title: e.name,
|
|
256
|
-
className: "flex h-5 w-5 items-center justify-center rounded-full border border-wx-bg bg-wx-bg-elevated-2 text-[9px] font-semibold text-wx-fg-muted",
|
|
257
|
-
children: e.name.charAt(0).toUpperCase()
|
|
258
|
-
}, e.id))
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region components/widget/sticky-search-header.tsx
|
|
263
|
-
function B({ value: e, onChange: t, placeholder: n, className: r }) {
|
|
264
|
-
return /* @__PURE__ */ w("div", {
|
|
265
|
-
className: p("sticky top-0 z-10 flex items-center gap-2.5 border-wx-border border-b bg-wx-bg px-4", r),
|
|
266
|
-
children: [/* @__PURE__ */ C(g, {
|
|
267
|
-
size: 16,
|
|
268
|
-
className: "shrink-0 text-wx-fg-muted"
|
|
269
|
-
}), /* @__PURE__ */ C("input", {
|
|
270
|
-
type: "search",
|
|
271
|
-
value: e,
|
|
272
|
-
onChange: (e) => t(e.target.value),
|
|
273
|
-
placeholder: n,
|
|
274
|
-
className: p("block w-full min-w-0 flex-1 border-0 bg-transparent py-3 text-sm text-wx-fg", "placeholder:text-wx-fg-muted focus:outline-none focus:ring-0", "[&::-webkit-search-cancel-button]:appearance-none")
|
|
275
|
-
})]
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region lib/use-scroll-restore.ts
|
|
280
|
-
var V = /* @__PURE__ */ new Map();
|
|
281
|
-
function H(e) {
|
|
282
|
-
let t = b(null);
|
|
283
|
-
return v(() => {
|
|
284
|
-
let n = t.current;
|
|
285
|
-
if (!n) return;
|
|
286
|
-
let r = V.get(e) ?? 0, i = !1, a = performance.now(), o = () => {
|
|
287
|
-
if (i || !t.current) return;
|
|
288
|
-
let e = t.current;
|
|
289
|
-
if (e.scrollHeight - e.clientHeight >= r) {
|
|
290
|
-
e.scrollTop = r;
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
if (performance.now() - a > 500) {
|
|
294
|
-
e.scrollTop = r;
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
requestAnimationFrame(o);
|
|
298
|
-
};
|
|
299
|
-
requestAnimationFrame(o);
|
|
300
|
-
let s = () => {
|
|
301
|
-
V.set(e, n.scrollTop);
|
|
302
|
-
};
|
|
303
|
-
return n.addEventListener("scroll", s, { passive: !0 }), () => {
|
|
304
|
-
i = !0, n.removeEventListener("scroll", s);
|
|
305
|
-
};
|
|
306
|
-
}, [e]), t;
|
|
307
|
-
}
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region components/widget/tabs/news-tab/helpers.ts
|
|
310
|
-
function U(e) {
|
|
311
|
-
if (!e.upstreamUpdatedAt) return !1;
|
|
312
|
-
let t = Date.parse(e.upstreamUpdatedAt), n = Date.parse(e.publishedAt);
|
|
313
|
-
return Number.isNaN(t) || Number.isNaN(n) ? !1 : t > n + 6e4;
|
|
314
|
-
}
|
|
315
|
-
function W(e) {
|
|
316
|
-
let t = Date.parse(e);
|
|
317
|
-
if (Number.isNaN(t)) return "";
|
|
318
|
-
let n = Date.now() - t, r = Math.floor(n / 6e4);
|
|
319
|
-
if (r < 1) return "just now";
|
|
320
|
-
if (r < 60) return `${r}m ago`;
|
|
321
|
-
let i = Math.floor(r / 60);
|
|
322
|
-
if (i < 24) return `${i}h ago`;
|
|
323
|
-
let a = Math.floor(i / 24);
|
|
324
|
-
return a < 7 ? `${a}d ago` : new Date(t).toLocaleDateString();
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region components/widget/tabs/news-tab/index.tsx
|
|
328
|
-
var G = 10, te = 240;
|
|
329
|
-
function K({ isDummy: e, onOpenArticle: t }) {
|
|
330
|
-
let i = f("news"), a = n(), u = m(), p = r(), [h, g] = x(""), b = J(h, 300), T = b.length >= 2, E = p.previewData?.newsPosts, D = !e && Array.isArray(E) && E.length > 0, [O, k] = x(G), { data: A, error: j, loading: M, fetchMore: N } = ee({
|
|
331
|
-
variables: { args: {
|
|
332
|
-
locale: u,
|
|
333
|
-
limit: G,
|
|
334
|
-
offset: 0,
|
|
335
|
-
...T ? { query: b } : {}
|
|
336
|
-
} },
|
|
337
|
-
skip: e || D,
|
|
338
|
-
notifyOnNetworkStatusChange: !0
|
|
339
|
-
});
|
|
340
|
-
v(() => {
|
|
341
|
-
k(G);
|
|
342
|
-
}, [b, D]);
|
|
343
|
-
let P = c(), R = s(P && !e && !T ? d.news(P, u) : null, A), z = y(() => (R?.visitorNewsList.items ?? []).filter((e) => !!e).map(q), [R]), V = D ? (E ?? []).filter((e) => !!e && typeof e == "object").map(q) : [], U = _((e) => e.title.toLowerCase().includes(b.toLowerCase()) || e.excerpt.toLowerCase().includes(b.toLowerCase()), [b]), W = e ? T ? o(a).filter(U) : o(a) : D ? T ? V.filter(U) : V : z, K = D || e ? W.slice(0, O) : W, X = y(() => e || D ? O < W.length : R?.visitorNewsList.meta.hasNextPage ?? !1, [
|
|
344
|
-
e,
|
|
345
|
-
D,
|
|
346
|
-
O,
|
|
347
|
-
W.length,
|
|
348
|
-
R
|
|
349
|
-
]), [Z, Q] = x(!1), $ = _(async () => {
|
|
350
|
-
if (!(!X || Z)) {
|
|
351
|
-
if (e || D) {
|
|
352
|
-
k((e) => e + G);
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
Q(!0);
|
|
356
|
-
try {
|
|
357
|
-
await N({
|
|
358
|
-
variables: { args: {
|
|
359
|
-
locale: u,
|
|
360
|
-
limit: G,
|
|
361
|
-
offset: A?.visitorNewsList.items.length ?? 0,
|
|
362
|
-
...T ? { query: b } : {}
|
|
363
|
-
} },
|
|
364
|
-
updateQuery: (e, { fetchMoreResult: t }) => {
|
|
365
|
-
if (!t) return e;
|
|
366
|
-
let n = /* @__PURE__ */ new Set(), r = [];
|
|
367
|
-
for (let i of [...e.visitorNewsList.items, ...t.visitorNewsList.items]) i && !n.has(i._id) && (n.add(i._id), r.push(i));
|
|
368
|
-
return {
|
|
369
|
-
...e,
|
|
370
|
-
visitorNewsList: {
|
|
371
|
-
...t.visitorNewsList,
|
|
372
|
-
items: r
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
} finally {
|
|
378
|
-
Q(!1);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}, [
|
|
382
|
-
X,
|
|
383
|
-
Z,
|
|
384
|
-
e,
|
|
385
|
-
D,
|
|
386
|
-
T,
|
|
387
|
-
b,
|
|
388
|
-
u,
|
|
389
|
-
N,
|
|
390
|
-
A
|
|
391
|
-
]), ne = H("news"), re = _((e) => {
|
|
392
|
-
let t = e.currentTarget;
|
|
393
|
-
t.scrollHeight - t.clientHeight - t.scrollTop < te && $();
|
|
394
|
-
}, [$]), ie = W.length > 0 || T, ae = !e && !D && M && K.length === 0;
|
|
395
|
-
return j && K.length === 0 ? /* @__PURE__ */ C("div", {
|
|
396
|
-
className: "flex flex-1 flex-col items-center justify-center gap-3 px-6 py-12 text-center",
|
|
397
|
-
children: /* @__PURE__ */ C("p", {
|
|
398
|
-
className: "text-sm text-wx-fg-muted",
|
|
399
|
-
children: i("emptyTitle")
|
|
400
|
-
})
|
|
401
|
-
}) : /* @__PURE__ */ w(l, {
|
|
402
|
-
className: "flex-1",
|
|
403
|
-
viewportRef: ne,
|
|
404
|
-
onScroll: re,
|
|
405
|
-
children: [ie && /* @__PURE__ */ C(B, {
|
|
406
|
-
value: h,
|
|
407
|
-
onChange: g,
|
|
408
|
-
placeholder: i("searchPlaceholder")
|
|
409
|
-
}), /* @__PURE__ */ C("div", {
|
|
410
|
-
className: "flex flex-col gap-3 px-4 pt-4 pb-6",
|
|
411
|
-
children: ae ? Array.from({ length: 3 }).map((e, t) => /* @__PURE__ */ w("div", {
|
|
412
|
-
className: "overflow-hidden rounded-wx-lg bg-wx-bg-elevated",
|
|
413
|
-
children: [/* @__PURE__ */ C(L, { className: "aspect-[16/10] w-full rounded-none" }), /* @__PURE__ */ w("div", {
|
|
414
|
-
className: "space-y-2 px-5 py-4",
|
|
415
|
-
children: [
|
|
416
|
-
/* @__PURE__ */ C(L, { className: "h-3 w-3/4" }),
|
|
417
|
-
/* @__PURE__ */ C(L, { className: "h-3 w-1/2" }),
|
|
418
|
-
/* @__PURE__ */ C(L, { className: "mt-1 h-2 w-1/3" })
|
|
419
|
-
]
|
|
420
|
-
})]
|
|
421
|
-
}, t)) : K.length === 0 ? /* @__PURE__ */ w("div", {
|
|
422
|
-
className: "flex flex-1 flex-col items-center justify-center gap-3 px-6 py-12 text-center",
|
|
423
|
-
children: [
|
|
424
|
-
/* @__PURE__ */ C("div", {
|
|
425
|
-
className: "flex h-14 w-14 items-center justify-center rounded-full bg-wx-bg-elevated text-wx-fg-muted",
|
|
426
|
-
children: /* @__PURE__ */ C(I, {
|
|
427
|
-
icon: F,
|
|
428
|
-
size: 28
|
|
429
|
-
})
|
|
430
|
-
}),
|
|
431
|
-
/* @__PURE__ */ C("p", {
|
|
432
|
-
className: "text-base font-semibold text-wx-fg",
|
|
433
|
-
children: i(T ? "noResults" : "emptyTitle")
|
|
434
|
-
}),
|
|
435
|
-
!T && /* @__PURE__ */ C("p", {
|
|
436
|
-
className: "text-sm text-wx-fg-muted",
|
|
437
|
-
children: i("emptyBody")
|
|
438
|
-
})
|
|
439
|
-
]
|
|
440
|
-
}) : /* @__PURE__ */ w(S, { children: [K.map((e, n) => /* @__PURE__ */ C(Y, {
|
|
441
|
-
item: e,
|
|
442
|
-
locale: u,
|
|
443
|
-
delay: n < G ? n * .04 : 0,
|
|
444
|
-
onClick: () => t(e.id)
|
|
445
|
-
}, e.id)), Z && /* @__PURE__ */ C("div", {
|
|
446
|
-
className: "flex justify-center py-3",
|
|
447
|
-
children: /* @__PURE__ */ C(L, { className: "h-3 w-24" })
|
|
448
|
-
})] })
|
|
449
|
-
})]
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
function q(e, t = 0) {
|
|
453
|
-
let n = e.coverImageUrl?.url, r = e.externalCoverImageUrl, i = typeof n == "string" ? n : typeof r == "string" ? r : null, a = (e) => Array.isArray(e) ? e.map((e) => {
|
|
454
|
-
if (!e || typeof e != "object") return null;
|
|
455
|
-
let t = e.slug, n = e.label;
|
|
456
|
-
return typeof t != "string" || typeof n != "string" ? null : {
|
|
457
|
-
slug: t,
|
|
458
|
-
label: n
|
|
459
|
-
};
|
|
460
|
-
}).filter((e) => !!e) : void 0, o = a(e.tags), s = a(e.categories), c = Array.isArray(e.authors) ? e.authors.map((e) => {
|
|
461
|
-
if (!e || typeof e != "object") return null;
|
|
462
|
-
let t = e.name;
|
|
463
|
-
if (typeof t != "string") return null;
|
|
464
|
-
let n = e._id, r = e.photo?.url;
|
|
465
|
-
return {
|
|
466
|
-
_id: String(n ?? t),
|
|
467
|
-
name: t,
|
|
468
|
-
photo: { url: typeof r == "string" ? r : "" }
|
|
469
|
-
};
|
|
470
|
-
}).filter((e) => !!e) : void 0;
|
|
471
|
-
return {
|
|
472
|
-
id: String(e._id ?? e.id ?? `news-${t}`),
|
|
473
|
-
title: typeof e.title == "string" ? e.title : "",
|
|
474
|
-
excerpt: typeof e.excerpt == "string" ? e.excerpt : "",
|
|
475
|
-
publishedAt: typeof e.publishedAt == "string" ? e.publishedAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
476
|
-
coverGradient: ["#1e1f21", "#121314"],
|
|
477
|
-
...i ? { coverImageUrl: i } : {},
|
|
478
|
-
...typeof e.upstreamUpdatedAt == "string" ? { upstreamUpdatedAt: e.upstreamUpdatedAt } : {},
|
|
479
|
-
...o && o.length > 0 ? { tags: o } : {},
|
|
480
|
-
...s && s.length > 0 ? { categories: s } : {},
|
|
481
|
-
...c && c.length > 0 ? { authors: c } : {},
|
|
482
|
-
reactionCounts: e.reactionCounts ?? null
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
function J(e, t) {
|
|
486
|
-
let [n, r] = x(e);
|
|
487
|
-
return v(() => {
|
|
488
|
-
let n = setTimeout(() => r(e), t);
|
|
489
|
-
return () => clearTimeout(n);
|
|
490
|
-
}, [e, t]), n;
|
|
491
|
-
}
|
|
492
|
-
function Y({ item: t, locale: n, delay: r, onClick: a }) {
|
|
493
|
-
let o = f("news"), s = t.categories ?? (t.category ? [t.category] : []), c = R(t.authors);
|
|
494
|
-
return /* @__PURE__ */ w(e.button, {
|
|
495
|
-
type: "button",
|
|
496
|
-
onClick: a,
|
|
497
|
-
initial: {
|
|
498
|
-
opacity: 0,
|
|
499
|
-
y: 8
|
|
500
|
-
},
|
|
501
|
-
animate: {
|
|
502
|
-
opacity: 1,
|
|
503
|
-
y: 0
|
|
504
|
-
},
|
|
505
|
-
whileHover: { y: -2 },
|
|
506
|
-
whileTap: { scale: .985 },
|
|
507
|
-
transition: {
|
|
508
|
-
duration: .2,
|
|
509
|
-
delay: r
|
|
510
|
-
},
|
|
511
|
-
className: p("block w-full shrink-0 overflow-hidden rounded-wx-lg bg-wx-bg-elevated text-left", "transition-colors hover:bg-wx-bg-elevated-2", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary focus-visible:ring-offset-2 focus-visible:ring-offset-wx-bg"),
|
|
512
|
-
children: [/* @__PURE__ */ C("div", {
|
|
513
|
-
className: "aspect-[16/10] w-full bg-cover bg-center",
|
|
514
|
-
style: t.coverImageUrl ? { backgroundImage: `url(${t.coverImageUrl})` } : { background: `linear-gradient(135deg, ${t.coverGradient[0]}, ${t.coverGradient[1]})` },
|
|
515
|
-
"aria-hidden": "true"
|
|
516
|
-
}), /* @__PURE__ */ w("div", {
|
|
517
|
-
className: "px-5 py-4",
|
|
518
|
-
children: [
|
|
519
|
-
(s.length > 0 || c != null) && /* @__PURE__ */ w("div", {
|
|
520
|
-
className: "mb-1.5 flex items-center justify-between gap-2",
|
|
521
|
-
children: [/* @__PURE__ */ C("div", {
|
|
522
|
-
className: "flex min-w-0 flex-wrap gap-1.5",
|
|
523
|
-
children: s.slice(0, 2).map((e) => /* @__PURE__ */ C("span", {
|
|
524
|
-
className: "text-[10px] font-semibold uppercase tracking-wide text-wx-primary",
|
|
525
|
-
children: e.label
|
|
526
|
-
}, e.slug))
|
|
527
|
-
}), /* @__PURE__ */ C(z, {
|
|
528
|
-
authors: c,
|
|
529
|
-
className: "shrink-0"
|
|
530
|
-
})]
|
|
531
|
-
}),
|
|
532
|
-
/* @__PURE__ */ C(i, {
|
|
533
|
-
className: "text-sm",
|
|
534
|
-
children: t.title
|
|
535
|
-
}),
|
|
536
|
-
t.excerpt && /* @__PURE__ */ C(u, {
|
|
537
|
-
className: "mt-1 text-xs",
|
|
538
|
-
children: t.excerpt
|
|
539
|
-
}),
|
|
540
|
-
/* @__PURE__ */ w("p", {
|
|
541
|
-
className: "mt-2 flex items-center gap-2 text-xs text-wx-fg-subtle",
|
|
542
|
-
children: [/* @__PURE__ */ C("span", { children: new Date(t.publishedAt).toLocaleDateString(n, {
|
|
543
|
-
month: "short",
|
|
544
|
-
day: "numeric",
|
|
545
|
-
year: "numeric"
|
|
546
|
-
}) }), U(t) && t.upstreamUpdatedAt && /* @__PURE__ */ C("span", {
|
|
547
|
-
className: "rounded-full bg-wx-bg-elevated px-1.5 py-0.5 text-[10px] font-medium text-wx-fg-muted",
|
|
548
|
-
title: new Date(t.upstreamUpdatedAt).toLocaleString(n),
|
|
549
|
-
children: o("editedAt", { when: W(t.upstreamUpdatedAt) })
|
|
550
|
-
})]
|
|
551
|
-
}),
|
|
552
|
-
t.tags && t.tags.length > 0 && /* @__PURE__ */ C("div", {
|
|
553
|
-
className: "mt-2.5 flex flex-wrap gap-1",
|
|
554
|
-
children: t.tags.slice(0, 4).map((e) => /* @__PURE__ */ C("span", {
|
|
555
|
-
className: "rounded-full bg-wx-bg-elevated px-2 py-0.5 text-[10px] font-medium text-wx-fg-muted",
|
|
556
|
-
children: e.label
|
|
557
|
-
}, e.slug))
|
|
558
|
-
})
|
|
559
|
-
]
|
|
560
|
-
})]
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
//#endregion
|
|
564
|
-
export { B as a, L as c, E as d, P as f, M as h, H as i, I as l, A as m, W as n, z as o, O as p, U as r, R as s, K as t, F as u };
|
|
565
|
-
|
|
566
|
-
//# sourceMappingURL=widget-react-BgunakAG.js.map
|