@_solaris/messenger-widget 0.6.3 → 0.6.5
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/dist/iframe/iframe.css +1 -1
- package/dist/iframe/iframe.js +4 -4
- package/dist/messenger.cjs +2 -2
- package/dist/messenger.js +239 -207
- package/dist/snippet.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/messenger.js
CHANGED
|
@@ -137,7 +137,7 @@ function tt(e) {
|
|
|
137
137
|
return t.lastBootstrap = V, await k(), typeof document < "u" && (t.visibilityHandler = _, document.addEventListener(
|
|
138
138
|
"visibilitychange",
|
|
139
139
|
t.visibilityHandler
|
|
140
|
-
)),
|
|
140
|
+
)), h(), V;
|
|
141
141
|
}
|
|
142
142
|
async function k() {
|
|
143
143
|
try {
|
|
@@ -277,7 +277,7 @@ function tt(e) {
|
|
|
277
277
|
}
|
|
278
278
|
function ye(u) {
|
|
279
279
|
const g = t.panelOpen;
|
|
280
|
-
t.panelOpen = !!u, t.panelOpen ? (clearTimeout(t.burstTimer), Q()) : te(), g !== t.panelOpen &&
|
|
280
|
+
t.panelOpen = !!u, t.panelOpen ? (clearTimeout(t.burstTimer), Q()) : te(), g !== t.panelOpen && h();
|
|
281
281
|
}
|
|
282
282
|
async function pe() {
|
|
283
283
|
try {
|
|
@@ -290,29 +290,29 @@ function tt(e) {
|
|
|
290
290
|
console.error("[transport] poll failed", u);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
if (
|
|
293
|
+
function h() {
|
|
294
|
+
if (m(), typeof document < "u" && document.hidden) return;
|
|
295
295
|
const u = t.panelOpen ? Qe : Xe;
|
|
296
296
|
t.pollTimer = setInterval(pe, u);
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function m() {
|
|
299
299
|
t.pollTimer && (clearInterval(t.pollTimer), t.pollTimer = null);
|
|
300
300
|
}
|
|
301
301
|
function _() {
|
|
302
302
|
if (document.hidden)
|
|
303
303
|
clearTimeout(t.hiddenGraceTimer), t.hiddenGraceTimer = setTimeout(() => {
|
|
304
|
-
t.hiddenGraceTimer = null, document.hidden && (
|
|
304
|
+
t.hiddenGraceTimer = null, document.hidden && (m(), Z(), i("paused"));
|
|
305
305
|
}, et);
|
|
306
306
|
else {
|
|
307
307
|
if (t.hiddenGraceTimer) {
|
|
308
308
|
clearTimeout(t.hiddenGraceTimer), t.hiddenGraceTimer = null;
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
i("idle"),
|
|
311
|
+
i("idle"), h(), t.panelOpen && Q();
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
function w() {
|
|
315
|
-
|
|
315
|
+
m(), clearTimeout(t.burstTimer), clearTimeout(t.hiddenGraceTimer), t.hiddenGraceTimer = null, Z(), t.visibilityHandler && (document.removeEventListener(
|
|
316
316
|
"visibilitychange",
|
|
317
317
|
t.visibilityHandler
|
|
318
318
|
), t.visibilityHandler = null), t.started = !1;
|
|
@@ -407,48 +407,48 @@ function it(e) {
|
|
|
407
407
|
connection: "idle"
|
|
408
408
|
}), s = [];
|
|
409
409
|
s.push(
|
|
410
|
-
e.on("connection", (
|
|
411
|
-
t.connection =
|
|
410
|
+
e.on("connection", (h) => {
|
|
411
|
+
t.connection = h;
|
|
412
412
|
})
|
|
413
413
|
), s.push(
|
|
414
|
-
e.on("message", (
|
|
415
|
-
const
|
|
416
|
-
!
|
|
414
|
+
e.on("message", (h) => {
|
|
415
|
+
const m = h == null ? void 0 : h.conversation_id, _ = h == null ? void 0 : h.message;
|
|
416
|
+
!m || !(_ != null && _.id) || (X(m, _), _.client_msg_id && delete t.streamingByMsgId[_.client_msg_id], Z(m, _.created_at));
|
|
417
417
|
})
|
|
418
418
|
), s.push(
|
|
419
|
-
e.on("message_stream", (
|
|
420
|
-
const
|
|
421
|
-
!
|
|
419
|
+
e.on("message_stream", (h) => {
|
|
420
|
+
const m = h == null ? void 0 : h.message_id, _ = h == null ? void 0 : h.token;
|
|
421
|
+
!m || typeof _ != "string" || (t.streamingByMsgId[m] = (t.streamingByMsgId[m] || "") + _);
|
|
422
422
|
})
|
|
423
423
|
), s.push(
|
|
424
|
-
e.on("conversation_updated", (
|
|
425
|
-
const
|
|
426
|
-
if (!
|
|
427
|
-
const w = t.conversations.findIndex((A) => A.id ===
|
|
424
|
+
e.on("conversation_updated", (h) => {
|
|
425
|
+
const m = h == null ? void 0 : h.conversation_id, _ = h == null ? void 0 : h.changes;
|
|
426
|
+
if (!m || !_) return;
|
|
427
|
+
const w = t.conversations.findIndex((A) => A.id === m);
|
|
428
428
|
w !== -1 && (t.conversations[w] = {
|
|
429
429
|
...t.conversations[w],
|
|
430
430
|
..._
|
|
431
431
|
});
|
|
432
432
|
})
|
|
433
433
|
), s.push(
|
|
434
|
-
e.on("config_updated", (
|
|
435
|
-
|
|
434
|
+
e.on("config_updated", (h) => {
|
|
435
|
+
h != null && h.config && (t.config = h.config);
|
|
436
436
|
})
|
|
437
437
|
), s.push(
|
|
438
|
-
e.on("action_status", (
|
|
439
|
-
const
|
|
440
|
-
if (!
|
|
441
|
-
const A = t.runningActionsByConv[
|
|
442
|
-
|
|
438
|
+
e.on("action_status", (h) => {
|
|
439
|
+
const m = h == null ? void 0 : h.conversation_id, _ = h == null ? void 0 : h.action_id, w = h == null ? void 0 : h.action_name;
|
|
440
|
+
if (!m || !_) return;
|
|
441
|
+
const A = t.runningActionsByConv[m] || {};
|
|
442
|
+
h.state === "running" ? (A[_] = w || _, t.runningActionsByConv[m] = { ...A }) : h.state === "done" && (delete A[_], t.runningActionsByConv[m] = { ...A });
|
|
443
443
|
})
|
|
444
444
|
), s.push(
|
|
445
|
-
e.on("activity", (
|
|
446
|
-
Array.isArray(
|
|
445
|
+
e.on("activity", (h) => {
|
|
446
|
+
Array.isArray(h == null ? void 0 : h.conversations) && (t.conversations = h.conversations);
|
|
447
447
|
})
|
|
448
448
|
);
|
|
449
|
-
async function r(
|
|
449
|
+
async function r(h) {
|
|
450
450
|
try {
|
|
451
|
-
const
|
|
451
|
+
const m = new Promise(
|
|
452
452
|
(w, A) => setTimeout(
|
|
453
453
|
() => A(
|
|
454
454
|
new Error(
|
|
@@ -458,61 +458,61 @@ function it(e) {
|
|
|
458
458
|
15e3
|
|
459
459
|
)
|
|
460
460
|
), _ = await Promise.race([
|
|
461
|
-
e.start(
|
|
462
|
-
|
|
461
|
+
e.start(h),
|
|
462
|
+
m
|
|
463
463
|
]);
|
|
464
464
|
t.config = _.config, t.customer = _.customer, t.conversations = await Promise.race([
|
|
465
465
|
e.listConversations(),
|
|
466
|
-
|
|
466
|
+
m
|
|
467
467
|
]), t.ready = !0;
|
|
468
|
-
} catch (
|
|
469
|
-
console.error("[store] start failed",
|
|
468
|
+
} catch (m) {
|
|
469
|
+
console.error("[store] start failed", m), t.error = (m == null ? void 0 : m.message) || String(m);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
function i() {
|
|
473
|
-
for (const
|
|
473
|
+
for (const h of s)
|
|
474
474
|
try {
|
|
475
|
-
|
|
475
|
+
h();
|
|
476
476
|
} catch {
|
|
477
477
|
}
|
|
478
478
|
e.stop();
|
|
479
479
|
}
|
|
480
|
-
async function n(
|
|
481
|
-
const
|
|
482
|
-
if (!
|
|
480
|
+
async function n(h) {
|
|
481
|
+
const m = ye(h);
|
|
482
|
+
if (!m) return t.customer;
|
|
483
483
|
try {
|
|
484
|
-
const _ = await e.patchCustomer(
|
|
484
|
+
const _ = await e.patchCustomer(m);
|
|
485
485
|
_ && (t.customer = _);
|
|
486
486
|
} catch (_) {
|
|
487
487
|
console.error("[store] applyCustomer failed", _);
|
|
488
488
|
}
|
|
489
489
|
return t.customer;
|
|
490
490
|
}
|
|
491
|
-
async function a(
|
|
492
|
-
const
|
|
493
|
-
return _ === -1 ? t.conversations = [
|
|
491
|
+
async function a(h = {}) {
|
|
492
|
+
const m = await e.createConversation(h), _ = t.conversations.findIndex((w) => w.id === m.id);
|
|
493
|
+
return _ === -1 ? t.conversations = [m, ...t.conversations] : t.conversations[_] = m, m;
|
|
494
494
|
}
|
|
495
495
|
const o = 50;
|
|
496
|
-
async function f(
|
|
497
|
-
const
|
|
498
|
-
if (!(
|
|
499
|
-
y(
|
|
496
|
+
async function f(h) {
|
|
497
|
+
const m = t.paginationByConv[h];
|
|
498
|
+
if (!(m != null && m.loaded || m != null && m.loading)) {
|
|
499
|
+
y(h, { nextCursor: null, loading: !0, loaded: !1 });
|
|
500
500
|
try {
|
|
501
|
-
const _ = await e.listMessages(
|
|
501
|
+
const _ = await e.listMessages(h, {
|
|
502
502
|
limit: o
|
|
503
|
-
}), w = (_ == null ? void 0 : _.messages) ?? [], A = t.messagesByConv[
|
|
503
|
+
}), w = (_ == null ? void 0 : _.messages) ?? [], A = t.messagesByConv[h] || [], C = /* @__PURE__ */ new Set();
|
|
504
504
|
for (const g of w)
|
|
505
505
|
(g == null ? void 0 : g.id) != null && C.add(`id:${String(g.id)}`), g != null && g.client_msg_id && C.add(`c:${g.client_msg_id}`);
|
|
506
506
|
const u = A.filter((g) => !((g == null ? void 0 : g.id) != null && C.has(`id:${String(g.id)}`) || g != null && g.client_msg_id && C.has(`c:${g.client_msg_id}`)));
|
|
507
|
-
t.messagesByConv[
|
|
507
|
+
t.messagesByConv[h] = [...w, ...u].sort(
|
|
508
508
|
te
|
|
509
|
-
), y(
|
|
509
|
+
), y(h, {
|
|
510
510
|
nextCursor: (_ == null ? void 0 : _.next_cursor) ?? null,
|
|
511
511
|
loading: !1,
|
|
512
512
|
loaded: !0
|
|
513
513
|
});
|
|
514
514
|
} catch (_) {
|
|
515
|
-
console.error("[store] openConversation failed", _), y(
|
|
515
|
+
console.error("[store] openConversation failed", _), y(h, {
|
|
516
516
|
nextCursor: null,
|
|
517
517
|
loading: !1,
|
|
518
518
|
loaded: !1
|
|
@@ -520,67 +520,67 @@ function it(e) {
|
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
async function k(
|
|
523
|
+
async function k(h) {
|
|
524
524
|
var A;
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
527
|
-
const w = (A = (t.messagesByConv[
|
|
525
|
+
const m = t.paginationByConv[h];
|
|
526
|
+
if (!m || m.loading || !m.nextCursor) return;
|
|
527
|
+
const w = (A = (t.messagesByConv[h] || []).find((C) => C == null ? void 0 : C.created_at)) == null ? void 0 : A.created_at;
|
|
528
528
|
if (w) {
|
|
529
|
-
y(
|
|
529
|
+
y(h, { ...m, loading: !0 });
|
|
530
530
|
try {
|
|
531
|
-
const C = await e.listMessages(
|
|
531
|
+
const C = await e.listMessages(h, {
|
|
532
532
|
before: w,
|
|
533
533
|
limit: o
|
|
534
|
-
}), u = (C == null ? void 0 : C.messages) ?? [], g = t.messagesByConv[
|
|
534
|
+
}), u = (C == null ? void 0 : C.messages) ?? [], g = t.messagesByConv[h] || [], p = /* @__PURE__ */ new Set();
|
|
535
535
|
for (const O of g)
|
|
536
536
|
(O == null ? void 0 : O.id) != null && p.add(`id:${String(O.id)}`), O != null && O.client_msg_id && p.add(`c:${O.client_msg_id}`);
|
|
537
537
|
const L = u.filter((O) => !((O == null ? void 0 : O.id) != null && p.has(`id:${String(O.id)}`) || O != null && O.client_msg_id && p.has(`c:${O.client_msg_id}`)));
|
|
538
|
-
t.messagesByConv[
|
|
538
|
+
t.messagesByConv[h] = [...L, ...g], y(h, {
|
|
539
539
|
nextCursor: (C == null ? void 0 : C.next_cursor) ?? null,
|
|
540
540
|
loading: !1,
|
|
541
541
|
loaded: !0
|
|
542
542
|
});
|
|
543
543
|
} catch (C) {
|
|
544
|
-
console.error("[store] loadMore failed", C), y(
|
|
544
|
+
console.error("[store] loadMore failed", C), y(h, { ...m, loading: !1 });
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
function y(
|
|
549
|
-
t.paginationByConv = { ...t.paginationByConv, [
|
|
548
|
+
function y(h, m) {
|
|
549
|
+
t.paginationByConv = { ...t.paginationByConv, [h]: m };
|
|
550
550
|
}
|
|
551
|
-
async function T(
|
|
552
|
-
const _ = await e.patchConversation(
|
|
551
|
+
async function T(h, m) {
|
|
552
|
+
const _ = await e.patchConversation(h, m), w = t.conversations.findIndex((A) => A.id === h);
|
|
553
553
|
w !== -1 && (t.conversations[w] = _);
|
|
554
554
|
}
|
|
555
|
-
async function I(
|
|
556
|
-
if (!
|
|
557
|
-
const
|
|
555
|
+
async function I(h) {
|
|
556
|
+
if (!h) return [];
|
|
557
|
+
const m = t.messagesByConv[h] || [];
|
|
558
558
|
let _ = "";
|
|
559
|
-
for (const w of
|
|
559
|
+
for (const w of m)
|
|
560
560
|
w != null && w.created_at && w.created_at > _ && (_ = w.created_at);
|
|
561
561
|
try {
|
|
562
562
|
const w = await e.listMessages(
|
|
563
|
-
|
|
563
|
+
h,
|
|
564
564
|
_ ? { since: _ } : {}
|
|
565
565
|
), A = (w == null ? void 0 : w.messages) || [];
|
|
566
566
|
if (!A.length) return [];
|
|
567
567
|
const C = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
|
|
568
|
-
for (const p of
|
|
568
|
+
for (const p of m)
|
|
569
569
|
(p == null ? void 0 : p.id) != null && C.add(String(p.id)), p != null && p.client_msg_id && u.add(p.client_msg_id);
|
|
570
570
|
const g = [];
|
|
571
571
|
for (const p of A) {
|
|
572
572
|
const L = (p == null ? void 0 : p.id) != null && C.has(String(p.id)) || (p == null ? void 0 : p.client_msg_id) && u.has(p.client_msg_id);
|
|
573
|
-
X(
|
|
573
|
+
X(h, p), L || g.push(p);
|
|
574
574
|
}
|
|
575
575
|
return g;
|
|
576
576
|
} catch (w) {
|
|
577
577
|
return console.error("[store] fetchSinceLast failed", w), [];
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
async function S(
|
|
581
|
-
if (!(!
|
|
580
|
+
async function S(h, m) {
|
|
581
|
+
if (!(!h || m == null))
|
|
582
582
|
try {
|
|
583
|
-
const _ = await e.markConversationRead(
|
|
583
|
+
const _ = await e.markConversationRead(h, m), w = (_ == null ? void 0 : _.last_read_message_id) ?? m, A = t.conversations.findIndex((C) => (C == null ? void 0 : C.id) === h);
|
|
584
584
|
A !== -1 && (t.conversations[A] = {
|
|
585
585
|
...t.conversations[A],
|
|
586
586
|
last_read_message_id: w
|
|
@@ -589,14 +589,14 @@ function it(e) {
|
|
|
589
589
|
console.error("[store] markConversationRead failed", _);
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
async function z(
|
|
592
|
+
async function z(h, m, { attachments: _, metadata: w } = {}) {
|
|
593
593
|
var L;
|
|
594
|
-
const A = (
|
|
595
|
-
if (!
|
|
596
|
-
const u = rt(), g = pe(
|
|
594
|
+
const A = (m || "").trim(), C = Array.isArray(_) && _.length > 0;
|
|
595
|
+
if (!h || !A && !C) return;
|
|
596
|
+
const u = rt(), g = pe(h), p = {
|
|
597
597
|
id: u,
|
|
598
598
|
client_msg_id: u,
|
|
599
|
-
conversation_id:
|
|
599
|
+
conversation_id: h,
|
|
600
600
|
type: "content",
|
|
601
601
|
text_md: A,
|
|
602
602
|
author: {
|
|
@@ -609,9 +609,9 @@ function it(e) {
|
|
|
609
609
|
...C ? { payload: { type: "content", attachments: _ } } : {},
|
|
610
610
|
...w && typeof w == "object" ? { metadata: w } : {}
|
|
611
611
|
};
|
|
612
|
-
X(
|
|
612
|
+
X(h, p);
|
|
613
613
|
try {
|
|
614
|
-
await e.postMessage(
|
|
614
|
+
await e.postMessage(h, {
|
|
615
615
|
client_msg_id: u,
|
|
616
616
|
text_md: A,
|
|
617
617
|
created_at: g,
|
|
@@ -619,32 +619,32 @@ function it(e) {
|
|
|
619
619
|
...w && typeof w == "object" ? { metadata: w } : {}
|
|
620
620
|
});
|
|
621
621
|
} catch (O) {
|
|
622
|
-
console.error("[store] send failed", O), oe(
|
|
622
|
+
console.error("[store] send failed", O), oe(h, u, {
|
|
623
623
|
_failed: !0,
|
|
624
624
|
_pending: !1
|
|
625
625
|
});
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
async function M(
|
|
629
|
-
|
|
628
|
+
async function M(h, m, _) {
|
|
629
|
+
h != null && (t.awaitingCallback[h] = !0);
|
|
630
630
|
try {
|
|
631
|
-
await e.postCallback(
|
|
631
|
+
await e.postCallback(h, m, _);
|
|
632
632
|
} catch (w) {
|
|
633
|
-
console.error("[store] callback failed", w),
|
|
633
|
+
console.error("[store] callback failed", w), h != null && delete t.awaitingCallback[h];
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
const D = /* @__PURE__ */ new Map();
|
|
637
|
-
async function x(
|
|
638
|
-
if (!
|
|
639
|
-
const
|
|
640
|
-
if (
|
|
641
|
-
const _ =
|
|
642
|
-
if (!_ || _ - Date.now() > 6e4) return
|
|
637
|
+
async function x(h) {
|
|
638
|
+
if (!h) return null;
|
|
639
|
+
const m = D.get(h);
|
|
640
|
+
if (m != null && m.url) {
|
|
641
|
+
const _ = m.expires_at ? Date.parse(m.expires_at) : 0;
|
|
642
|
+
if (!_ || _ - Date.now() > 6e4) return m.url;
|
|
643
643
|
}
|
|
644
644
|
try {
|
|
645
|
-
const _ = await e.signAttachment(
|
|
645
|
+
const _ = await e.signAttachment(h);
|
|
646
646
|
if (_ != null && _.signed_url)
|
|
647
|
-
return D.set(
|
|
647
|
+
return D.set(h, {
|
|
648
648
|
url: _.signed_url,
|
|
649
649
|
expires_at: _.expires_at
|
|
650
650
|
}), _.signed_url;
|
|
@@ -653,22 +653,22 @@ function it(e) {
|
|
|
653
653
|
}
|
|
654
654
|
return null;
|
|
655
655
|
}
|
|
656
|
-
async function q(
|
|
657
|
-
const w = t.conversations.find((u) => u.id ===
|
|
656
|
+
async function q(h, { rating: m, comment: _ } = {}) {
|
|
657
|
+
const w = t.conversations.find((u) => u.id === h), C = {
|
|
658
658
|
...(w == null ? void 0 : w.metadata) || {},
|
|
659
659
|
feedback: {
|
|
660
|
-
rating:
|
|
660
|
+
rating: m,
|
|
661
661
|
comment: _ || null,
|
|
662
662
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
|
-
await T(
|
|
665
|
+
await T(h, { metadata: C });
|
|
666
666
|
}
|
|
667
|
-
function J(
|
|
667
|
+
function J(h) {
|
|
668
668
|
var _, w;
|
|
669
|
-
const
|
|
670
|
-
for (let A =
|
|
671
|
-
const C =
|
|
669
|
+
const m = t.messagesByConv[h] || [];
|
|
670
|
+
for (let A = m.length - 1; A >= 0; A--) {
|
|
671
|
+
const C = m[A];
|
|
672
672
|
if (((_ = C == null ? void 0 : C.author) == null ? void 0 : _.type) === "user" || (C == null ? void 0 : C.type) === "action" && ((w = C == null ? void 0 : C.payload) == null ? void 0 : w.state) === "pending")
|
|
673
673
|
return null;
|
|
674
674
|
const u = Array.isArray(C == null ? void 0 : C.callbacks) ? C.callbacks.find((g) => (g == null ? void 0 : g.intent) === "submit_form") : null;
|
|
@@ -685,19 +685,19 @@ function it(e) {
|
|
|
685
685
|
}
|
|
686
686
|
return null;
|
|
687
687
|
}
|
|
688
|
-
function ie(
|
|
689
|
-
const
|
|
690
|
-
if (!
|
|
691
|
-
const _ = Object.keys(
|
|
688
|
+
function ie(h) {
|
|
689
|
+
const m = t.runningActionsByConv[h];
|
|
690
|
+
if (!m) return null;
|
|
691
|
+
const _ = Object.keys(m);
|
|
692
692
|
if (_.length === 0) return null;
|
|
693
693
|
const w = _[0];
|
|
694
|
-
return { id: w, payload: { name:
|
|
694
|
+
return { id: w, payload: { name: m[w] } };
|
|
695
695
|
}
|
|
696
|
-
function ae(
|
|
696
|
+
function ae(h) {
|
|
697
697
|
var _, w, A;
|
|
698
|
-
const
|
|
699
|
-
for (let C =
|
|
700
|
-
const u =
|
|
698
|
+
const m = t.messagesByConv[h] || [];
|
|
699
|
+
for (let C = m.length - 1; C >= 0; C--) {
|
|
700
|
+
const u = m[C];
|
|
701
701
|
if (((_ = u == null ? void 0 : u.author) == null ? void 0 : _.type) === "user") return [];
|
|
702
702
|
if ((u == null ? void 0 : u.type) === "action" && ((w = u == null ? void 0 : u.payload) == null ? void 0 : w.state) === "pending")
|
|
703
703
|
return [];
|
|
@@ -711,57 +711,57 @@ function it(e) {
|
|
|
711
711
|
}
|
|
712
712
|
return [];
|
|
713
713
|
}
|
|
714
|
-
function X(
|
|
714
|
+
function X(h, m) {
|
|
715
715
|
var C;
|
|
716
|
-
const _ = t.messagesByConv[
|
|
716
|
+
const _ = t.messagesByConv[h] || [];
|
|
717
717
|
let w = -1;
|
|
718
|
-
|
|
719
|
-
(u) => (u == null ? void 0 : u.client_msg_id) && u.client_msg_id ===
|
|
720
|
-
)), w === -1 && (
|
|
718
|
+
m != null && m.client_msg_id && (w = _.findIndex(
|
|
719
|
+
(u) => (u == null ? void 0 : u.client_msg_id) && u.client_msg_id === m.client_msg_id
|
|
720
|
+
)), w === -1 && (m == null ? void 0 : m.id) !== void 0 && (m == null ? void 0 : m.id) !== null && (w = _.findIndex((u) => Q(u == null ? void 0 : u.id, m.id)));
|
|
721
721
|
let A;
|
|
722
|
-
w === -1 ? A = [..._,
|
|
722
|
+
w === -1 ? A = [..._, m].sort(te) : (A = _.slice(), A[w] = {
|
|
723
723
|
..._[w],
|
|
724
|
-
...
|
|
724
|
+
...m,
|
|
725
725
|
_pending: !1,
|
|
726
726
|
_failed: !1
|
|
727
|
-
}), t.messagesByConv[
|
|
727
|
+
}), t.messagesByConv[h] = A, (m == null ? void 0 : m.type) === "action" && ((C = m == null ? void 0 : m.payload) != null && C.state) && m.payload.state !== "pending" && (m == null ? void 0 : m.id) != null && t.awaitingCallback[m.id] && delete t.awaitingCallback[m.id];
|
|
728
728
|
}
|
|
729
|
-
function Q(
|
|
730
|
-
return
|
|
729
|
+
function Q(h, m) {
|
|
730
|
+
return h === m ? !0 : h == null || m == null ? !1 : String(h) === String(m);
|
|
731
731
|
}
|
|
732
|
-
function oe(
|
|
733
|
-
const w = t.messagesByConv[
|
|
732
|
+
function oe(h, m, _) {
|
|
733
|
+
const w = t.messagesByConv[h];
|
|
734
734
|
if (!w) return;
|
|
735
|
-
const A = w.findIndex((u) => u.id ===
|
|
735
|
+
const A = w.findIndex((u) => u.id === m);
|
|
736
736
|
if (A === -1) return;
|
|
737
737
|
const C = w.slice();
|
|
738
|
-
C[A] = { ...w[A], ..._ }, t.messagesByConv[
|
|
738
|
+
C[A] = { ...w[A], ..._ }, t.messagesByConv[h] = C;
|
|
739
739
|
}
|
|
740
|
-
function Z(
|
|
741
|
-
const _ = t.conversations.findIndex((A) => A.id ===
|
|
740
|
+
function Z(h, m) {
|
|
741
|
+
const _ = t.conversations.findIndex((A) => A.id === h);
|
|
742
742
|
if (_ === -1) return;
|
|
743
743
|
const w = t.conversations[_];
|
|
744
|
-
if (
|
|
744
|
+
if (m && (!w.last_message_at || m > w.last_message_at)) {
|
|
745
745
|
const A = t.conversations.slice();
|
|
746
|
-
A[_] = { ...w, last_message_at:
|
|
746
|
+
A[_] = { ...w, last_message_at: m }, A.sort(
|
|
747
747
|
(C, u) => (u.last_message_at || "").localeCompare(C.last_message_at || "")
|
|
748
748
|
), t.conversations = A;
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
|
-
function te(
|
|
752
|
-
return (
|
|
751
|
+
function te(h, m) {
|
|
752
|
+
return (h.created_at || "").localeCompare(m.created_at || "");
|
|
753
753
|
}
|
|
754
|
-
function ye(
|
|
755
|
-
if (!
|
|
756
|
-
const
|
|
757
|
-
for (const [w, A] of Object.entries(
|
|
758
|
-
A !== void 0 && (w === "name" || w === "email" || w === "language" ? A != null && String(A).trim() !== "" && (
|
|
759
|
-
return Object.keys(_).length && (
|
|
754
|
+
function ye(h) {
|
|
755
|
+
if (!h || typeof h != "object") return null;
|
|
756
|
+
const m = {}, _ = {};
|
|
757
|
+
for (const [w, A] of Object.entries(h))
|
|
758
|
+
A !== void 0 && (w === "name" || w === "email" || w === "language" ? A != null && String(A).trim() !== "" && (m[w] = A) : (w === "values" || w === "metadata") && A && typeof A == "object" ? Object.assign(_, A) : _[w] = A);
|
|
759
|
+
return Object.keys(_).length && (m.values = _), Object.keys(m).length ? m : null;
|
|
760
760
|
}
|
|
761
|
-
function pe(
|
|
762
|
-
const
|
|
761
|
+
function pe(h) {
|
|
762
|
+
const m = t.messagesByConv[h] || [];
|
|
763
763
|
let _ = "";
|
|
764
|
-
for (const C of
|
|
764
|
+
for (const C of m)
|
|
765
765
|
C != null && C.created_at && C.created_at > _ && (_ = C.created_at);
|
|
766
766
|
const w = (/* @__PURE__ */ new Date()).toISOString();
|
|
767
767
|
return !_ || w > _ ? w : new Date(Date.parse(_) + 1).toISOString();
|
|
@@ -882,7 +882,7 @@ function Ee(e) {
|
|
|
882
882
|
}
|
|
883
883
|
return t.protocol === "https:" || t.protocol === "http:" || t.protocol === "data:" && /^data:image\//i.test(e) ? e : null;
|
|
884
884
|
}
|
|
885
|
-
const ue = "fr",
|
|
885
|
+
const ue = "fr", ht = ["fr", "en"], Be = { fr: "fr-FR", en: "en-US" }, ke = {
|
|
886
886
|
fr: {
|
|
887
887
|
// ── Common ───────────────────────────────────────────────────────
|
|
888
888
|
"common.newConversation": "Nouvelle conversation",
|
|
@@ -1159,7 +1159,7 @@ I reply within seconds.`,
|
|
|
1159
1159
|
function Re(e) {
|
|
1160
1160
|
if (typeof e != "string") return ue;
|
|
1161
1161
|
const t = e.trim().toLowerCase().slice(0, 2);
|
|
1162
|
-
return
|
|
1162
|
+
return ht.includes(t) ? t : ue;
|
|
1163
1163
|
}
|
|
1164
1164
|
function re(e) {
|
|
1165
1165
|
return Be[Re(e)] || Be[ue];
|
|
@@ -1182,7 +1182,7 @@ function Pe(e, t) {
|
|
|
1182
1182
|
function ze(e, t, s) {
|
|
1183
1183
|
return Array.isArray(t) ? t.map((r) => Pe(e, String(r))).join(", ") : typeof t == "boolean" ? s(t ? "common.yes" : "common.no") : Pe(e, String(t));
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1185
|
+
function mt(e, t, s = H()) {
|
|
1186
1186
|
if (!e || !t) return "";
|
|
1187
1187
|
const r = Array.isArray(e.fields) ? e.fields : [], i = [];
|
|
1188
1188
|
for (const n of r) {
|
|
@@ -1306,7 +1306,7 @@ function _t(e) {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
return i;
|
|
1308
1308
|
}
|
|
1309
|
-
function
|
|
1309
|
+
function he(e) {
|
|
1310
1310
|
var s;
|
|
1311
1311
|
const t = (s = e == null ? void 0 : e.author) == null ? void 0 : s.type;
|
|
1312
1312
|
return t === "agent_ia" || t === "agent_human";
|
|
@@ -1477,7 +1477,7 @@ const wt = {
|
|
|
1477
1477
|
// panel or switched threads during the typing dwell.
|
|
1478
1478
|
onMessageRevealed(e, t) {
|
|
1479
1479
|
var i;
|
|
1480
|
-
if (!this.soundEnabled && !this.browserNotifEnabled || !t || !e || !
|
|
1480
|
+
if (!this.soundEnabled && !this.browserNotifEnabled || !t || !e || !he(e)) return;
|
|
1481
1481
|
const s = typeof document < "u" && document.hidden;
|
|
1482
1482
|
this.isOpen && !s && ((i = this.currentConv) == null ? void 0 : i.id) === t || (this.soundEnabled && this.playNotificationSound(), this.browserNotifEnabled && this.showBrowserNotification(t, e));
|
|
1483
1483
|
},
|
|
@@ -1707,7 +1707,7 @@ const wt = {
|
|
|
1707
1707
|
const s = Date.now(), r = { ...this.revealedAt };
|
|
1708
1708
|
for (const n of e) {
|
|
1709
1709
|
if ((n == null ? void 0 : n.id) == null || r[n.id] !== void 0) continue;
|
|
1710
|
-
if (!
|
|
1710
|
+
if (!he(n)) {
|
|
1711
1711
|
r[n.id] = s;
|
|
1712
1712
|
continue;
|
|
1713
1713
|
}
|
|
@@ -1743,7 +1743,7 @@ const wt = {
|
|
|
1743
1743
|
paceLiveMessage(e, t) {
|
|
1744
1744
|
var o;
|
|
1745
1745
|
if (!(e != null && e.id) || this.revealedAt[e.id] !== void 0) return;
|
|
1746
|
-
if (!
|
|
1746
|
+
if (!he(e)) {
|
|
1747
1747
|
this.revealedAt = { ...this.revealedAt, [e.id]: Date.now() };
|
|
1748
1748
|
return;
|
|
1749
1749
|
}
|
|
@@ -2089,7 +2089,7 @@ function Gt(e, t, s, r, i, n) {
|
|
|
2089
2089
|
], 6)
|
|
2090
2090
|
], 6);
|
|
2091
2091
|
}
|
|
2092
|
-
const
|
|
2092
|
+
const me = /* @__PURE__ */ U(Vt, [["render", Gt], ["__scopeId", "data-v-6f7f685d"]]), Yt = {
|
|
2093
2093
|
name: "WmTeamAvatars",
|
|
2094
2094
|
props: {
|
|
2095
2095
|
members: { type: Array, default: () => [] },
|
|
@@ -2145,7 +2145,7 @@ function en(e, t, s, r, i, n) {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
const tn = /* @__PURE__ */ U(Yt, [["render", en], ["__scopeId", "data-v-e49a9063"]]), nn = {
|
|
2147
2147
|
name: "WmHeader",
|
|
2148
|
-
components: { AIAvatar:
|
|
2148
|
+
components: { AIAvatar: me, TeamAvatars: tn },
|
|
2149
2149
|
inject: {
|
|
2150
2150
|
// Translator shared by the Messenger shell. Falls back to a French
|
|
2151
2151
|
// translator when the component is used standalone (no provider).
|
|
@@ -2188,7 +2188,7 @@ const tn = /* @__PURE__ */ U(Yt, [["render", en], ["__scopeId", "data-v-e49a9063
|
|
|
2188
2188
|
}, on = { class: "wm-header__avatar" }, ln = { class: "wm-header__main" }, cn = { class: "wm-header__title" }, dn = {
|
|
2189
2189
|
key: 3,
|
|
2190
2190
|
class: "wm-header__fill"
|
|
2191
|
-
}, un = { class: "wm-header__actions" },
|
|
2191
|
+
}, un = { class: "wm-header__actions" }, hn = ["aria-label", "title"], mn = ["aria-label", "title"];
|
|
2192
2192
|
function fn(e, t, s, r, i, n) {
|
|
2193
2193
|
const a = P("AIAvatar"), o = P("TeamAvatars");
|
|
2194
2194
|
return c(), d("div", sn, [
|
|
@@ -2262,7 +2262,7 @@ function fn(e, t, s, r, i, n) {
|
|
|
2262
2262
|
r: "1.6"
|
|
2263
2263
|
})
|
|
2264
2264
|
], -1)
|
|
2265
|
-
])], 10,
|
|
2265
|
+
])], 10, hn)) : b("", !0),
|
|
2266
2266
|
s.showClose ? (c(), d("button", {
|
|
2267
2267
|
key: 1,
|
|
2268
2268
|
type: "button",
|
|
@@ -2284,7 +2284,7 @@ function fn(e, t, s, r, i, n) {
|
|
|
2284
2284
|
}, [
|
|
2285
2285
|
l("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
2286
2286
|
], -1)
|
|
2287
|
-
])], 8,
|
|
2287
|
+
])], 8, mn)) : b("", !0)
|
|
2288
2288
|
])
|
|
2289
2289
|
]);
|
|
2290
2290
|
}
|
|
@@ -2296,7 +2296,7 @@ const _n = /* @__PURE__ */ U(nn, [["render", fn], ["__scopeId", "data-v-7af4c118
|
|
|
2296
2296
|
link: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
|
|
2297
2297
|
}, gn = {
|
|
2298
2298
|
name: "WmOnboarding",
|
|
2299
|
-
components: { AIAvatar:
|
|
2299
|
+
components: { AIAvatar: me, HumanAvatar: ve },
|
|
2300
2300
|
inject: {
|
|
2301
2301
|
// Translator + resolved-language getter shared by the Messenger
|
|
2302
2302
|
// shell. The language getter feeds `formatTs` (relative date
|
|
@@ -2356,11 +2356,13 @@ const _n = /* @__PURE__ */ U(nn, [["render", fn], ["__scopeId", "data-v-7af4c118
|
|
|
2356
2356
|
methods: {
|
|
2357
2357
|
// Open a conversation seeded with the typed first message. The
|
|
2358
2358
|
// parent (`startConv` + send) handles draft creation and the
|
|
2359
|
-
// screen transition; we
|
|
2359
|
+
// screen transition; we hand it the text plus the input pill's
|
|
2360
|
+
// viewport rect so it can launch the "message flies up into the
|
|
2361
|
+
// chat" animation from exactly where the user was typing.
|
|
2360
2362
|
submitStarter() {
|
|
2361
2363
|
if (!this.canStart) return;
|
|
2362
|
-
const e = this.starterText.trim();
|
|
2363
|
-
this.starterText = "", this.$emit("start", e);
|
|
2364
|
+
const e = this.starterText.trim(), t = this.$refs.starterForm, s = t ? t.getBoundingClientRect() : null, r = s ? { left: s.left, top: s.top, width: s.width, height: s.height } : null;
|
|
2365
|
+
this.starterText = "", this.$emit("start", { text: e, rect: r });
|
|
2364
2366
|
},
|
|
2365
2367
|
iconPath(e) {
|
|
2366
2368
|
return Ne[e] || Ne.link;
|
|
@@ -2613,6 +2615,7 @@ function Qn(e, t, s, r, i, n) {
|
|
|
2613
2615
|
])) : b("", !0),
|
|
2614
2616
|
l("div", Pn, [
|
|
2615
2617
|
l("form", {
|
|
2618
|
+
ref: "starterForm",
|
|
2616
2619
|
class: R(["wm-onb__starter", { "is-active": !!i.starterText.trim() }]),
|
|
2617
2620
|
onSubmit: t[1] || (t[1] = G((...o) => n.submitStarter && n.submitStarter(...o), ["prevent"]))
|
|
2618
2621
|
}, [
|
|
@@ -2696,9 +2699,9 @@ function Qn(e, t, s, r, i, n) {
|
|
|
2696
2699
|
])
|
|
2697
2700
|
]);
|
|
2698
2701
|
}
|
|
2699
|
-
const Zn = /* @__PURE__ */ U(gn, [["render", Qn], ["__scopeId", "data-v-
|
|
2702
|
+
const Zn = /* @__PURE__ */ U(gn, [["render", Qn], ["__scopeId", "data-v-37e69356"]]), es = {
|
|
2700
2703
|
name: "WmHistory",
|
|
2701
|
-
components: { AIAvatar:
|
|
2704
|
+
components: { AIAvatar: me, HumanAvatar: ve },
|
|
2702
2705
|
inject: {
|
|
2703
2706
|
t: { default: () => H() },
|
|
2704
2707
|
wmLocale: { default: () => () => "fr" }
|
|
@@ -2768,10 +2771,10 @@ const Zn = /* @__PURE__ */ U(gn, [["render", Qn], ["__scopeId", "data-v-ca29f614
|
|
|
2768
2771
|
}, ts = { class: "wm-hist" }, ns = { class: "wm-hist__search" }, ss = ["placeholder", "aria-label"], rs = { class: "wm-hist__list" }, is = ["onClick"], as = {
|
|
2769
2772
|
key: 0,
|
|
2770
2773
|
class: "wm-hist__defaultAvatar"
|
|
2771
|
-
}, os = ["aria-label"], ls = { class: "wm-hist__thread-body" }, cs = { class: "wm-hist__thread-title" }, ds = ["innerHTML"], us = { class: "wm-hist__thread-meta" },
|
|
2774
|
+
}, os = ["aria-label"], ls = { class: "wm-hist__thread-body" }, cs = { class: "wm-hist__thread-title" }, ds = ["innerHTML"], us = { class: "wm-hist__thread-meta" }, hs = {
|
|
2772
2775
|
key: 0,
|
|
2773
2776
|
class: "wm-hist__thread-time"
|
|
2774
|
-
},
|
|
2777
|
+
}, ms = {
|
|
2775
2778
|
key: 0,
|
|
2776
2779
|
class: "wm-hist__empty"
|
|
2777
2780
|
};
|
|
@@ -2844,7 +2847,7 @@ function fs(e, t, s, r, i, n) {
|
|
|
2844
2847
|
}, null, 8, ds)
|
|
2845
2848
|
]),
|
|
2846
2849
|
l("span", us, [
|
|
2847
|
-
n.formatTs(a._ts) ? (c(), d("span",
|
|
2850
|
+
n.formatTs(a._ts) ? (c(), d("span", hs, v(n.formatTs(a._ts)), 1)) : b("", !0),
|
|
2848
2851
|
t[3] || (t[3] = l("svg", {
|
|
2849
2852
|
width: "14",
|
|
2850
2853
|
height: "14",
|
|
@@ -2861,7 +2864,7 @@ function fs(e, t, s, r, i, n) {
|
|
|
2861
2864
|
], -1))
|
|
2862
2865
|
])
|
|
2863
2866
|
], 10, is))), 128)),
|
|
2864
|
-
n.filteredThreads.length ? b("", !0) : (c(), d("div",
|
|
2867
|
+
n.filteredThreads.length ? b("", !0) : (c(), d("div", ms, v(i.query ? n.t("onboarding.noResults", { query: i.query }) : n.t("onboarding.noConversations")), 1))
|
|
2865
2868
|
])
|
|
2866
2869
|
]);
|
|
2867
2870
|
}
|
|
@@ -3297,7 +3300,7 @@ const dr = /* @__PURE__ */ U(Xs, [["render", cr], ["__scopeId", "data-v-5f30c914
|
|
|
3297
3300
|
form_response: Us,
|
|
3298
3301
|
info_card: Ys,
|
|
3299
3302
|
ticket: dr
|
|
3300
|
-
},
|
|
3303
|
+
}, hr = {
|
|
3301
3304
|
name: "WmArtifactRenderer",
|
|
3302
3305
|
props: {
|
|
3303
3306
|
// Forme : { kind: string, data: any } (le `data` est validé
|
|
@@ -3312,13 +3315,13 @@ const dr = /* @__PURE__ */ U(Xs, [["render", cr], ["__scopeId", "data-v-5f30c914
|
|
|
3312
3315
|
}
|
|
3313
3316
|
}
|
|
3314
3317
|
};
|
|
3315
|
-
function
|
|
3318
|
+
function mr(e, t, s, r, i, n) {
|
|
3316
3319
|
return n.component ? (c(), B(Te(n.component), {
|
|
3317
3320
|
key: 0,
|
|
3318
3321
|
data: s.artifact.data
|
|
3319
3322
|
}, null, 8, ["data"])) : b("", !0);
|
|
3320
3323
|
}
|
|
3321
|
-
const fr = /* @__PURE__ */ U(
|
|
3324
|
+
const fr = /* @__PURE__ */ U(hr, [["render", mr]]), _r = {
|
|
3322
3325
|
name: "WmAttachmentPreview",
|
|
3323
3326
|
inject: {
|
|
3324
3327
|
signAttachmentFn: { default: null },
|
|
@@ -3499,7 +3502,7 @@ const Pr = {
|
|
|
3499
3502
|
}, Ur = 80, Dr = 200, Nr = {
|
|
3500
3503
|
name: "WmMessageList",
|
|
3501
3504
|
components: {
|
|
3502
|
-
AIAvatar:
|
|
3505
|
+
AIAvatar: me,
|
|
3503
3506
|
HumanAvatar: ve,
|
|
3504
3507
|
Bubble: Rr,
|
|
3505
3508
|
Typing: Br,
|
|
@@ -4326,7 +4329,7 @@ function Ke({ audio: e }) {
|
|
|
4326
4329
|
systemAudio: e ? "include" : "exclude"
|
|
4327
4330
|
};
|
|
4328
4331
|
}
|
|
4329
|
-
function
|
|
4332
|
+
function vo(e) {
|
|
4330
4333
|
return e ? e.startsWith("image/") ? "image" : e.startsWith("video/") ? "video" : "file" : "file";
|
|
4331
4334
|
}
|
|
4332
4335
|
async function ci() {
|
|
@@ -4427,7 +4430,7 @@ async function ui(e = {}) {
|
|
|
4427
4430
|
}
|
|
4428
4431
|
};
|
|
4429
4432
|
}
|
|
4430
|
-
const
|
|
4433
|
+
const hi = [
|
|
4431
4434
|
{
|
|
4432
4435
|
action: "file",
|
|
4433
4436
|
labelKey: "composer.attachFile",
|
|
@@ -4443,7 +4446,7 @@ const mi = [
|
|
|
4443
4446
|
labelKey: "composer.recordScreen",
|
|
4444
4447
|
path: "M23 7l-7 5 7 5V7z M1 5a2 2 0 012-2h12a2 2 0 012 2v14a2 2 0 01-2 2H3a2 2 0 01-2-2V5z"
|
|
4445
4448
|
}
|
|
4446
|
-
],
|
|
4449
|
+
], mi = {
|
|
4447
4450
|
name: "WmComposer",
|
|
4448
4451
|
inject: {
|
|
4449
4452
|
// Translator shared by the Messenger shell; French fallback when
|
|
@@ -4477,7 +4480,7 @@ const mi = [
|
|
|
4477
4480
|
return !this.disabled && !!this.local.trim();
|
|
4478
4481
|
},
|
|
4479
4482
|
attachItems() {
|
|
4480
|
-
return
|
|
4483
|
+
return hi.map((e) => ({
|
|
4481
4484
|
...e,
|
|
4482
4485
|
label: this.t(e.labelKey),
|
|
4483
4486
|
disabled: e.action === "screenshot" && !ge || e.action === "record" && (!ge || !Le)
|
|
@@ -4727,7 +4730,7 @@ function Si(e, t, s, r, i, n) {
|
|
|
4727
4730
|
], 34)
|
|
4728
4731
|
], 6);
|
|
4729
4732
|
}
|
|
4730
|
-
const Ti = /* @__PURE__ */ U(
|
|
4733
|
+
const Ti = /* @__PURE__ */ U(mi, [["render", Si], ["__scopeId", "data-v-bba29b9c"]]), Mi = {
|
|
4731
4734
|
name: "WmInlineCallbacks",
|
|
4732
4735
|
props: {
|
|
4733
4736
|
// Array d'items `{ id?, label, style?, ... }`. Pour les suggestions,
|
|
@@ -4805,7 +4808,7 @@ const Bi = /* @__PURE__ */ new Set([
|
|
|
4805
4808
|
"date"
|
|
4806
4809
|
]), Pi = {
|
|
4807
4810
|
name: "WmFormCard",
|
|
4808
|
-
components: { AIAvatar:
|
|
4811
|
+
components: { AIAvatar: me },
|
|
4809
4812
|
inject: {
|
|
4810
4813
|
// Translator shared by the Messenger shell; French fallback when
|
|
4811
4814
|
// the component is used standalone.
|
|
@@ -5084,7 +5087,7 @@ const aa = /* @__PURE__ */ U(Pi, [["render", ia], ["__scopeId", "data-v-fe65cc56
|
|
|
5084
5087
|
!this.sel || this.busy || this.$emit("submit", { rating: this.sel });
|
|
5085
5088
|
}
|
|
5086
5089
|
}
|
|
5087
|
-
}, la = { class: "wm-fb" }, ca = { class: "wm-fb__title" }, da = { class: "wm-fb__sub" }, ua = { class: "wm-fb__row" },
|
|
5090
|
+
}, la = { class: "wm-fb" }, ca = { class: "wm-fb__title" }, da = { class: "wm-fb__sub" }, ua = { class: "wm-fb__row" }, ha = ["onClick"], ma = { class: "wm-fb__emoji" }, fa = { class: "wm-fb__label" }, _a = ["disabled"], ga = {
|
|
5088
5091
|
key: 1,
|
|
5089
5092
|
class: "wm-fb__done"
|
|
5090
5093
|
}, va = { class: "wm-fb__doneTitle" }, ya = { class: "wm-fb__doneSub" };
|
|
@@ -5118,9 +5121,9 @@ function pa(e, t, s, r, i, n) {
|
|
|
5118
5121
|
class: R(["wm-fb__opt", { "is-selected": i.sel === a.v }]),
|
|
5119
5122
|
onClick: (o) => i.sel = a.v
|
|
5120
5123
|
}, [
|
|
5121
|
-
l("span",
|
|
5124
|
+
l("span", ma, v(a.e), 1),
|
|
5122
5125
|
l("span", fa, v(a.l), 1)
|
|
5123
|
-
], 10,
|
|
5126
|
+
], 10, ha))), 128))
|
|
5124
5127
|
]),
|
|
5125
5128
|
l("button", {
|
|
5126
5129
|
type: "button",
|
|
@@ -5516,6 +5519,11 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
5516
5519
|
// PJ, formulaire, quick-link sans URL). Évite de polluer la liste
|
|
5517
5520
|
// côté serveur avec des fils vides abandonnés.
|
|
5518
5521
|
draftConv: null,
|
|
5522
|
+
// Transient ghost-bubble descriptor for the home→chat launch
|
|
5523
|
+
// animation: { text, rect } captured from the onboarding starter
|
|
5524
|
+
// input. Non-null only while the fly-up animation plays; cleared
|
|
5525
|
+
// on `animationend`. See `onOnboardingStart` / `launchStyle`.
|
|
5526
|
+
launch: null,
|
|
5519
5527
|
// convId → true quand l'utilisateur a cliqué "Rouvrir" sur une conv
|
|
5520
5528
|
// fermée : débloque le composer localement le temps qu'un message la
|
|
5521
5529
|
// réactive côté serveur. Reset au reload (non persisté, volontaire).
|
|
@@ -5594,6 +5602,20 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
5594
5602
|
isEmbedded() {
|
|
5595
5603
|
return this.displayMode === "embedded";
|
|
5596
5604
|
},
|
|
5605
|
+
// Fixed-position box for the launch ghost bubble, matching the home
|
|
5606
|
+
// starter input's viewport rect so the bubble lifts off exactly
|
|
5607
|
+
// where the user was typing. Right-aligned content inside makes it
|
|
5608
|
+
// read as an outgoing message before it flies up.
|
|
5609
|
+
launchStyle() {
|
|
5610
|
+
var t;
|
|
5611
|
+
const e = (t = this.launch) == null ? void 0 : t.rect;
|
|
5612
|
+
return e ? {
|
|
5613
|
+
left: `${e.left}px`,
|
|
5614
|
+
top: `${e.top}px`,
|
|
5615
|
+
width: `${e.width}px`,
|
|
5616
|
+
height: `${e.height}px`
|
|
5617
|
+
} : null;
|
|
5618
|
+
},
|
|
5597
5619
|
// Language set on the authenticated customer. Checked both as a
|
|
5598
5620
|
// top-level column and as a named variable (`values.language`).
|
|
5599
5621
|
// Falls back to the consumer-supplied `context.customer.language`
|
|
@@ -5895,7 +5917,7 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
5895
5917
|
}
|
|
5896
5918
|
const s = this.revealedAt, r = (this.s.messagesByConv[e.id] || []).filter((a) => {
|
|
5897
5919
|
var o, f, k, y, T;
|
|
5898
|
-
return (a == null ? void 0 : a.type) === "action" && ((o = a == null ? void 0 : a.payload) == null ? void 0 : o.state) === "pending" ||
|
|
5920
|
+
return (a == null ? void 0 : a.type) === "action" && ((o = a == null ? void 0 : a.payload) == null ? void 0 : o.state) === "pending" || he(a) && !(s[a.id] > 0) ? !1 : (a == null ? void 0 : a.type) === "action" || (a == null ? void 0 : a.type) === "system" || ((f = a == null ? void 0 : a.payload) == null ? void 0 : f.type) === "system" || Array.isArray((k = a == null ? void 0 : a.payload) == null ? void 0 : k.attachments) && a.payload.attachments.length || (y = a == null ? void 0 : a.metadata) != null && y.artifact || (T = a == null ? void 0 : a.metadata) != null && T.form || Array.isArray(a == null ? void 0 : a.callbacks) && a.callbacks.some((I) => (I == null ? void 0 : I.intent) === "submit_form") ? !0 : typeof (a == null ? void 0 : a.text_md) == "string" && a.text_md.trim().length > 0;
|
|
5899
5921
|
});
|
|
5900
5922
|
return t.length ? [...t, ...r] : r;
|
|
5901
5923
|
},
|
|
@@ -5907,7 +5929,7 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
5907
5929
|
var s, r, i;
|
|
5908
5930
|
const e = this.currentConv;
|
|
5909
5931
|
return e ? Object.keys(((s = this.s) == null ? void 0 : s.streamingByMsgId) || {}).length > 0 ? !0 : this.actionInFlight ? !1 : this.widgetWelcomeMessage && this.welcomeRevealedAt[e.id] === 0 ? !0 : (((i = (r = this.s) == null ? void 0 : r.messagesByConv) == null ? void 0 : i[e.id]) || []).some(
|
|
5910
|
-
(n) =>
|
|
5932
|
+
(n) => he(n) && !(this.revealedAt[n.id] > 0)
|
|
5911
5933
|
) : !1;
|
|
5912
5934
|
},
|
|
5913
5935
|
// Internal: the raw persisted list for the current conversation. We
|
|
@@ -6368,14 +6390,15 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
6368
6390
|
// quick-link without URL), so users who open the chat and walk away
|
|
6369
6391
|
// don't leave empty threads behind.
|
|
6370
6392
|
// Home-screen starter input → open a conversation already seeded
|
|
6371
|
-
// with the user's first message.
|
|
6372
|
-
//
|
|
6373
|
-
//
|
|
6374
|
-
//
|
|
6393
|
+
// with the user's first message. The payload carries the typed
|
|
6394
|
+
// text plus the input pill's viewport rect (for the launch
|
|
6395
|
+
// animation). We spawn a ghost bubble that flies up from that rect
|
|
6396
|
+
// while entering draft mode mounts the conversation view (which
|
|
6397
|
+
// fades in via the `wm-convEnter` transition) ; `onSend` then
|
|
6398
|
+
// materializes the draft server-side and posts the text.
|
|
6375
6399
|
onOnboardingStart(e) {
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
t && this.$nextTick(() => this.onSend(t));
|
|
6400
|
+
const t = ((e == null ? void 0 : e.text) || "").trim(), s = (e == null ? void 0 : e.rect) || null;
|
|
6401
|
+
t && s && (this.launch = { text: t, rect: s }), this.startConv(), t && this.$nextTick(() => this.onSend(t));
|
|
6379
6402
|
},
|
|
6380
6403
|
startConv() {
|
|
6381
6404
|
this.draftConv = {
|
|
@@ -6605,7 +6628,7 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
6605
6628
|
async onFormSubmit({ values: e }) {
|
|
6606
6629
|
const t = this.pendingForm;
|
|
6607
6630
|
if (!(t != null && t.form)) return;
|
|
6608
|
-
const s =
|
|
6631
|
+
const s = mt(t.form, e, this.translator);
|
|
6609
6632
|
if (!s) return;
|
|
6610
6633
|
let r = this.currentConv;
|
|
6611
6634
|
r && (r._draft && (r = await this.ensureRealConv(), !r) || await this.store.send(r.id, s, {
|
|
@@ -6744,13 +6767,13 @@ const Wa = /* @__PURE__ */ U(Pa, [["render", Ka], ["__scopeId", "data-v-6d5f94a8
|
|
|
6744
6767
|
}, oo = { class: "wm-attached__fileMeta" }, lo = { class: "wm-attached__fileName" }, co = {
|
|
6745
6768
|
key: 0,
|
|
6746
6769
|
class: "wm-attached__fileSize"
|
|
6747
|
-
}, uo = ["aria-label", "onClick"],
|
|
6770
|
+
}, uo = ["aria-label", "onClick"], ho = {
|
|
6748
6771
|
key: 3,
|
|
6749
6772
|
class: "wm-ended",
|
|
6750
6773
|
role: "status",
|
|
6751
6774
|
"aria-live": "polite"
|
|
6752
|
-
},
|
|
6753
|
-
function
|
|
6775
|
+
}, mo = { class: "wm-ended__lbl" }, fo = { class: "wm-launch__bubble" };
|
|
6776
|
+
function _o(e, t, s, r, i, n) {
|
|
6754
6777
|
const a = P("Launcher"), o = P("Header"), f = P("History"), k = P("Onboarding"), y = P("MessageList"), T = P("InlineCallbacks"), I = P("FormCard"), S = P("Feedback"), z = P("Composer"), M = P("MoreMenu"), D = P("RenameDialog");
|
|
6755
6778
|
return c(), d("div", {
|
|
6756
6779
|
class: R(["wm-root", `wm-root--${s.displayMode}`]),
|
|
@@ -6783,7 +6806,7 @@ function fo(e, t, s, r, i, n) {
|
|
|
6783
6806
|
class: "wm-loading__close",
|
|
6784
6807
|
"aria-label": n.t("loading.minimize"),
|
|
6785
6808
|
onClick: t[0] || (t[0] = (...x) => n.close && n.close(...x))
|
|
6786
|
-
}, [...t[
|
|
6809
|
+
}, [...t[9] || (t[9] = [
|
|
6787
6810
|
l("svg", {
|
|
6788
6811
|
width: "13",
|
|
6789
6812
|
height: "13",
|
|
@@ -6798,7 +6821,7 @@ function fo(e, t, s, r, i, n) {
|
|
|
6798
6821
|
l("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
6799
6822
|
], -1)
|
|
6800
6823
|
])], 8, Ya)),
|
|
6801
|
-
t[
|
|
6824
|
+
t[10] || (t[10] = l("div", {
|
|
6802
6825
|
class: "wm-loading__spinner",
|
|
6803
6826
|
"aria-hidden": "true"
|
|
6804
6827
|
}, null, -1))
|
|
@@ -6819,7 +6842,7 @@ function fo(e, t, s, r, i, n) {
|
|
|
6819
6842
|
}, null, 8, ["title", "team-members", "response-label", "show-identity", "show-back", "show-close", "more-active", "agent-name", "agent-avatar-url", "onBack", "onMore", "onClose"]),
|
|
6820
6843
|
n.error ? (c(), d("div", Ja, [
|
|
6821
6844
|
l("div", Xa, [
|
|
6822
|
-
t[
|
|
6845
|
+
t[11] || (t[11] = l("div", { class: "wm-state__errIcon" }, [
|
|
6823
6846
|
l("svg", {
|
|
6824
6847
|
width: "14",
|
|
6825
6848
|
height: "14",
|
|
@@ -6896,7 +6919,7 @@ function fo(e, t, s, r, i, n) {
|
|
|
6896
6919
|
}, null, 8, ["items", "onSelect"]))
|
|
6897
6920
|
], 512)) : b("", !0),
|
|
6898
6921
|
n.actionInFlight ? (c(), d("div", no, [
|
|
6899
|
-
t[
|
|
6922
|
+
t[12] || (t[12] = l("span", {
|
|
6900
6923
|
class: "wm-actionWait__spinner",
|
|
6901
6924
|
"aria-hidden": "true"
|
|
6902
6925
|
}, null, -1)),
|
|
@@ -6915,7 +6938,7 @@ function fo(e, t, s, r, i, n) {
|
|
|
6915
6938
|
src: x.previewUrl,
|
|
6916
6939
|
alt: x.name
|
|
6917
6940
|
}, null, 8, io)) : (c(), d("div", ao, [
|
|
6918
|
-
t[
|
|
6941
|
+
t[13] || (t[13] = l("span", { class: "wm-attached__fileIcon" }, [
|
|
6919
6942
|
l("svg", {
|
|
6920
6943
|
width: "16",
|
|
6921
6944
|
height: "16",
|
|
@@ -6943,7 +6966,7 @@ function fo(e, t, s, r, i, n) {
|
|
|
6943
6966
|
class: "wm-attached__remove",
|
|
6944
6967
|
"aria-label": n.t("attachment.remove"),
|
|
6945
6968
|
onClick: (J) => n.removePendingAttachment(q)
|
|
6946
|
-
}, [...t[
|
|
6969
|
+
}, [...t[14] || (t[14] = [
|
|
6947
6970
|
l("svg", {
|
|
6948
6971
|
width: "10",
|
|
6949
6972
|
height: "10",
|
|
@@ -6960,8 +6983,8 @@ function fo(e, t, s, r, i, n) {
|
|
|
6960
6983
|
])], 8, uo)
|
|
6961
6984
|
]))), 128))
|
|
6962
6985
|
])) : b("", !0),
|
|
6963
|
-
n.endedBlockVisible ? (c(), d("div",
|
|
6964
|
-
l("span",
|
|
6986
|
+
n.endedBlockVisible ? (c(), d("div", ho, [
|
|
6987
|
+
l("span", mo, v(n.isClosed ? n.t("composer.conversationClosed") : n.t("composer.conversationEnded")), 1),
|
|
6965
6988
|
l("button", {
|
|
6966
6989
|
type: "button",
|
|
6967
6990
|
class: "wm-ended__btn",
|
|
@@ -7024,12 +7047,21 @@ function fo(e, t, s, r, i, n) {
|
|
|
7024
7047
|
onAction: n.onMoreAction
|
|
7025
7048
|
}, null, 8, ["sound-enabled", "status-url", "help-url", "onSoundToggle", "onAction"])) : b("", !0)
|
|
7026
7049
|
], 64))
|
|
7027
|
-
], 6)) : b("", !0)
|
|
7050
|
+
], 6)) : b("", !0),
|
|
7051
|
+
i.launch ? (c(), d("div", {
|
|
7052
|
+
key: 2,
|
|
7053
|
+
class: "wm-launch",
|
|
7054
|
+
style: F(n.launchStyle),
|
|
7055
|
+
"aria-hidden": "true",
|
|
7056
|
+
onAnimationend: t[8] || (t[8] = (x) => i.launch = null)
|
|
7057
|
+
}, [
|
|
7058
|
+
l("div", fo, v(i.launch.text), 1)
|
|
7059
|
+
], 36)) : b("", !0)
|
|
7028
7060
|
], 6);
|
|
7029
7061
|
}
|
|
7030
|
-
const
|
|
7062
|
+
const yo = /* @__PURE__ */ U($a, [["render", _o], ["__scopeId", "data-v-1a6ad21f"]]), po = "0.6.5";
|
|
7031
7063
|
export {
|
|
7032
|
-
|
|
7064
|
+
me as AIAvatar,
|
|
7033
7065
|
be as AVATAR_COLORS,
|
|
7034
7066
|
Ms as ActionResult,
|
|
7035
7067
|
Us as ArtifactFormResponse,
|
|
@@ -7049,14 +7081,14 @@ export {
|
|
|
7049
7081
|
qt as Launcher,
|
|
7050
7082
|
Le as MEDIA_RECORDER_SUPPORTED,
|
|
7051
7083
|
oi as MessageList,
|
|
7052
|
-
|
|
7084
|
+
yo as Messenger,
|
|
7053
7085
|
Ba as MoreMenu,
|
|
7054
7086
|
Zn as Onboarding,
|
|
7055
7087
|
ge as SCREEN_CAPTURE_SUPPORTED,
|
|
7056
|
-
|
|
7088
|
+
ht as SUPPORTED_LANGUAGES,
|
|
7057
7089
|
tn as TeamAvatars,
|
|
7058
7090
|
Br as Typing,
|
|
7059
|
-
|
|
7091
|
+
po as VERSION,
|
|
7060
7092
|
xe as avatarColor,
|
|
7061
7093
|
Oe as avatarInitials,
|
|
7062
7094
|
ci as captureScreenshotFile,
|
|
@@ -7065,9 +7097,9 @@ export {
|
|
|
7065
7097
|
H as createTranslator,
|
|
7066
7098
|
tt as createTransport,
|
|
7067
7099
|
re as dateLocale,
|
|
7068
|
-
|
|
7100
|
+
yo as default,
|
|
7069
7101
|
Ce as formatTime,
|
|
7070
|
-
|
|
7102
|
+
vo as guessAttachmentKind,
|
|
7071
7103
|
li as pickRecorderMime,
|
|
7072
7104
|
Ve as renderInlineMarkdown,
|
|
7073
7105
|
_t as renderMarkdown,
|