@mobilon-dev/chotto 0.3.73 → 0.3.74

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.
@@ -1,7 +1,7 @@
1
1
  import o from "./CallMessage.vue2.js";
2
2
  /* empty css */
3
- import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-cd5bddb1"]]);
3
+ import a from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const r = /* @__PURE__ */ a(o, [["__scopeId", "data-v-ceac70c5"]]);
5
5
  export {
6
- d as default
6
+ r as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as He, inject as re, computed as r, unref as l, toRefs as Ge, ref as g, watch as ce, createElementBlock as i, openBlock as n, normalizeClass as G, createCommentVNode as f, createElementVNode as o, createVNode as Y, withCtx as U, createTextVNode as h, toDisplayString as d, createBlock as V, Fragment as x, withDirectives as Z, vShow as de, vModelText as Ye, Transition as me, nextTick as Ze } from "vue";
1
+ import { defineComponent as He, inject as re, computed as r, unref as l, toRefs as Ge, ref as g, watch as ce, createElementBlock as i, openBlock as n, normalizeClass as G, createCommentVNode as f, createElementVNode as o, createVNode as Y, withCtx as V, createTextVNode as h, toDisplayString as d, createBlock as $, Fragment as x, withDirectives as Z, vShow as de, vModelText as Ye, Transition as me, nextTick as Ze } from "vue";
2
2
  import { useMessageActions as qe } from "../../../hooks/messages/useMessageActions.js";
3
3
  import "../../../node_modules/linkifyjs/dist/linkify.js";
4
4
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
@@ -48,6 +48,15 @@ const Xe = ["messageId"], We = ["src"], et = {
48
48
  type: Object,
49
49
  required: !0
50
50
  },
51
+ /**
52
+ * Позволяет переопределить действие кнопки "Перезвонить" снаружи (например, из feed).
53
+ * Если не задано, компонент эмитит событие `call`.
54
+ */
55
+ onCall: {
56
+ type: Function,
57
+ required: !1,
58
+ default: void 0
59
+ },
51
60
  applyStyle: {
52
61
  type: Function,
53
62
  default: () => null
@@ -58,7 +67,7 @@ const Xe = ["messageId"], We = ["src"], et = {
58
67
  default: () => ({})
59
68
  }
60
69
  },
61
- emits: ["action", "reply"],
70
+ emits: ["action", "reply", "call"],
62
71
  setup(pe, { emit: _e }) {
63
72
  const q = re("channels", void 0), z = re("selectedChat", void 0), fe = r(() => {
64
73
  if (q)
@@ -66,7 +75,7 @@ const Xe = ["messageId"], We = ["src"], et = {
66
75
  }), ge = r(() => {
67
76
  if (z)
68
77
  return l(z);
69
- }), $ = _e, T = pe, { message: a, applyStyle: ye } = Ge(T), M = r(() => {
78
+ }), M = _e, b = pe, { message: a, applyStyle: ye } = Ge(b), N = r(() => {
70
79
  const e = a.value;
71
80
  return e.url ? e.url : typeof e.recordUrl == "string" ? e.recordUrl : void 0;
72
81
  }), {
@@ -75,40 +84,40 @@ const Xe = ["messageId"], We = ["src"], et = {
75
84
  showMenu: J,
76
85
  hideMenu: j,
77
86
  clickAction: he
78
- } = qe(T.message, $), p = g(null), N = r(() => {
87
+ } = qe(b.message, M), p = g(null), I = r(() => {
79
88
  var t;
80
89
  const e = (t = a.value) == null ? void 0 : t.transcript;
81
90
  return !e || typeof e != "object" ? null : e;
82
- }), I = r(() => {
91
+ }), R = r(() => {
83
92
  var t;
84
93
  const e = (t = a.value) == null ? void 0 : t.summary;
85
94
  return !e || typeof e != "object" ? null : e;
86
95
  }), K = r(() => {
87
96
  var t;
88
- const e = (t = N.value) == null ? void 0 : t.html;
97
+ const e = (t = I.value) == null ? void 0 : t.html;
89
98
  return typeof e != "string" ? "" : e.trim();
90
99
  }), Q = r(() => {
91
100
  var t;
92
- const e = (t = I.value) == null ? void 0 : t.html;
101
+ const e = (t = R.value) == null ? void 0 : t.html;
93
102
  return typeof e != "string" ? "" : e.trim();
94
103
  }), X = r(() => {
95
104
  var e;
96
- return ((e = N.value) == null ? void 0 : e.status) === Mt && K.value.length > 0;
105
+ return ((e = I.value) == null ? void 0 : e.status) === Mt && K.value.length > 0;
97
106
  }), W = r(() => {
98
107
  var e;
99
- return ((e = I.value) == null ? void 0 : e.status) === Nt && Q.value.length > 0;
100
- }), R = g({
108
+ return ((e = R.value) == null ? void 0 : e.status) === Nt && Q.value.length > 0;
109
+ }), E = g({
101
110
  text: !1,
102
111
  summary: !1
103
- }), E = r(() => {
104
- var e, t;
105
- return !!((e = N.value) != null && e.status) && !((t = a.value) != null && t.isMissedCall);
106
112
  }), S = r(() => {
107
113
  var e, t;
108
114
  return !!((e = I.value) != null && e.status) && !((t = a.value) != null && t.isMissedCall);
109
- }), xe = r(() => p.value === "text" ? E.value : p.value === "summary" ? S.value : !1), be = r(() => {
115
+ }), F = r(() => {
116
+ var e, t;
117
+ return !!((e = R.value) != null && e.status) && !((t = a.value) != null && t.isMissedCall);
118
+ }), xe = r(() => p.value === "text" ? S.value : p.value === "summary" ? F.value : !1), be = r(() => {
110
119
  var e;
111
- switch ((e = N.value) == null ? void 0 : e.status) {
120
+ switch ((e = I.value) == null ? void 0 : e.status) {
112
121
  case "RECOGNITION_PLANNED":
113
122
  return "Распознаем звонок, пожалуйста подождите...";
114
123
  case "RECOGNITION_ERROR":
@@ -120,7 +129,7 @@ const Xe = ["messageId"], We = ["src"], et = {
120
129
  }
121
130
  }), we = r(() => {
122
131
  var e;
123
- switch ((e = I.value) == null ? void 0 : e.status) {
132
+ switch ((e = R.value) == null ? void 0 : e.status) {
124
133
  case "SUMMARY_PLANNED":
125
134
  return "Формируем резюме, пожалуйста подождите...";
126
135
  case "SUMMARY_ERROR":
@@ -130,7 +139,7 @@ const Xe = ["messageId"], We = ["src"], et = {
130
139
  default:
131
140
  return "Резюме недоступно";
132
141
  }
133
- }), s = g(null), b = g(void 0), m = g(!1), y = g(0), v = g(0), C = g(!1), O = g(0), B = [
142
+ }), s = g(null), w = g(void 0), m = g(!1), y = g(0), v = g(0), C = g(!1), O = g(0), B = [
134
143
  {
135
144
  text: "1.0x",
136
145
  speed: 1
@@ -159,22 +168,22 @@ const Xe = ["messageId"], We = ["src"], et = {
159
168
  m.value = !1, v.value = 0, y.value = ke((e = a.value) == null ? void 0 : e.callDuration) ?? 0, C.value = !1, O.value = 0;
160
169
  };
161
170
  ee(), ce(
162
- M,
171
+ N,
163
172
  (e, t) => {
164
- e !== t && (ee(), b.value = void 0, s.value && (s.value.pause(), s.value.currentTime = 0, s.value.removeAttribute("src"), s.value.load()));
173
+ e !== t && (ee(), w.value = void 0, s.value && (s.value.pause(), s.value.currentTime = 0, s.value.removeAttribute("src"), s.value.load()));
165
174
  }
166
175
  );
167
176
  const te = (e) => {
168
177
  const t = Math.floor(e / 60), u = Math.floor(e % 60);
169
178
  return `${t.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}`;
170
179
  }, Te = r(() => te(v.value)), Me = r(() => te(y.value)), ae = async () => {
171
- const e = M.value;
180
+ const e = N.value;
172
181
  if (!(!s.value || !e))
173
182
  if (m.value)
174
183
  s.value.pause(), m.value = !1;
175
184
  else
176
185
  try {
177
- b.value || (b.value = e, await Ze(), s.value.load()), await s.value.play(), m.value = !0;
186
+ w.value || (w.value = e, await Ze(), s.value.load()), await s.value.play(), m.value = !0;
178
187
  } catch (t) {
179
188
  console.error("Не удалось воспроизвести запись звонка", t), m.value = !1;
180
189
  }
@@ -206,7 +215,7 @@ const Xe = ["messageId"], We = ["src"], et = {
206
215
  }, Ee = () => {
207
216
  m.value = !1;
208
217
  }, Se = () => {
209
- console.error("Не удалось загрузить запись звонка"), m.value = !1, b.value = void 0, s.value && (s.value.pause(), s.value.currentTime = 0, s.value.removeAttribute("src"), s.value.load());
218
+ console.error("Не удалось загрузить запись звонка"), m.value = !1, w.value = void 0, s.value && (s.value.pause(), s.value.currentTime = 0, s.value.removeAttribute("src"), s.value.load());
210
219
  }, A = r(() => {
211
220
  var e;
212
221
  switch ((e = a.value) == null ? void 0 : e.direction) {
@@ -228,20 +237,20 @@ const Xe = ["messageId"], We = ["src"], et = {
228
237
  default:
229
238
  return e ? "#5F5F5F" : "#00AC47";
230
239
  }
231
- }), Oe = r(() => {
240
+ }), Fe = r(() => {
232
241
  var e;
233
242
  return ((e = a.value) == null ? void 0 : e.direction) === "outgoing" ? "Без ответа" : "Пропущенный";
234
243
  }), ne = r(() => {
235
- var F;
244
+ var D;
236
245
  const e = a.value, t = fe.value, u = ge.value;
237
246
  if (!(e != null && e.dialogId) || !t || !u)
238
247
  return null;
239
- const _ = (F = u.dialogs) == null ? void 0 : F.find((w) => w.dialogId === e.dialogId);
248
+ const _ = (D = u.dialogs) == null ? void 0 : D.find((k) => k.dialogId === e.dialogId);
240
249
  if (!(_ != null && _.channelId))
241
250
  return null;
242
- const c = t.find((w) => w.channelId === _.channelId);
251
+ const c = t.find((k) => k.channelId === _.channelId);
243
252
  return (c == null ? void 0 : c.title) || null;
244
- }), Ae = ze(() => T.message, () => T.subtextTooltipData), Fe = {
253
+ }), Oe = ze(() => b.message, () => b.subtextTooltipData), Ae = {
245
254
  message: "message"
246
255
  };
247
256
  function De(e, t) {
@@ -254,18 +263,22 @@ const Xe = ["messageId"], We = ["src"], et = {
254
263
  }
255
264
  }
256
265
  const Le = () => {
257
- alert("Перезвонить");
266
+ if (typeof b.onCall == "function") {
267
+ b.onCall(a.value);
268
+ return;
269
+ }
270
+ M("call", { message: a.value });
258
271
  }, Ue = () => {
259
- if (!E.value) return;
272
+ if (!S.value) return;
260
273
  const e = p.value === "text" ? null : "text";
261
- p.value = e, e === "text" && !X.value && !R.value.text && (R.value.text = !0, $("action", { action: "fetchTranscript", messageId: a.value.messageId }));
274
+ p.value = e, e === "text" && !X.value && !E.value.text && (E.value.text = !0, M("action", { action: "fetchTranscript", messageId: a.value.messageId }));
262
275
  }, Ve = () => {
263
- if (!S.value) return;
276
+ if (!F.value) return;
264
277
  const e = p.value === "summary" ? null : "summary";
265
- p.value = e, e === "summary" && !W.value && !R.value.summary && (R.value.summary = !0, $("action", { action: "fetchCallSummary", messageId: a.value.messageId }));
278
+ p.value = e, e === "summary" && !W.value && !E.value.summary && (E.value.summary = !0, M("action", { action: "fetchCallSummary", messageId: a.value.messageId }));
266
279
  }, $e = async () => {
267
280
  var t, u, _;
268
- const e = M.value;
281
+ const e = N.value;
269
282
  if (e)
270
283
  try {
271
284
  const c = await fetch(e, {
@@ -275,7 +288,7 @@ const Xe = ["messageId"], We = ["src"], et = {
275
288
  });
276
289
  if (!c.ok)
277
290
  throw new Error(`HTTP error! status: ${c.status}`);
278
- const F = c.headers.get("content-type") || "", w = await c.blob(), D = ((u = (t = e.split(".").pop()) == null ? void 0 : t.split("?")[0]) == null ? void 0 : u.toLowerCase()) || "", je = {
291
+ const D = c.headers.get("content-type") || "", k = await c.blob(), L = ((u = (t = e.split(".").pop()) == null ? void 0 : t.split("?")[0]) == null ? void 0 : u.toLowerCase()) || "", je = {
279
292
  "audio/mpeg": "mp3",
280
293
  "audio/mp3": "mp3",
281
294
  "audio/wav": "wav",
@@ -286,9 +299,9 @@ const Xe = ["messageId"], We = ["src"], et = {
286
299
  "audio/flac": "flac",
287
300
  "audio/m4a": "m4a",
288
301
  "audio/x-m4a": "m4a",
289
- "application/octet-stream": D || "mp3"
290
- }, oe = D && ["mp3", "wav", "ogg", "webm", "aac", "flac", "m4a"].includes(D) ? D : je[F] || "mp3", ue = e.split("/"), L = decodeURIComponent(((_ = ue[ue.length - 1]) == null ? void 0 : _.split("?")[0]) || ""), Be = L ? L.includes(".") ? L : `${L}.${oe}` : `call-${a.value.messageId}.${oe}`, ie = window.URL.createObjectURL(w), k = document.createElement("a");
291
- k.href = ie, k.download = Be, document.body.appendChild(k), k.click(), document.body.removeChild(k), window.URL.revokeObjectURL(ie);
302
+ "application/octet-stream": L || "mp3"
303
+ }, oe = L && ["mp3", "wav", "ogg", "webm", "aac", "flac", "m4a"].includes(L) ? L : je[D] || "mp3", ue = e.split("/"), U = decodeURIComponent(((_ = ue[ue.length - 1]) == null ? void 0 : _.split("?")[0]) || ""), Be = U ? U.includes(".") ? U : `${U}.${oe}` : `call-${a.value.messageId}.${oe}`, ie = window.URL.createObjectURL(k), T = document.createElement("a");
304
+ T.href = ie, T.download = Be, document.body.appendChild(T), T.click(), document.body.removeChild(T), window.URL.revokeObjectURL(ie);
292
305
  } catch (c) {
293
306
  console.error("Ошибка при скачивании аудио звонка:", c), e && window.open(e, "_blank");
294
307
  }
@@ -297,7 +310,7 @@ const Xe = ["messageId"], We = ["src"], et = {
297
310
  };
298
311
  return (e, t) => (n(), i("div", {
299
312
  class: G([
300
- De(l(a), Fe.message),
313
+ De(l(a), Ae.message),
301
314
  l(ye)(l(a))
302
315
  ]),
303
316
  messageId: l(a).messageId,
@@ -315,11 +328,11 @@ const Xe = ["messageId"], We = ["src"], et = {
315
328
  }, null, 8, We)) : f("", !0),
316
329
  l(a).subText ? (n(), i("p", et, [
317
330
  Y(ve, {
318
- text: l(Ae),
331
+ text: l(Oe),
319
332
  position: l(a).position === "left" ? "right" : "left",
320
333
  offset: 8
321
334
  }, {
322
- default: U(() => [
335
+ default: V(() => [
323
336
  h(d(l(a).subText), 1)
324
337
  ]),
325
338
  _: 1
@@ -328,22 +341,22 @@ const Xe = ["messageId"], We = ["src"], et = {
328
341
  o("div", tt, [
329
342
  o("div", at, [
330
343
  o("div", st, [
331
- l(a).direction === "incoming" || !l(a).direction ? (n(), V(Ke, {
344
+ l(a).direction === "incoming" || !l(a).direction ? (n(), $(Ke, {
332
345
  key: 0,
333
346
  class: "call-message__direction-icon",
334
347
  color: le.value
335
- }, null, 8, ["color"])) : (n(), V(Qe, {
348
+ }, null, 8, ["color"])) : (n(), $(Qe, {
336
349
  key: 1,
337
350
  class: "call-message__direction-icon",
338
351
  color: le.value
339
352
  }, null, 8, ["color"])),
340
- ne.value ? (n(), V(ve, {
353
+ ne.value ? (n(), $(ve, {
341
354
  key: 2,
342
355
  text: ne.value,
343
356
  position: "top",
344
357
  offset: 8
345
358
  }, {
346
- default: U(() => [
359
+ default: V(() => [
347
360
  l(a).isMissedCall ? (n(), i("span", nt, [
348
361
  h(d(A.value) + " ", 1),
349
362
  l(a).direction !== "incoming" ? (n(), i(x, { key: 0 }, [
@@ -365,12 +378,12 @@ const Xe = ["messageId"], We = ["src"], et = {
365
378
  ])) : (n(), i("span", ot, d(A.value) + " звонок ", 1))
366
379
  ], 64))
367
380
  ]),
368
- l(a).isMissedCall ? (n(), i("p", it, d(Oe.value) + ": " + d(l(a).callAttemptDuration), 1)) : f("", !0),
369
- M.value && !l(a).isMissedCall ? (n(), i("div", rt, [
381
+ l(a).isMissedCall ? (n(), i("p", it, d(Fe.value) + ": " + d(l(a).callAttemptDuration), 1)) : f("", !0),
382
+ N.value && !l(a).isMissedCall ? (n(), i("div", rt, [
370
383
  o("audio", {
371
384
  ref_key: "player",
372
385
  ref: s,
373
- src: b.value,
386
+ src: w.value,
374
387
  type: "audio/webm",
375
388
  onLoadedmetadata: Ie,
376
389
  onTimeupdate: Re,
@@ -452,8 +465,8 @@ const Xe = ["messageId"], We = ["src"], et = {
452
465
  ]),
453
466
  o("div", _t, [
454
467
  o("div", ft, [
455
- !l(a).isMissedCall && (E.value || S.value) ? (n(), i(x, { key: 0 }, [
456
- E.value ? (n(), i("button", {
468
+ !l(a).isMissedCall && (S.value || F.value) ? (n(), i(x, { key: 0 }, [
469
+ S.value ? (n(), i("button", {
457
470
  key: 0,
458
471
  class: G([
459
472
  "call-message__call-button",
@@ -462,7 +475,7 @@ const Xe = ["messageId"], We = ["src"], et = {
462
475
  type: "button",
463
476
  onClick: Ue
464
477
  }, " Текст ", 2)) : f("", !0),
465
- S.value ? (n(), i("button", {
478
+ F.value ? (n(), i("button", {
466
479
  key: 1,
467
480
  class: G([
468
481
  "call-message__call-button",
@@ -481,7 +494,7 @@ const Xe = ["messageId"], We = ["src"], et = {
481
494
  o("span", gt, d(l(a).time), 1)
482
495
  ]),
483
496
  Y(me, { name: "call-message-expand" }, {
484
- default: U(() => [
497
+ default: V(() => [
485
498
  xe.value ? (n(), i("div", yt, [
486
499
  o("div", Ct, [
487
500
  p.value === "text" ? (n(), i(x, { key: 0 }, [
@@ -527,8 +540,8 @@ const Xe = ["messageId"], We = ["src"], et = {
527
540
  ], -1)
528
541
  ])])) : f("", !0),
529
542
  Y(me, null, {
530
- default: U(() => [
531
- l(P) && l(a).actions ? (n(), V(Je, {
543
+ default: V(() => [
544
+ l(P) && l(a).actions ? (n(), $(Je, {
532
545
  key: 0,
533
546
  class: "call-message__context-menu",
534
547
  actions: l(a).actions,
@@ -1,7 +1,7 @@
1
1
  import o from "./Feed.vue2.js";
2
2
  /* empty css */
3
- import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ecfc31fa"]]);
3
+ import d from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ d(o, [["__scopeId", "data-v-dd263ded"]]);
5
5
  export {
6
- a as default
6
+ m as default
7
7
  };