@wexio/messenger-widget-react 1.4.0 → 1.5.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +2 -1
  3. package/dist/widget-react-3V_rXy9h2.js +2 -0
  4. package/dist/widget-react-3f61yzjR2.js +2 -0
  5. package/dist/widget-react-B-ZYj6cV2.js +2 -0
  6. package/dist/widget-react-B4Cru-SF.js +2 -0
  7. package/dist/widget-react-B5AYwhao.js +2 -0
  8. package/dist/widget-react-B6YWdHd3.js +2 -0
  9. package/dist/widget-react-BOjoaxsM2.js +2 -0
  10. package/dist/widget-react-BPFWT7Xe2.js +4 -0
  11. package/dist/widget-react-BSvxi-Z42.js +2 -0
  12. package/dist/widget-react-BbznnvpE2.js +2 -0
  13. package/dist/widget-react-Bebf7ovl.js +140 -0
  14. package/dist/widget-react-BrRmLgRl.js +163 -0
  15. package/dist/widget-react-BwK-nNjy2.js +2 -0
  16. package/dist/widget-react-BxEMz2N0.js +2 -0
  17. package/dist/widget-react-BzFUXA092.js +2 -0
  18. package/dist/widget-react-C-hnCqBf.js +2 -0
  19. package/dist/widget-react-C40Ha_9C.js +2 -0
  20. package/dist/widget-react-C7KHTFEo.js +2 -0
  21. package/dist/widget-react-CAfHMzrc2.js +2 -0
  22. package/dist/widget-react-CLJmIz_q.js +2 -0
  23. package/dist/widget-react-CLLhrdTm.js +2 -0
  24. package/dist/widget-react-CO7DyU51.js +201 -0
  25. package/dist/widget-react-CZoYXyup.js +2 -0
  26. package/dist/widget-react-C_NCNYY02.js +7 -0
  27. package/dist/widget-react-CnP2-ZB-.js +285 -0
  28. package/dist/widget-react-CuUeo68W.js +2 -0
  29. package/dist/widget-react-D2sqPDts.js +2 -0
  30. package/dist/widget-react-D5n4whHu2.js +2 -0
  31. package/dist/widget-react-D8W_ZdMH.js +2 -0
  32. package/dist/widget-react-DA0S6cIc.js +2 -0
  33. package/dist/widget-react-DE0LS-6-.js +2 -0
  34. package/dist/widget-react-DGh__emN.js +2 -0
  35. package/dist/widget-react-DIFOZ3QT.js +2 -0
  36. package/dist/widget-react-DJczk-Ax.js +2 -0
  37. package/dist/widget-react-DQJxxVB92.js +2 -0
  38. package/dist/widget-react-DS_ZoY1F.js +2 -0
  39. package/dist/widget-react-DUnaBOfT.js +10 -0
  40. package/dist/widget-react-DhLRmjli.js +2 -0
  41. package/dist/widget-react-Dl2PevZk.js +2 -0
  42. package/dist/widget-react-DmRVdLdI.js +2 -0
  43. package/dist/widget-react-DouawI6y.js +2 -0
  44. package/dist/widget-react-DozV7eMU2.js +2 -0
  45. package/dist/widget-react-Dpkdglv0.js +2 -0
  46. package/dist/widget-react-Dry9kqXE2.js +2 -0
  47. package/dist/widget-react-FX5W7RyV.js +4 -0
  48. package/dist/widget-react-G9X1DcTe.js +2 -0
  49. package/dist/widget-react-KAEA8ONo.js +2 -0
  50. package/dist/widget-react-Ov6re_Q9.js +2 -0
  51. package/dist/widget-react-XV6SIcqN2.js +2 -0
  52. package/dist/widget-react-XZ_nYDTj.js +2 -0
  53. package/dist/widget-react-oNTR-eNh.js +2 -0
  54. package/dist/widget-react-txPtcpni.js +2 -0
  55. package/dist/widget-react-zZBDvBBt2.js +2 -0
  56. package/dist/widget-react.js +50 -36283
  57. package/dist/widget-react.licenses.txt +3604 -0
  58. package/package.json +1 -1
  59. package/dist/widget-react--IUy5lNt.js +0 -510
  60. package/dist/widget-react-B7es3n1-.js +0 -32
  61. package/dist/widget-react-BAUpSGhZ.js +0 -1345
  62. package/dist/widget-react-BS9kUSRS.js +0 -255
  63. package/dist/widget-react-BT30ojz0.js +0 -371
  64. package/dist/widget-react-BXf2Ty8d.js +0 -364
  65. package/dist/widget-react-BgALABDe.js +0 -39
  66. package/dist/widget-react-BgunakAG.js +0 -566
  67. package/dist/widget-react-BkXA6ytR.js +0 -23856
  68. package/dist/widget-react-Bvtklo8g.js +0 -356
  69. package/dist/widget-react-BxEjM2it.js +0 -118
  70. package/dist/widget-react-CN_FIvMD.js +0 -834
  71. package/dist/widget-react-CTdz_dwX.js +0 -306
  72. package/dist/widget-react-Ck8JAYqT.js +0 -22122
  73. package/dist/widget-react-CyAVDflZ.js +0 -273
  74. package/dist/widget-react-DSAyUf2U.js +0 -229
  75. package/dist/widget-react-DbOJZl9F.js +0 -4932
  76. package/dist/widget-react-DgIxSjv7.js +0 -25
  77. package/dist/widget-react-Ds5J9FbQ.js +0 -27
  78. package/dist/widget-react-SI7deQTE.js +0 -35
  79. package/dist/widget-react-krPPnv02.js +0 -4438
  80. package/dist/widget-react-wSc9gIfG.js +0 -198
@@ -1,306 +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 { F as e, I as t, M as n, N as r, b as i, c as a, ct as ee, k as te, l as o, st as s, u as c, y as l, yt as u, z as d } from "./widget-react-Ck8JAYqT.js";
15
- import { i as f, n as p } from "./widget-react-krPPnv02.js";
16
- import { i as ne } from "./widget-react-CN_FIvMD.js";
17
- import { o as re, p as ie, s as m, t as h } from "./widget-react-BT30ojz0.js";
18
- import { t as ae } from "./widget-react-SI7deQTE.js";
19
- import { a as g, i as _, n as oe, o as v, r as y, s as b, t as x } from "./widget-react-CyAVDflZ.js";
20
- import { useEffect as S, useMemo as C, useRef as se, useState as ce } from "react";
21
- import { jsx as w, jsxs as T } from "react/jsx-runtime";
22
- //#region components/widget/help-article-view/helpers.ts
23
- function le(e) {
24
- let t = (e) => Array.isArray(e) ? e : [];
25
- return {
26
- id: String(e._id ?? ""),
27
- title: typeof e.title == "string" ? e.title : "",
28
- excerpt: typeof e.excerpt == "string" ? e.excerpt : "",
29
- content: typeof e.content == "string" ? e.content : "",
30
- contentFormat: e.contentFormat === g.HTML ? g.HTML : g.MARKDOWN,
31
- authors: t(e.authors).filter((e) => !!e && typeof e == "object").map((e) => ({
32
- _id: String(e._id ?? ""),
33
- name: typeof e.name == "string" ? e.name : null,
34
- photo: e.photo
35
- })),
36
- tags: t(e.tags).filter((e) => !!e && typeof e == "object").map((e) => ({
37
- _id: String(e._id ?? ""),
38
- slug: typeof e.slug == "string" ? e.slug : "",
39
- label: typeof e.label == "string" ? e.label : ""
40
- }))
41
- };
42
- }
43
- //#endregion
44
- //#region components/widget/help-article-view/index.tsx
45
- function E({ slug: p, locale: E, isDummy: O, onHandoff: k, onOpenArticle: A, onOpenTranslation: j, onTitleResolved: M }) {
46
- let N = f("help"), P = e(), F = n(), { config: I } = te(), L = I.messenger?.showRelatedHelpArticles ?? !0, R = I.messenger?.showReactionCounts ?? !0, z = ae(), [B, ue] = ce(E), V = t(B, P), H = C(() => {
47
- if (O) return null;
48
- let e = F.previewData?.helpArticles;
49
- return Array.isArray(e) ? e.find((e) => e && typeof e == "object" && e.slug === p) ?? null : null;
50
- }, [
51
- F.previewData,
52
- O,
53
- p
54
- ]), U = !!H, { data: W, loading: de } = m({
55
- variables: { args: {
56
- slug: p,
57
- locale: E
58
- } },
59
- skip: O || U
60
- }), G = s(), K = o(G && !O && !U ? d.article(G, p, E) : null, W), [q] = re(), { trackLinkClick: J } = a(), Y = se(null), X = C(() => O ? u(V).find((e) => e.slug === p) : null, [
61
- O,
62
- p,
63
- V
64
- ]), Z = O ? X ? {
65
- id: X.id,
66
- title: X.title,
67
- excerpt: X.excerpt,
68
- content: X.contentMarkdown,
69
- contentFormat: g.MARKDOWN,
70
- authors: X.authors,
71
- tags: X.tags,
72
- reactionCounts: null,
73
- locale: B,
74
- translations: []
75
- } : null : U && H ? {
76
- ...le(H),
77
- reactionCounts: H.reactionCounts ?? null,
78
- locale: E,
79
- translations: []
80
- } : K?.visitorHelpArticle ? {
81
- id: K.visitorHelpArticle._id,
82
- title: K.visitorHelpArticle.title,
83
- excerpt: K.visitorHelpArticle.excerpt ?? "",
84
- content: K.visitorHelpArticle.content,
85
- contentFormat: K.visitorHelpArticle.contentFormat,
86
- authors: K.visitorHelpArticle.authors,
87
- tags: K.visitorHelpArticle.tags,
88
- reactionCounts: K.visitorHelpArticle.reactionCounts ?? null,
89
- locale: K.visitorHelpArticle.locale,
90
- translations: K.visitorHelpArticle.translations
91
- } : null, { data: fe } = ie({
92
- variables: {
93
- articleId: Z?.id ?? "",
94
- limit: 5,
95
- locale: E
96
- },
97
- skip: O || U || !Z?.id || !L
98
- }), pe = C(() => {
99
- if (!U || !Z?.id) return [];
100
- let e = (F.previewData?.helpArticles ?? []).filter((e) => !!e && typeof e == "object"), t = new Set((Z.tags ?? []).map((e) => typeof e == "object" && e && "slug" in e ? String(e.slug) : null).filter((e) => !!e)), n = (() => {
101
- let e = H;
102
- if (!e) return null;
103
- let t = e.folderId;
104
- if (typeof t == "string") return t;
105
- let n = e.folder;
106
- if (n && typeof n == "object" && "_id" in n) {
107
- let e = n._id;
108
- return typeof e == "string" ? e : null;
109
- }
110
- return null;
111
- })();
112
- return e.filter((e) => String(e._id ?? "") !== Z.id).map((e) => {
113
- let r = typeof e.folderId == "string" ? e.folderId : e.folder && typeof e.folder == "object" && "_id" in e.folder ? String(e.folder._id ?? "") : null, i = Array.isArray(e.tags) ? e.tags.map((e) => typeof e == "object" && e && "slug" in e ? String(e.slug) : null).filter((e) => !!e) : [];
114
- return {
115
- raw: e,
116
- score: (n && r === n ? 2 : 0) + i.filter((e) => t.has(e)).length
117
- };
118
- }).filter((e) => e.score > 0).sort((e, t) => t.score - e.score).slice(0, 5).map(({ raw: e }) => ({
119
- _id: String(e._id ?? ""),
120
- title: typeof e.title == "string" ? e.title : "",
121
- slug: typeof e.slug == "string" ? e.slug : "",
122
- excerpt: typeof e.excerpt == "string" ? e.excerpt : null
123
- }));
124
- }, [
125
- U,
126
- Z,
127
- H,
128
- F.previewData
129
- ]), Q = U ? pe : fe?.visitorHelpRelated ?? [], me = O || U ? null : W?.visitorHelpArticle?.viewerReaction ?? null, he = !O && !U && W?.visitorHelpArticle ? [W.visitorHelpArticle._id, ...(W.visitorHelpArticle.translations ?? []).map((e) => e._id)] : Z?.id ? [Z.id] : [];
130
- S(() => {
131
- O || !Z?.id || !ee() || q({ variables: { articleId: Z.id } }).catch(() => {});
132
- }, [
133
- Z?.id,
134
- O,
135
- q
136
- ]), S(() => {
137
- O || U || !Z?.id || Y.current !== Z.id && (Y.current = Z.id, J({
138
- url: `/help/${p}`,
139
- targetType: "HELP_ARTICLE",
140
- targetRefId: Z.id
141
- }));
142
- }, [
143
- Z?.id,
144
- O,
145
- U,
146
- p,
147
- J
148
- ]), _(Z?.title, M);
149
- let ge = () => k();
150
- if (!de && !Z) return /* @__PURE__ */ w("div", {
151
- className: "flex flex-1 flex-col items-center justify-center px-6 py-12",
152
- children: /* @__PURE__ */ w(l, { children: /* @__PURE__ */ w(i, {
153
- className: "py-8 text-center",
154
- children: /* @__PURE__ */ w("p", {
155
- className: "text-sm font-semibold text-wx-fg",
156
- children: N("articleNotFound")
157
- })
158
- }) })
159
- });
160
- let _e = E.split("-")[0].toLowerCase(), $ = Z ? Z.locale.split("-")[0].toLowerCase() : null;
161
- return !O && !U && !I.contentLocaleFallback && $ !== null && $ !== _e ? /* @__PURE__ */ w("div", {
162
- className: "flex flex-1 flex-col items-center justify-center px-6 py-12",
163
- children: /* @__PURE__ */ w(l, { children: /* @__PURE__ */ w(i, {
164
- className: "py-8 text-center",
165
- children: /* @__PURE__ */ w("p", {
166
- className: "text-sm font-semibold text-wx-fg",
167
- children: N("articleNotTranslated")
168
- })
169
- }) })
170
- }) : Z ? /* @__PURE__ */ w(c, {
171
- className: "flex-1",
172
- children: /* @__PURE__ */ T("div", {
173
- className: "flex flex-col px-5 pt-5 pb-12",
174
- children: [
175
- /* @__PURE__ */ w("h2", {
176
- className: "text-xl leading-tight font-bold text-wx-fg",
177
- children: Z.title
178
- }),
179
- Z.authors.length > 0 && /* @__PURE__ */ T("p", {
180
- className: "mt-2 flex items-center gap-2 text-xs text-wx-fg-muted",
181
- children: [/* @__PURE__ */ w("span", {
182
- className: "flex -space-x-1.5",
183
- children: Z.authors.slice(0, 3).map((e) => /* @__PURE__ */ w("span", {
184
- className: "h-5 w-5 overflow-hidden rounded-full bg-wx-bg-elevated ring-1 ring-wx-bg",
185
- "aria-hidden": "true",
186
- children: e.photo?.url ? /* @__PURE__ */ w("img", {
187
- src: e.photo.url,
188
- alt: "",
189
- className: "h-full w-full object-cover"
190
- }) : /* @__PURE__ */ w("span", {
191
- className: "flex h-full w-full items-center justify-center text-[10px] font-semibold uppercase text-wx-fg-muted",
192
- children: (e.name ?? "?").charAt(0)
193
- })
194
- }, e._id))
195
- }), /* @__PURE__ */ w("span", { children: N("writtenBy", { names: Z.authors.map((e) => e.name ?? "").filter(Boolean).join(", ") }) })]
196
- }),
197
- Z.tags.length > 0 && /* @__PURE__ */ w("div", {
198
- className: "mt-2 flex flex-wrap gap-1",
199
- children: Z.tags.map((e) => /* @__PURE__ */ w("span", {
200
- className: "rounded-full bg-wx-bg-elevated px-2 py-0.5 text-[11px] font-medium text-wx-fg-muted",
201
- children: e.label
202
- }, e._id))
203
- }),
204
- Z.excerpt && /* @__PURE__ */ w("p", {
205
- className: "mt-2 mb-5 text-sm text-wx-fg-muted",
206
- children: Z.excerpt
207
- }),
208
- /* @__PURE__ */ w(y, {
209
- content: Z.content,
210
- isHtml: Z.contentFormat === g.HTML || b(Z.content),
211
- markdownMarginClass: "mt-3"
212
- }),
213
- /* @__PURE__ */ T(h, {
214
- type: "button",
215
- variant: "solid",
216
- size: "lg",
217
- className: "mt-6 w-full shrink-0 min-h-12",
218
- onClick: ge,
219
- ...z.parentHandlers,
220
- children: [/* @__PURE__ */ w(ne, {
221
- ref: z.iconRef,
222
- size: 16
223
- }), /* @__PURE__ */ w("span", { children: N("unresolvedCta") })]
224
- }),
225
- Z.id && /* @__PURE__ */ w(x, {
226
- surface: v.HELP,
227
- itemId: Z.id,
228
- reactionCounts: Z.reactionCounts,
229
- viewerReaction: me,
230
- groupItemIds: he,
231
- isDummy: O,
232
- showCounts: R,
233
- className: "mt-4"
234
- }),
235
- /* @__PURE__ */ w(oe, {
236
- currentLocale: O ? B : Z.locale,
237
- locales: O ? [...r] : Z.translations.map((e) => e.locale),
238
- allowedLocales: O ? void 0 : I.supportedLocales,
239
- onSelect: O ? (e) => ue(e) : (e) => {
240
- let t = Z.translations.find((t) => t.locale === e);
241
- t && j?.(t.slug, t.locale);
242
- },
243
- className: "mt-6"
244
- }),
245
- L && Q.length > 0 && /* @__PURE__ */ T("section", {
246
- className: "mt-6",
247
- children: [/* @__PURE__ */ w("p", {
248
- className: "mb-2 text-xs font-semibold tracking-wide text-wx-fg-muted uppercase",
249
- children: N("relatedTitle")
250
- }), /* @__PURE__ */ w("ul", {
251
- className: "flex flex-col gap-1.5",
252
- children: Q.map((e) => /* @__PURE__ */ w("li", { children: /* @__PURE__ */ T("button", {
253
- type: "button",
254
- onClick: () => A?.(e.slug),
255
- className: "flex w-full flex-col items-start gap-0.5 rounded-wx-lg bg-wx-bg-elevated px-3 py-2 text-left transition-colors hover:bg-wx-bg-elevated/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary",
256
- children: [/* @__PURE__ */ w("span", {
257
- className: "block truncate text-sm font-medium text-wx-fg",
258
- children: e.title
259
- }), e.excerpt && /* @__PURE__ */ w("span", {
260
- className: "line-clamp-1 block text-xs text-wx-fg-muted",
261
- children: e.excerpt
262
- })]
263
- }) }, e._id))
264
- })]
265
- })
266
- ]
267
- })
268
- }) : /* @__PURE__ */ w(D, {});
269
- }
270
- function D() {
271
- return /* @__PURE__ */ w(c, {
272
- className: "flex-1",
273
- children: /* @__PURE__ */ T("div", {
274
- className: "flex flex-col px-5 pt-5 pb-12",
275
- "aria-busy": "true",
276
- "aria-live": "polite",
277
- children: [
278
- /* @__PURE__ */ T("div", {
279
- className: "animate-pulse space-y-2.5",
280
- children: [/* @__PURE__ */ w("div", { className: "h-5 w-3/4 rounded-md bg-wx-bg-elevated" }), /* @__PURE__ */ w("div", { className: "h-5 w-1/2 rounded-md bg-wx-bg-elevated" })]
281
- }),
282
- /* @__PURE__ */ T("div", {
283
- className: "mt-4 flex items-center gap-2 animate-pulse",
284
- children: [/* @__PURE__ */ w("div", { className: "h-5 w-5 rounded-full bg-wx-bg-elevated" }), /* @__PURE__ */ w("div", { className: "h-3 w-32 rounded-md bg-wx-bg-elevated" })]
285
- }),
286
- /* @__PURE__ */ w("div", {
287
- className: "mt-6 space-y-2.5 animate-pulse",
288
- children: [
289
- "w-full",
290
- "w-11/12",
291
- "w-10/12",
292
- "w-full",
293
- "w-9/12",
294
- "w-full",
295
- "w-11/12",
296
- "w-7/12"
297
- ].map((e, t) => /* @__PURE__ */ w("div", { className: p("h-3 rounded-md bg-wx-bg-elevated", e) }, t))
298
- })
299
- ]
300
- })
301
- });
302
- }
303
- //#endregion
304
- export { E as HelpArticleView };
305
-
306
- //# sourceMappingURL=widget-react-CTdz_dwX.js.map