@wexio/messenger-widget-react 1.0.28 → 1.1.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 (42) hide show
  1. package/dist/{widget-react-BeCDy-n82.js → widget-react--Z53yWLq2.js} +11 -3
  2. package/dist/{widget-react--j_oeaHy.js → widget-react-B1xXdkrb.js} +10 -2
  3. package/dist/{widget-react-BaROuJiw.js → widget-react-BAidDzVE.js} +11 -3
  4. package/dist/{widget-react-C68tIjqi2.js → widget-react-BApgrs0F2.js} +10 -2
  5. package/dist/{widget-react-CpCijjXq.js → widget-react-BXWBpwSG.js} +11 -3
  6. package/dist/{widget-react-DyuBV6av.js → widget-react-BeiQb2DF.js} +11 -3
  7. package/dist/{widget-react-T1KxsYpy.js → widget-react-Bewo4hAN.js} +11 -3
  8. package/dist/{widget-react-od9e0Ugq.js → widget-react-Bh-QS4id.js} +11 -3
  9. package/dist/{widget-react-HdCmkcuG.js → widget-react-Br4IdRpT.js} +11 -3
  10. package/dist/{widget-react-CWjaunNP.js → widget-react-Budvz0_j.js} +11 -3
  11. package/dist/{widget-react-B6UhqBJd.js → widget-react-C-AT2-gv.js} +10 -2
  12. package/dist/{widget-react-CPUNK9nH.js → widget-react-C1espdWC.js} +11 -3
  13. package/dist/{widget-react-D4L5tDax2.js → widget-react-C2zCJ9nY2.js} +4 -4
  14. package/dist/{widget-react-CwYIlZc0.js → widget-react-CD4t2uUl.js} +11 -3
  15. package/dist/{widget-react-Bj9TL4Kb.js → widget-react-CHovQzDz.js} +11 -3
  16. package/dist/{widget-react-BU-5w9zn2.js → widget-react-CN_ZiUtH2.js} +7 -7
  17. package/dist/{widget-react-BSrCOwHs.js → widget-react-CQ0MdjMO.js} +225 -225
  18. package/dist/{widget-react-BE-hnNxO2.js → widget-react-CRMJO52c2.js} +10 -2
  19. package/dist/{widget-react-BD4KAXKy2.js → widget-react-CRU0Mk7M2.js} +11 -3
  20. package/dist/{widget-react-DkmenoyB.js → widget-react-CXoyPTrE.js} +10 -2
  21. package/dist/{widget-react-3FsNLmkN.js → widget-react-CYNlFLU2.js} +10 -2
  22. package/dist/{widget-react-DyfWPmJL2.js → widget-react-CoGUeF_h2.js} +10 -2
  23. package/dist/{widget-react-DyMH0fHM.js → widget-react-CrpD2kq2.js} +10 -2
  24. package/dist/{widget-react-Cwn_Gz4N.js → widget-react-CtqfleDq.js} +10 -2
  25. package/dist/{widget-react-DfX-FjHu.js → widget-react-D4IN0PAd.js} +63 -63
  26. package/dist/{widget-react-EUJcOcjS.js → widget-react-D8VVnE_C.js} +11 -3
  27. package/dist/{widget-react-DEf9HRCg.js → widget-react-DCMGvY8I.js} +11 -3
  28. package/dist/{widget-react-D3g52DyI.js → widget-react-Da9YD8ww.js} +11 -3
  29. package/dist/{widget-react-CEQ-cZAm.js → widget-react-DggFuVeH.js} +11 -3
  30. package/dist/{widget-react-D5-vMxtR2.js → widget-react-DvJJgkjL2.js} +11 -3
  31. package/dist/{widget-react-CRhaCC5f.js → widget-react-Dwh_wT04.js} +11 -3
  32. package/dist/{widget-react-CPQgBGlB.js → widget-react-DxMQL_8s.js} +11 -3
  33. package/dist/{widget-react-BfYqRknT.js → widget-react-OBiIuvv4.js} +11 -3
  34. package/dist/{widget-react-D6Pydbhg.js → widget-react-PPEhhlha.js} +11 -3
  35. package/dist/{widget-react-C90ZurSx.js → widget-react-TvsiLCVT.js} +11 -3
  36. package/dist/{widget-react-D2j_XvHF.js → widget-react-eXbKkl7c.js} +11 -3
  37. package/dist/{widget-react-BlpGsLnt.js → widget-react-nq6E5YOO.js} +363 -363
  38. package/dist/{widget-react-ecrdUwW-2.js → widget-react-qRVXcyaM2.js} +10 -2
  39. package/dist/{widget-react-BwHHN-at.js → widget-react-qdPNeB-W.js} +2 -2
  40. package/dist/{widget-react-B3JUsNG42.js → widget-react-zxHGJvC92.js} +34 -32
  41. package/dist/widget-react.js +3174 -2907
  42. package/package.json +1 -1
@@ -127,7 +127,14 @@ var t = /* @__PURE__ */ e({
127
127
  passkeyRegister: "Lần đầu? Thiết lập passkey",
128
128
  passkeyError: "Không thể đăng nhập. Vui lòng thử lại.",
129
129
  passkeyNoCredential: "Chưa có passkey trên thiết bị này — nhấn \"Thiết lập passkey\" để tạo.",
130
- googleSignInDemo: "Tiếp tục với Google"
130
+ googleSignInDemo: "Tiếp tục với Google",
131
+ connectingOperator: "Đã có nhân viên hỗ trợ được chỉ định, vui lòng đợi…",
132
+ withOperator: "Bạn đang trò chuyện với {name}",
133
+ operatorConnected: "Đã kết nối với nhân viên hỗ trợ",
134
+ chatResolved: "Cuộc trò chuyện đã được giải quyết",
135
+ chatResolvedByYou: "Bạn đã giải quyết cuộc trò chuyện",
136
+ chatResolvedByOperator: "{name} đã giải quyết cuộc trò chuyện",
137
+ resolveConversation: "Giải quyết cuộc trò chuyện"
131
138
  }, s = {
132
139
  title: "Trước khi bắt đầu",
133
140
  subtitle: "Vài thông tin nhanh để đội ngũ của chúng tôi hỗ trợ bạn nhanh hơn.",
@@ -159,6 +166,7 @@ var t = /* @__PURE__ */ e({
159
166
  articlesCount: "{count, plural, =0 {Không có bài viết} other {Bài viết: #}}",
160
167
  authorsByline: "Tác giả {first}{remaining, plural, =0 {} other { và # khác}}"
161
168
  }, l = {
169
+ unread: "Tin tức chưa đọc",
162
170
  emptyTitle: "Chưa có cập nhật nào",
163
171
  emptyBody: "Hãy quay lại đây để xem tin tức và thông báo về sản phẩm.",
164
172
  helpful: "Bài viết có hữu ích không?",
@@ -343,4 +351,4 @@ var t = /* @__PURE__ */ e({
343
351
  //#endregion
344
352
  export { t as n, y as t };
345
353
 
346
- //# sourceMappingURL=widget-react-ecrdUwW-2.js.map
354
+ //# sourceMappingURL=widget-react-qRVXcyaM2.js.map
@@ -12,7 +12,7 @@ import "react-dom";
12
12
  import "react/jsx-runtime";
13
13
  import "react-dom/client";
14
14
  import { C as e, S as t, b as n, d as r, w as i, x as a, y as o } from "./widget-react-B9XrHKqv.js";
15
- import { A as s, F as c, X as l, b as u, k as d, n as f, t as p, x as m, z as h } from "./widget-react-DfX-FjHu.js";
15
+ import { A as s, F as c, X as l, b as u, k as d, n as f, t as p, x as m, z as h } from "./widget-react-D4IN0PAd.js";
16
16
  import { i as g, n as _, t as v } from "./widget-react-CQ0DMi7b.js";
17
17
  import { createElement as y, useCallback as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
18
18
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
@@ -11681,4 +11681,4 @@ function Vu({ surface: e, itemId: t, reactionCounts: n, viewerReaction: i, group
11681
11681
  //#endregion
11682
11682
  export { ue as a, ae as c, se as i, re as l, Mu as n, oe as o, ju as r, ie as s, Vu as t };
11683
11683
 
11684
- //# sourceMappingURL=widget-react-BwHHN-at.js.map
11684
+ //# sourceMappingURL=widget-react-qdPNeB-W.js.map
@@ -293,8 +293,12 @@ async function E(e) {
293
293
  }
294
294
  //#endregion
295
295
  //#region components/widget/tabs/messages-tab/composer/voice-recorder-bar/index.tsx
296
- function D({ onComplete: o, onCancel: c, onError: _ }) {
297
- let v = i("messages"), y = d(null), b = d(null), x = d(null), S = d(null), D = d([]), k = d(null), [A, j] = f("recording"), [M, N] = f(0), [P, F] = f(!1), I = d(null), L = d(!1);
296
+ function D(e) {
297
+ let t = e?.name ?? "", n = e?.message ?? "";
298
+ return t === "NotAllowedError" || t === "PermissionDeniedError" ? "denied" : t === "NotFoundError" || t === "NotReadableError" || t === "OverconstrainedError" || t === "SecurityError" || t === "AbortError" || t === "TypeError" || /not found|could not start|secure origin|not readable|in use/i.test(n) ? "failed" : /permission|denied|not allowed/i.test(n) ? "denied" : "failed";
299
+ }
300
+ function O({ onComplete: o, onCancel: c, onError: _ }) {
301
+ let v = i("messages"), y = d(null), b = d(null), x = d(null), S = d(null), O = d([]), A = d(null), [j, M] = f("recording"), [N, P] = f(0), [F, I] = f(!1), L = d(null), R = d(!1);
298
302
  return u(() => {
299
303
  let e = y.current;
300
304
  if (!e) return;
@@ -303,7 +307,7 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
303
307
  return;
304
308
  }
305
309
  let t = !1;
306
- L.current = !1;
310
+ R.current = !1;
307
311
  let n = getComputedStyle(e), r = n.getPropertyValue("--wx-primary").trim() || "#5b6cff", i = n.getPropertyValue("--wx-fg-muted").trim() || "#6b7280", a = l.create({
308
312
  container: e,
309
313
  waveColor: i,
@@ -317,7 +321,7 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
317
321
  interact: !0,
318
322
  hideScrollbar: !0
319
323
  });
320
- b.current = a, a.on("play", () => F(!0)), a.on("pause", () => F(!1)), a.on("finish", () => F(!1));
324
+ b.current = a, a.on("play", () => I(!0)), a.on("pause", () => I(!1)), a.on("finish", () => I(!1));
321
325
  let o = a.registerPlugin(C.create({
322
326
  continuousWaveform: !0,
323
327
  continuousWaveformDuration: 60,
@@ -326,7 +330,7 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
326
330
  x.current = o;
327
331
  let s = null, c = null;
328
332
  return o.startMic().then((e) => {
329
- if (t || L.current) {
333
+ if (t || R.current) {
330
334
  try {
331
335
  e.getTracks().forEach((e) => {
332
336
  e.stop();
@@ -338,25 +342,25 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
338
342
  return;
339
343
  }
340
344
  let n = T(), r = n ? new MediaRecorder(e, { mimeType: n }) : new MediaRecorder(e);
341
- S.current = r, c = r, D.current = [], r.addEventListener("dataavailable", (e) => {
342
- e.data && e.data.size > 0 && D.current.push(e.data);
345
+ S.current = r, c = r, O.current = [], r.addEventListener("dataavailable", (e) => {
346
+ e.data && e.data.size > 0 && O.current.push(e.data);
343
347
  }), r.addEventListener("stop", () => {
344
- if (t || L.current) return;
348
+ if (t || R.current) return;
345
349
  try {
346
350
  o.stopMic();
347
351
  } catch {}
348
- s !== null && (clearInterval(s), s = null, k.current = null);
349
- let e = r.mimeType || n || "audio/webm", i = new Blob(D.current, { type: e });
352
+ s !== null && (clearInterval(s), s = null, A.current = null);
353
+ let e = r.mimeType || n || "audio/webm", i = new Blob(O.current, { type: e });
350
354
  E(i).then((n) => {
351
- if (t || L.current) return;
355
+ if (t || R.current) return;
352
356
  let r = e.includes("mp4") ? "mp4" : "webm";
353
- I.current = {
357
+ L.current = {
354
358
  base64: n,
355
359
  mimetype: e.split(";")[0].trim(),
356
360
  size: i.size,
357
361
  filename: `voice-${Date.now()}.${r}`
358
362
  }, a.loadBlob(i).then(() => {
359
- if (!(t || L.current)) {
363
+ if (!(t || R.current)) {
360
364
  try {
361
365
  a.setOptions({ interact: !0 });
362
366
  } catch {}
@@ -364,18 +368,16 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
364
368
  a.setTime(0);
365
369
  } catch {}
366
370
  }
367
- }).catch(() => {}), j("preview");
371
+ }).catch(() => {}), M("preview");
368
372
  }).catch(() => _("failed"));
369
373
  }), r.start();
370
374
  let i = performance.now();
371
375
  s = window.setInterval(() => {
372
376
  let e = performance.now() - i, t = Math.floor(e / 1e3);
373
- N((e) => e === t ? e : t);
374
- }, 250), k.current = s;
377
+ P((e) => e === t ? e : t);
378
+ }, 250), A.current = s;
375
379
  }).catch((e) => {
376
- if (t) return;
377
- let n = e?.message ?? "";
378
- _(n.includes("Permission") || n.includes("denied") ? "denied" : "failed");
380
+ t || _(D(e));
379
381
  }), () => {
380
382
  t = !0, s !== null && clearInterval(s);
381
383
  try {
@@ -398,10 +400,10 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
398
400
  transition: { duration: .18 },
399
401
  className: a("flex items-center gap-1.5 rounded-wx-lg border border-wx-border bg-wx-bg px-2 py-2"),
400
402
  children: [
401
- /* @__PURE__ */ m(O, {
403
+ /* @__PURE__ */ m(k, {
402
404
  Icon: t,
403
405
  onClick: () => {
404
- L.current = !0;
406
+ R.current = !0;
405
407
  try {
406
408
  S.current?.state === "recording" && S.current.stop();
407
409
  } catch {}
@@ -419,22 +421,22 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
419
421
  /* @__PURE__ */ h("div", {
420
422
  className: "flex h-9 min-w-0 flex-1 items-center gap-2 rounded-full bg-wx-bg-elevated px-3",
421
423
  children: [
422
- A === "recording" && /* @__PURE__ */ m("span", {
424
+ j === "recording" && /* @__PURE__ */ m("span", {
423
425
  "aria-hidden": "true",
424
426
  className: "h-2 w-2 shrink-0 animate-pulse rounded-full bg-wx-danger"
425
427
  }),
426
428
  /* @__PURE__ */ m("div", {
427
429
  ref: y,
428
430
  "aria-hidden": "true",
429
- className: a("min-w-0 flex-1 overflow-hidden", A !== "preview" && "pointer-events-none")
431
+ className: a("min-w-0 flex-1 overflow-hidden", j !== "preview" && "pointer-events-none")
430
432
  }),
431
433
  /* @__PURE__ */ m("span", {
432
434
  className: "shrink-0 font-mono text-xs tabular-nums text-wx-fg-muted",
433
- children: w(M)
435
+ children: w(N)
434
436
  })
435
437
  ]
436
438
  }),
437
- A === "recording" && /* @__PURE__ */ m(e.button, {
439
+ j === "recording" && /* @__PURE__ */ m(e.button, {
438
440
  type: "button",
439
441
  onClick: () => {
440
442
  try {
@@ -452,18 +454,18 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
452
454
  className: a("flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors", "text-wx-fg-muted hover:bg-wx-bg-elevated hover:text-wx-fg"),
453
455
  children: /* @__PURE__ */ m(g, { size: 14 })
454
456
  }),
455
- A === "preview" && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(O, {
456
- Icon: P ? n : r,
457
+ j === "preview" && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(k, {
458
+ Icon: F ? n : r,
457
459
  onClick: () => {
458
460
  let e = b.current;
459
461
  e && (e.isPlaying() ? e.pause() : e.play());
460
462
  },
461
- ariaLabel: v(P ? "pauseRecording" : "playPreview"),
463
+ ariaLabel: v(F ? "pauseRecording" : "playPreview"),
462
464
  intent: "ghost"
463
465
  }), /* @__PURE__ */ m(e.button, {
464
466
  type: "button",
465
467
  onClick: () => {
466
- let e = I.current;
468
+ let e = L.current;
467
469
  e && o(e);
468
470
  },
469
471
  "aria-label": v("sendCta"),
@@ -480,7 +482,7 @@ function D({ onComplete: o, onCancel: c, onError: _ }) {
480
482
  ]
481
483
  }, "voice-recorder");
482
484
  }
483
- function O({ Icon: t, onClick: n, ariaLabel: r, intent: i, size: o = 16 }) {
485
+ function k({ Icon: t, onClick: n, ariaLabel: r, intent: i, size: o = 16 }) {
484
486
  let s = c();
485
487
  return /* @__PURE__ */ m(e.button, {
486
488
  type: "button",
@@ -502,6 +504,6 @@ function O({ Icon: t, onClick: n, ariaLabel: r, intent: i, size: o = 16 }) {
502
504
  });
503
505
  }
504
506
  //#endregion
505
- export { D as VoiceRecorderBar };
507
+ export { O as VoiceRecorderBar };
506
508
 
507
- //# sourceMappingURL=widget-react-B3JUsNG42.js.map
509
+ //# sourceMappingURL=widget-react-zxHGJvC92.js.map