@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
|
@@ -0,0 +1,27 @@
|
|
|
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-krPPnv02.js";
|
|
15
|
+
var t = e("search", [["path", {
|
|
16
|
+
d: "m21 21-4.34-4.34",
|
|
17
|
+
key: "14j7rj"
|
|
18
|
+
}], ["circle", {
|
|
19
|
+
cx: "11",
|
|
20
|
+
cy: "11",
|
|
21
|
+
r: "8",
|
|
22
|
+
key: "4ej97u"
|
|
23
|
+
}]]);
|
|
24
|
+
//#endregion
|
|
25
|
+
export { t };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=widget-react-Ds5J9FbQ.js.map
|
|
@@ -11,13 +11,14 @@ import "react";
|
|
|
11
11
|
import "react-dom";
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { i as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
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-C6lzldez.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";
|
|
19
20
|
//#region lib/graphql/queries/generated/news.generated.tsx
|
|
20
|
-
var
|
|
21
|
+
var T = {}, E = t`
|
|
21
22
|
query VisitorNewsList($args: VisitorNewsListArgs) {
|
|
22
23
|
visitorNewsList(args: $args) {
|
|
23
24
|
items {
|
|
@@ -62,13 +63,13 @@ var x = {}, S = s`
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
`;
|
|
65
|
-
function
|
|
66
|
-
return
|
|
67
|
-
...
|
|
66
|
+
function ee(e) {
|
|
67
|
+
return a(E, {
|
|
68
|
+
...T,
|
|
68
69
|
...e
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
var
|
|
72
|
+
var D = t`
|
|
72
73
|
query VisitorNewsPostCard($args: VisitorNewsPostArgs!) {
|
|
73
74
|
visitorNewsPost(args: $args) {
|
|
74
75
|
_id
|
|
@@ -82,13 +83,13 @@ var w = s`
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
`;
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
...
|
|
86
|
+
function O(e) {
|
|
87
|
+
return a(D, {
|
|
88
|
+
...T,
|
|
88
89
|
...e
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
|
-
var
|
|
92
|
+
var k = t`
|
|
92
93
|
query VisitorNewsPost($args: VisitorNewsPostArgs!) {
|
|
93
94
|
visitorNewsPost(args: $args) {
|
|
94
95
|
_id
|
|
@@ -140,13 +141,13 @@ var E = s`
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
`;
|
|
143
|
-
function
|
|
144
|
-
return
|
|
145
|
-
...
|
|
144
|
+
function A(e) {
|
|
145
|
+
return a(k, {
|
|
146
|
+
...T,
|
|
146
147
|
...e
|
|
147
148
|
});
|
|
148
149
|
}
|
|
149
|
-
var
|
|
150
|
+
var j = t`
|
|
150
151
|
query VisitorNewsRelated($postId: ID!, $limit: Int, $locale: String) {
|
|
151
152
|
visitorNewsRelated(postId: $postId, limit: $limit, locale: $locale) {
|
|
152
153
|
_id
|
|
@@ -162,20 +163,20 @@ var O = s`
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
`;
|
|
165
|
-
function
|
|
166
|
-
return
|
|
167
|
-
...
|
|
166
|
+
function M(e) {
|
|
167
|
+
return a(j, {
|
|
168
|
+
...T,
|
|
168
169
|
...e
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
+
t`
|
|
172
173
|
mutation RecordVisitorNewsView($postId: String!) {
|
|
173
174
|
recordVisitorNewsView(postId: $postId) {
|
|
174
175
|
ok
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
`;
|
|
178
|
-
var
|
|
179
|
+
var N = t`
|
|
179
180
|
query VisitorNewsListSlim($args: VisitorNewsListArgs) {
|
|
180
181
|
visitorNewsList(args: $args) {
|
|
181
182
|
items {
|
|
@@ -185,103 +186,13 @@ var A = s`
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
`;
|
|
188
|
-
function
|
|
189
|
-
return
|
|
190
|
-
...
|
|
189
|
+
function P(e) {
|
|
190
|
+
return a(N, {
|
|
191
|
+
...T,
|
|
191
192
|
...e
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
|
-
|
|
195
|
-
//#region dummy/news.ts
|
|
196
|
-
var M = [
|
|
197
|
-
{
|
|
198
|
-
id: "demo-news-1",
|
|
199
|
-
publishedAt: "2026-04-30T10:00:00.000Z",
|
|
200
|
-
coverGradient: ["#1e1f21", "#121314"],
|
|
201
|
-
coverImageUrl: "https://picsum.photos/seed/wexio-pioneer/960/600",
|
|
202
|
-
authorIds: ["maya", "sam"],
|
|
203
|
-
categorySlug: "company",
|
|
204
|
-
tagSlugs: ["events", "product"]
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
id: "demo-news-2",
|
|
208
|
-
publishedAt: "2026-04-15T10:00:00.000Z",
|
|
209
|
-
coverGradient: ["#1e3a8a", "#0c1e4a"],
|
|
210
|
-
coverImageUrl: "https://picsum.photos/seed/wexio-april/960/600",
|
|
211
|
-
authorIds: ["leo"],
|
|
212
|
-
categorySlug: "product",
|
|
213
|
-
tagSlugs: ["product", "release"]
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
id: "demo-news-3",
|
|
217
|
-
publishedAt: "2026-03-22T10:00:00.000Z",
|
|
218
|
-
coverGradient: ["#0f766e", "#042f2e"],
|
|
219
|
-
coverImageUrl: "https://picsum.photos/seed/wexio-langs/960/600",
|
|
220
|
-
authorIds: ["ira", "leo"],
|
|
221
|
-
categorySlug: "product",
|
|
222
|
-
tagSlugs: ["ai", "languages"]
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
id: "demo-news-4",
|
|
226
|
-
publishedAt: "2026-03-08T10:00:00.000Z",
|
|
227
|
-
coverGradient: ["#7c3aed", "#2e1065"],
|
|
228
|
-
authorIds: ["leo"],
|
|
229
|
-
categorySlug: "engineering",
|
|
230
|
-
tagSlugs: ["integrations", "slack"]
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
id: "demo-news-5",
|
|
234
|
-
publishedAt: "2026-02-18T10:00:00.000Z",
|
|
235
|
-
coverGradient: ["#b45309", "#451a03"],
|
|
236
|
-
coverImageUrl: "https://picsum.photos/seed/wexio-inbox2/960/600",
|
|
237
|
-
authorIds: ["maya"],
|
|
238
|
-
categorySlug: "product",
|
|
239
|
-
tagSlugs: ["inbox", "product"]
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
id: "demo-news-6",
|
|
243
|
-
publishedAt: "2026-02-02T10:00:00.000Z",
|
|
244
|
-
coverGradient: ["#155e75", "#083344"],
|
|
245
|
-
authorIds: ["sam"],
|
|
246
|
-
categorySlug: "engineering",
|
|
247
|
-
tagSlugs: ["privacy", "security"]
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
id: "demo-news-7",
|
|
251
|
-
publishedAt: "2026-01-20T10:00:00.000Z",
|
|
252
|
-
coverGradient: ["#be185d", "#500724"],
|
|
253
|
-
coverImageUrl: "https://picsum.photos/seed/wexio-mobile/960/600",
|
|
254
|
-
authorIds: ["ira"],
|
|
255
|
-
categorySlug: "product",
|
|
256
|
-
tagSlugs: ["mobile", "beta"]
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
id: "demo-news-8",
|
|
260
|
-
publishedAt: "2026-01-05T10:00:00.000Z",
|
|
261
|
-
coverGradient: ["#15803d", "#052e16"],
|
|
262
|
-
authorIds: ["maya", "leo"],
|
|
263
|
-
categorySlug: "engineering",
|
|
264
|
-
tagSlugs: ["ai", "analytics"]
|
|
265
|
-
}
|
|
266
|
-
];
|
|
267
|
-
function N(e) {
|
|
268
|
-
return M.map(({ tagSlugs: t, authorIds: n, categorySlug: r, ...i }) => ({
|
|
269
|
-
...i,
|
|
270
|
-
title: e.raw(`news.${i.id}.title`),
|
|
271
|
-
excerpt: e.raw(`news.${i.id}.excerpt`),
|
|
272
|
-
contentMarkdown: e.raw(`news.${i.id}.body`),
|
|
273
|
-
authors: a(n),
|
|
274
|
-
category: {
|
|
275
|
-
slug: r,
|
|
276
|
-
label: e.raw(`news.categories.${r}`)
|
|
277
|
-
},
|
|
278
|
-
tags: t.map((t) => ({
|
|
279
|
-
slug: t,
|
|
280
|
-
label: e.raw(`news.tags.${t}`)
|
|
281
|
-
}))
|
|
282
|
-
}));
|
|
283
|
-
}
|
|
284
|
-
var P = f("megaphone", [
|
|
195
|
+
var F = h("megaphone", [
|
|
285
196
|
["path", {
|
|
286
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",
|
|
287
198
|
key: "q8bfy3"
|
|
@@ -297,27 +208,27 @@ var P = f("megaphone", [
|
|
|
297
208
|
]);
|
|
298
209
|
//#endregion
|
|
299
210
|
//#region components/ui/icon.tsx
|
|
300
|
-
function
|
|
301
|
-
return /* @__PURE__ */
|
|
211
|
+
function I({ icon: e, size: t = 20, strokeWidth: n = 2, className: r, ...i }) {
|
|
212
|
+
return /* @__PURE__ */ C(e, {
|
|
302
213
|
width: t,
|
|
303
214
|
height: t,
|
|
304
215
|
strokeWidth: n,
|
|
305
|
-
className:
|
|
216
|
+
className: p("shrink-0", r),
|
|
306
217
|
...i
|
|
307
218
|
});
|
|
308
219
|
}
|
|
309
220
|
//#endregion
|
|
310
221
|
//#region components/ui/skeleton.tsx
|
|
311
|
-
function
|
|
312
|
-
return /* @__PURE__ */
|
|
222
|
+
function L({ className: e, ...t }) {
|
|
223
|
+
return /* @__PURE__ */ C("div", {
|
|
313
224
|
"data-slot": "skeleton",
|
|
314
|
-
className:
|
|
225
|
+
className: p("animate-pulse rounded-wx-sm bg-wx-bg-elevated", e),
|
|
315
226
|
...t
|
|
316
227
|
});
|
|
317
228
|
}
|
|
318
229
|
//#endregion
|
|
319
230
|
//#region components/widget/author-avatars.tsx
|
|
320
|
-
function
|
|
231
|
+
function R(e) {
|
|
321
232
|
if (!Array.isArray(e)) return;
|
|
322
233
|
let t = e.map((e) => {
|
|
323
234
|
if (!e || typeof e != "object") return null;
|
|
@@ -332,15 +243,15 @@ function L(e) {
|
|
|
332
243
|
}).filter((e) => !!e);
|
|
333
244
|
return t.length > 0 ? t : void 0;
|
|
334
245
|
}
|
|
335
|
-
function
|
|
336
|
-
return !e || e.length === 0 ? null : /* @__PURE__ */
|
|
246
|
+
function z({ authors: e, max: t = 3, className: n }) {
|
|
247
|
+
return !e || e.length === 0 ? null : /* @__PURE__ */ C("span", {
|
|
337
248
|
className: `flex items-center -space-x-1.5 ${n ?? ""}`,
|
|
338
|
-
children: e.slice(0, t).map((e) => e.photoUrl ? /* @__PURE__ */
|
|
249
|
+
children: e.slice(0, t).map((e) => e.photoUrl ? /* @__PURE__ */ C("img", {
|
|
339
250
|
src: e.photoUrl,
|
|
340
251
|
alt: e.name,
|
|
341
252
|
title: e.name,
|
|
342
253
|
className: "h-5 w-5 rounded-full border border-wx-bg object-cover"
|
|
343
|
-
}, e.id) : /* @__PURE__ */
|
|
254
|
+
}, e.id) : /* @__PURE__ */ C("span", {
|
|
344
255
|
title: e.name,
|
|
345
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",
|
|
346
257
|
children: e.name.charAt(0).toUpperCase()
|
|
@@ -349,30 +260,30 @@ function R({ authors: e, max: t = 3, className: n }) {
|
|
|
349
260
|
}
|
|
350
261
|
//#endregion
|
|
351
262
|
//#region components/widget/sticky-search-header.tsx
|
|
352
|
-
function
|
|
353
|
-
return /* @__PURE__ */
|
|
354
|
-
className:
|
|
355
|
-
children: [/* @__PURE__ */
|
|
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, {
|
|
356
267
|
size: 16,
|
|
357
268
|
className: "shrink-0 text-wx-fg-muted"
|
|
358
|
-
}), /* @__PURE__ */
|
|
269
|
+
}), /* @__PURE__ */ C("input", {
|
|
359
270
|
type: "search",
|
|
360
|
-
value:
|
|
361
|
-
onChange: (e) =>
|
|
362
|
-
placeholder:
|
|
363
|
-
className:
|
|
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")
|
|
364
275
|
})]
|
|
365
276
|
});
|
|
366
277
|
}
|
|
367
278
|
//#endregion
|
|
368
279
|
//#region lib/use-scroll-restore.ts
|
|
369
|
-
var
|
|
370
|
-
function
|
|
371
|
-
let t =
|
|
372
|
-
return
|
|
280
|
+
var V = /* @__PURE__ */ new Map();
|
|
281
|
+
function H(e) {
|
|
282
|
+
let t = b(null);
|
|
283
|
+
return v(() => {
|
|
373
284
|
let n = t.current;
|
|
374
285
|
if (!n) return;
|
|
375
|
-
let r =
|
|
286
|
+
let r = V.get(e) ?? 0, i = !1, a = performance.now(), o = () => {
|
|
376
287
|
if (i || !t.current) return;
|
|
377
288
|
let e = t.current;
|
|
378
289
|
if (e.scrollHeight - e.clientHeight >= r) {
|
|
@@ -387,7 +298,7 @@ function V(e) {
|
|
|
387
298
|
};
|
|
388
299
|
requestAnimationFrame(o);
|
|
389
300
|
let s = () => {
|
|
390
|
-
|
|
301
|
+
V.set(e, n.scrollTop);
|
|
391
302
|
};
|
|
392
303
|
return n.addEventListener("scroll", s, { passive: !0 }), () => {
|
|
393
304
|
i = !0, n.removeEventListener("scroll", s);
|
|
@@ -396,12 +307,12 @@ function V(e) {
|
|
|
396
307
|
}
|
|
397
308
|
//#endregion
|
|
398
309
|
//#region components/widget/tabs/news-tab/helpers.ts
|
|
399
|
-
function
|
|
310
|
+
function U(e) {
|
|
400
311
|
if (!e.upstreamUpdatedAt) return !1;
|
|
401
312
|
let t = Date.parse(e.upstreamUpdatedAt), n = Date.parse(e.publishedAt);
|
|
402
313
|
return Number.isNaN(t) || Number.isNaN(n) ? !1 : t > n + 6e4;
|
|
403
314
|
}
|
|
404
|
-
function
|
|
315
|
+
function W(e) {
|
|
405
316
|
let t = Date.parse(e);
|
|
406
317
|
if (Number.isNaN(t)) return "";
|
|
407
318
|
let n = Date.now() - t, r = Math.floor(n / 6e4);
|
|
@@ -414,41 +325,41 @@ function U(e) {
|
|
|
414
325
|
}
|
|
415
326
|
//#endregion
|
|
416
327
|
//#region components/widget/tabs/news-tab/index.tsx
|
|
417
|
-
var
|
|
328
|
+
var G = 10, te = 240;
|
|
418
329
|
function K({ isDummy: e, onOpenArticle: t }) {
|
|
419
|
-
let
|
|
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({
|
|
420
331
|
variables: { args: {
|
|
421
|
-
locale:
|
|
422
|
-
limit:
|
|
332
|
+
locale: u,
|
|
333
|
+
limit: G,
|
|
423
334
|
offset: 0,
|
|
424
|
-
...
|
|
335
|
+
...T ? { query: b } : {}
|
|
425
336
|
} },
|
|
426
|
-
skip: e ||
|
|
337
|
+
skip: e || D,
|
|
427
338
|
notifyOnNetworkStatusChange: !0
|
|
428
339
|
});
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}, [
|
|
432
|
-
let A =
|
|
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, [
|
|
433
344
|
e,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
]), [
|
|
439
|
-
if (!(!
|
|
440
|
-
if (e ||
|
|
441
|
-
|
|
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);
|
|
442
353
|
return;
|
|
443
354
|
}
|
|
444
|
-
|
|
355
|
+
Q(!0);
|
|
445
356
|
try {
|
|
446
|
-
await
|
|
357
|
+
await N({
|
|
447
358
|
variables: { args: {
|
|
448
|
-
locale:
|
|
449
|
-
limit:
|
|
450
|
-
offset:
|
|
451
|
-
...
|
|
359
|
+
locale: u,
|
|
360
|
+
limit: G,
|
|
361
|
+
offset: A?.visitorNewsList.items.length ?? 0,
|
|
362
|
+
...T ? { query: b } : {}
|
|
452
363
|
} },
|
|
453
364
|
updateQuery: (e, { fetchMoreResult: t }) => {
|
|
454
365
|
if (!t) return e;
|
|
@@ -464,76 +375,76 @@ function K({ isDummy: e, onOpenArticle: t }) {
|
|
|
464
375
|
}
|
|
465
376
|
});
|
|
466
377
|
} finally {
|
|
467
|
-
|
|
378
|
+
Q(!1);
|
|
468
379
|
}
|
|
469
380
|
}
|
|
470
381
|
}, [
|
|
471
|
-
|
|
472
|
-
|
|
382
|
+
X,
|
|
383
|
+
Z,
|
|
473
384
|
e,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
]),
|
|
385
|
+
D,
|
|
386
|
+
T,
|
|
387
|
+
b,
|
|
388
|
+
u,
|
|
389
|
+
N,
|
|
390
|
+
A
|
|
391
|
+
]), ne = H("news"), re = _((e) => {
|
|
481
392
|
let t = e.currentTarget;
|
|
482
|
-
t.scrollHeight - t.clientHeight - t.scrollTop <
|
|
483
|
-
}, [
|
|
484
|
-
return
|
|
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", {
|
|
485
396
|
className: "flex flex-1 flex-col items-center justify-center gap-3 px-6 py-12 text-center",
|
|
486
|
-
children: /* @__PURE__ */
|
|
397
|
+
children: /* @__PURE__ */ C("p", {
|
|
487
398
|
className: "text-sm text-wx-fg-muted",
|
|
488
|
-
children:
|
|
399
|
+
children: i("emptyTitle")
|
|
489
400
|
})
|
|
490
|
-
}) : /* @__PURE__ */
|
|
401
|
+
}) : /* @__PURE__ */ w(l, {
|
|
491
402
|
className: "flex-1",
|
|
492
|
-
viewportRef:
|
|
493
|
-
onScroll:
|
|
494
|
-
children: [
|
|
495
|
-
value:
|
|
496
|
-
onChange:
|
|
497
|
-
placeholder:
|
|
498
|
-
}), /* @__PURE__ */
|
|
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", {
|
|
499
410
|
className: "flex flex-col gap-3 px-4 pt-4 pb-6",
|
|
500
|
-
children:
|
|
411
|
+
children: ae ? Array.from({ length: 3 }).map((e, t) => /* @__PURE__ */ w("div", {
|
|
501
412
|
className: "overflow-hidden rounded-wx-lg bg-wx-bg-elevated",
|
|
502
|
-
children: [/* @__PURE__ */
|
|
413
|
+
children: [/* @__PURE__ */ C(L, { className: "aspect-[16/10] w-full rounded-none" }), /* @__PURE__ */ w("div", {
|
|
503
414
|
className: "space-y-2 px-5 py-4",
|
|
504
415
|
children: [
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
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" })
|
|
508
419
|
]
|
|
509
420
|
})]
|
|
510
|
-
}, t)) :
|
|
421
|
+
}, t)) : K.length === 0 ? /* @__PURE__ */ w("div", {
|
|
511
422
|
className: "flex flex-1 flex-col items-center justify-center gap-3 px-6 py-12 text-center",
|
|
512
423
|
children: [
|
|
513
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ C("div", {
|
|
514
425
|
className: "flex h-14 w-14 items-center justify-center rounded-full bg-wx-bg-elevated text-wx-fg-muted",
|
|
515
|
-
children: /* @__PURE__ */
|
|
516
|
-
icon:
|
|
426
|
+
children: /* @__PURE__ */ C(I, {
|
|
427
|
+
icon: F,
|
|
517
428
|
size: 28
|
|
518
429
|
})
|
|
519
430
|
}),
|
|
520
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ C("p", {
|
|
521
432
|
className: "text-base font-semibold text-wx-fg",
|
|
522
|
-
children:
|
|
433
|
+
children: i(T ? "noResults" : "emptyTitle")
|
|
523
434
|
}),
|
|
524
|
-
!
|
|
435
|
+
!T && /* @__PURE__ */ C("p", {
|
|
525
436
|
className: "text-sm text-wx-fg-muted",
|
|
526
|
-
children:
|
|
437
|
+
children: i("emptyBody")
|
|
527
438
|
})
|
|
528
439
|
]
|
|
529
|
-
}) : /* @__PURE__ */
|
|
440
|
+
}) : /* @__PURE__ */ w(S, { children: [K.map((e, n) => /* @__PURE__ */ C(Y, {
|
|
530
441
|
item: e,
|
|
531
|
-
locale:
|
|
532
|
-
delay: n <
|
|
442
|
+
locale: u,
|
|
443
|
+
delay: n < G ? n * .04 : 0,
|
|
533
444
|
onClick: () => t(e.id)
|
|
534
|
-
}, e.id)),
|
|
445
|
+
}, e.id)), Z && /* @__PURE__ */ C("div", {
|
|
535
446
|
className: "flex justify-center py-3",
|
|
536
|
-
children: /* @__PURE__ */
|
|
447
|
+
children: /* @__PURE__ */ C(L, { className: "h-3 w-24" })
|
|
537
448
|
})] })
|
|
538
449
|
})]
|
|
539
450
|
});
|
|
@@ -572,15 +483,15 @@ function q(e, t = 0) {
|
|
|
572
483
|
};
|
|
573
484
|
}
|
|
574
485
|
function J(e, t) {
|
|
575
|
-
let [n, r] =
|
|
576
|
-
return
|
|
486
|
+
let [n, r] = x(e);
|
|
487
|
+
return v(() => {
|
|
577
488
|
let n = setTimeout(() => r(e), t);
|
|
578
489
|
return () => clearTimeout(n);
|
|
579
490
|
}, [e, t]), n;
|
|
580
491
|
}
|
|
581
|
-
function Y({ item:
|
|
582
|
-
let o =
|
|
583
|
-
return /* @__PURE__ */
|
|
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, {
|
|
584
495
|
type: "button",
|
|
585
496
|
onClick: a,
|
|
586
497
|
initial: {
|
|
@@ -597,50 +508,50 @@ function Y({ item: e, locale: n, delay: r, onClick: a }) {
|
|
|
597
508
|
duration: .2,
|
|
598
509
|
delay: r
|
|
599
510
|
},
|
|
600
|
-
className:
|
|
601
|
-
children: [/* @__PURE__ */
|
|
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", {
|
|
602
513
|
className: "aspect-[16/10] w-full bg-cover bg-center",
|
|
603
|
-
style:
|
|
514
|
+
style: t.coverImageUrl ? { backgroundImage: `url(${t.coverImageUrl})` } : { background: `linear-gradient(135deg, ${t.coverGradient[0]}, ${t.coverGradient[1]})` },
|
|
604
515
|
"aria-hidden": "true"
|
|
605
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ w("div", {
|
|
606
517
|
className: "px-5 py-4",
|
|
607
518
|
children: [
|
|
608
|
-
(s.length > 0 ||
|
|
519
|
+
(s.length > 0 || c != null) && /* @__PURE__ */ w("div", {
|
|
609
520
|
className: "mb-1.5 flex items-center justify-between gap-2",
|
|
610
|
-
children: [/* @__PURE__ */
|
|
521
|
+
children: [/* @__PURE__ */ C("div", {
|
|
611
522
|
className: "flex min-w-0 flex-wrap gap-1.5",
|
|
612
|
-
children: s.slice(0, 2).map((e) => /* @__PURE__ */
|
|
523
|
+
children: s.slice(0, 2).map((e) => /* @__PURE__ */ C("span", {
|
|
613
524
|
className: "text-[10px] font-semibold uppercase tracking-wide text-wx-primary",
|
|
614
525
|
children: e.label
|
|
615
526
|
}, e.slug))
|
|
616
|
-
}), /* @__PURE__ */
|
|
617
|
-
authors:
|
|
527
|
+
}), /* @__PURE__ */ C(z, {
|
|
528
|
+
authors: c,
|
|
618
529
|
className: "shrink-0"
|
|
619
530
|
})]
|
|
620
531
|
}),
|
|
621
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ C(i, {
|
|
622
533
|
className: "text-sm",
|
|
623
|
-
children:
|
|
534
|
+
children: t.title
|
|
624
535
|
}),
|
|
625
|
-
|
|
536
|
+
t.excerpt && /* @__PURE__ */ C(u, {
|
|
626
537
|
className: "mt-1 text-xs",
|
|
627
|
-
children:
|
|
538
|
+
children: t.excerpt
|
|
628
539
|
}),
|
|
629
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ w("p", {
|
|
630
541
|
className: "mt-2 flex items-center gap-2 text-xs text-wx-fg-subtle",
|
|
631
|
-
children: [/* @__PURE__ */
|
|
542
|
+
children: [/* @__PURE__ */ C("span", { children: new Date(t.publishedAt).toLocaleDateString(n, {
|
|
632
543
|
month: "short",
|
|
633
544
|
day: "numeric",
|
|
634
545
|
year: "numeric"
|
|
635
|
-
}) }),
|
|
546
|
+
}) }), U(t) && t.upstreamUpdatedAt && /* @__PURE__ */ C("span", {
|
|
636
547
|
className: "rounded-full bg-wx-bg-elevated px-1.5 py-0.5 text-[10px] font-medium text-wx-fg-muted",
|
|
637
|
-
title: new Date(
|
|
638
|
-
children: o("editedAt", { when:
|
|
548
|
+
title: new Date(t.upstreamUpdatedAt).toLocaleString(n),
|
|
549
|
+
children: o("editedAt", { when: W(t.upstreamUpdatedAt) })
|
|
639
550
|
})]
|
|
640
551
|
}),
|
|
641
|
-
|
|
552
|
+
t.tags && t.tags.length > 0 && /* @__PURE__ */ C("div", {
|
|
642
553
|
className: "mt-2.5 flex flex-wrap gap-1",
|
|
643
|
-
children:
|
|
554
|
+
children: t.tags.slice(0, 4).map((e) => /* @__PURE__ */ C("span", {
|
|
644
555
|
className: "rounded-full bg-wx-bg-elevated px-2 py-0.5 text-[10px] font-medium text-wx-fg-muted",
|
|
645
556
|
children: e.label
|
|
646
557
|
}, e.slug))
|
|
@@ -650,6 +561,6 @@ function Y({ item: e, locale: n, delay: r, onClick: a }) {
|
|
|
650
561
|
});
|
|
651
562
|
}
|
|
652
563
|
//#endregion
|
|
653
|
-
export {
|
|
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 };
|
|
654
565
|
|
|
655
|
-
//# sourceMappingURL=widget-react-
|
|
566
|
+
//# sourceMappingURL=widget-react-MXOCL3Mg.js.map
|