@adatechnology/conversations-ui 0.1.0-rc.6 → 0.1.0-rc.8
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/{chunk-LITPZCWW.js → chunk-73MW5HNT.js} +432 -180
- package/dist/index.d.ts +76 -6
- package/dist/index.js +16 -2
- package/dist/preview/index.d.ts +73 -4
- package/dist/preview/index.js +216 -37
- package/dist/{types-CeixG2Z9.d.ts → types-B5C1DLu1.d.ts} +43 -2
- package/package.json +2 -2
- package/src/ConversationHeader.tsx +18 -0
- package/src/EmojiPicker.tsx +69 -55
- package/src/InteractiveMessage.test.tsx +41 -0
- package/src/InteractiveMessage.tsx +143 -0
- package/src/MessageBubble.tsx +13 -2
- package/src/MessageComposer.tsx +16 -2
- package/src/emojiCatalog.test.ts +35 -0
- package/src/emojiCatalog.ts +189 -0
- package/src/index.ts +9 -3
- package/src/preview/AudioRecorderButton.tsx +117 -0
- package/src/preview/ConversationPreview.tsx +184 -15
- package/src/preview/audioRecorderFormat.test.ts +67 -0
- package/src/preview/conversationPreviewFailures.test.ts +64 -0
- package/src/preview/createPreviewWebhookClient.ts +28 -1
- package/src/preview/index.ts +11 -2
- package/src/preview/mediaTypeOf.test.ts +15 -0
- package/src/types.ts +38 -1
|
@@ -391,6 +391,85 @@ function Lightbox({ imageUrl, caption, onClose, labels }) {
|
|
|
391
391
|
] }) });
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
// src/InteractiveMessage.tsx
|
|
395
|
+
import { useState as useState3 } from "react";
|
|
396
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
397
|
+
var FORMATTING_CLASSES = "[&_strong]:font-bold [&_em]:italic [&_del]:line-through";
|
|
398
|
+
var DEFAULT_INTERACTIVE_MESSAGE_LABELS = {
|
|
399
|
+
openList: "Ver op\xE7\xF5es"
|
|
400
|
+
};
|
|
401
|
+
function collectRows(payload) {
|
|
402
|
+
return (payload.action?.sections ?? []).flatMap((section) => section.rows ?? []);
|
|
403
|
+
}
|
|
404
|
+
function collectButtons(payload) {
|
|
405
|
+
return (payload.action?.buttons ?? []).map((button) => button.reply).filter((reply) => reply !== void 0);
|
|
406
|
+
}
|
|
407
|
+
function InteractiveMessage({ payload, onSelect, labels, className }) {
|
|
408
|
+
const openListLabel = labels?.openList ?? DEFAULT_INTERACTIVE_MESSAGE_LABELS.openList;
|
|
409
|
+
const [isListOpen, setIsListOpen] = useState3(false);
|
|
410
|
+
const buttons = collectButtons(payload);
|
|
411
|
+
const sections = payload.action?.sections ?? [];
|
|
412
|
+
const hasRows = collectRows(payload).length > 0;
|
|
413
|
+
const isInteractable = onSelect !== void 0;
|
|
414
|
+
return /* @__PURE__ */ jsxs5("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
415
|
+
payload.header?.text ? /* @__PURE__ */ jsx7("p", { className: cn("text-sm font-semibold text-gray-900 dark:text-gray-100", FORMATTING_CLASSES), children: parseWhatsAppFormatting(payload.header.text) }) : null,
|
|
416
|
+
payload.body?.text ? /* @__PURE__ */ jsx7(
|
|
417
|
+
"p",
|
|
418
|
+
{
|
|
419
|
+
className: cn(
|
|
420
|
+
"whitespace-pre-wrap break-words text-sm text-gray-900 dark:text-gray-100",
|
|
421
|
+
FORMATTING_CLASSES
|
|
422
|
+
),
|
|
423
|
+
children: parseWhatsAppFormatting(payload.body.text)
|
|
424
|
+
}
|
|
425
|
+
) : null,
|
|
426
|
+
payload.footer?.text ? /* @__PURE__ */ jsx7("p", { className: cn("text-xs text-gray-500 dark:text-gray-400", FORMATTING_CLASSES), children: parseWhatsAppFormatting(payload.footer.text) }) : null,
|
|
427
|
+
buttons.length > 0 ? /* @__PURE__ */ jsx7("div", { className: "mt-1 flex flex-col gap-1 border-t border-gray-200 pt-1 dark:border-gray-700", children: buttons.map((button) => /* @__PURE__ */ jsx7(
|
|
428
|
+
"button",
|
|
429
|
+
{
|
|
430
|
+
type: "button",
|
|
431
|
+
disabled: !isInteractable,
|
|
432
|
+
onClick: () => onSelect?.({ kind: "button", option: button }),
|
|
433
|
+
className: "rounded-md px-3 py-1.5 text-sm font-medium text-teal-700 transition-colors enabled:hover:bg-teal-50 disabled:cursor-default dark:text-teal-300 dark:enabled:hover:bg-teal-900/30",
|
|
434
|
+
children: button.title
|
|
435
|
+
},
|
|
436
|
+
button.id
|
|
437
|
+
)) }) : null,
|
|
438
|
+
hasRows ? /* @__PURE__ */ jsxs5("div", { className: "mt-1 border-t border-gray-200 pt-1 dark:border-gray-700", children: [
|
|
439
|
+
/* @__PURE__ */ jsxs5(
|
|
440
|
+
"button",
|
|
441
|
+
{
|
|
442
|
+
type: "button",
|
|
443
|
+
onClick: () => setIsListOpen((open) => !open),
|
|
444
|
+
"aria-expanded": isListOpen,
|
|
445
|
+
className: "w-full rounded-md px-3 py-1.5 text-sm font-medium text-teal-700 transition-colors hover:bg-teal-50 dark:text-teal-300 dark:hover:bg-teal-900/30",
|
|
446
|
+
children: [
|
|
447
|
+
"\u2630 ",
|
|
448
|
+
payload.action?.button ?? openListLabel
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
),
|
|
452
|
+
isListOpen ? /* @__PURE__ */ jsx7("div", { className: "mt-1 flex flex-col gap-1", children: sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs5("div", { className: "flex flex-col", children: [
|
|
453
|
+
section.title ? /* @__PURE__ */ jsx7("p", { className: "px-3 py-1 text-xs font-semibold uppercase text-gray-500 dark:text-gray-400", children: section.title }) : null,
|
|
454
|
+
(section.rows ?? []).map((row) => /* @__PURE__ */ jsxs5(
|
|
455
|
+
"button",
|
|
456
|
+
{
|
|
457
|
+
type: "button",
|
|
458
|
+
disabled: !isInteractable,
|
|
459
|
+
onClick: () => onSelect?.({ kind: "list", option: row }),
|
|
460
|
+
className: "rounded-md px-3 py-1.5 text-left text-sm text-gray-900 transition-colors enabled:hover:bg-gray-100 disabled:cursor-default dark:text-gray-100 dark:enabled:hover:bg-gray-700",
|
|
461
|
+
children: [
|
|
462
|
+
/* @__PURE__ */ jsx7("span", { className: "block", children: row.title }),
|
|
463
|
+
row.description ? /* @__PURE__ */ jsx7("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: row.description }) : null
|
|
464
|
+
]
|
|
465
|
+
},
|
|
466
|
+
row.id
|
|
467
|
+
))
|
|
468
|
+
] }, section.title ?? sectionIndex)) }) : null
|
|
469
|
+
] }) : null
|
|
470
|
+
] });
|
|
471
|
+
}
|
|
472
|
+
|
|
394
473
|
// src/lib/createMediaUrlResolver.ts
|
|
395
474
|
function createMediaUrlResolver(api) {
|
|
396
475
|
return async (message) => {
|
|
@@ -405,23 +484,23 @@ function createMediaUrlResolver(api) {
|
|
|
405
484
|
|
|
406
485
|
// src/providers/ConversationsProvider.tsx
|
|
407
486
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
408
|
-
import { jsx as
|
|
487
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
409
488
|
var ConversationsContext = createContext2(null);
|
|
410
489
|
function ConversationsProvider({
|
|
411
490
|
api,
|
|
412
491
|
sse,
|
|
413
492
|
children
|
|
414
493
|
}) {
|
|
415
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */ jsx8(ConversationsContext.Provider, { value: { api, sse }, children });
|
|
416
495
|
}
|
|
417
496
|
function useConversations() {
|
|
418
497
|
return useContext2(ConversationsContext);
|
|
419
498
|
}
|
|
420
499
|
|
|
421
500
|
// src/MessageBubble.tsx
|
|
422
|
-
import { useMemo, useState as
|
|
501
|
+
import { useMemo, useState as useState4 } from "react";
|
|
423
502
|
import { Check } from "lucide-react";
|
|
424
|
-
import { Fragment, jsx as
|
|
503
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
425
504
|
var BUBBLE_COLOR = {
|
|
426
505
|
agent: "bg-[#d9fdd3] dark:bg-[#005c4b]",
|
|
427
506
|
bot: "bg-[#d7f0ec] dark:bg-[#0a3d3a]",
|
|
@@ -437,10 +516,11 @@ function MessageBubble({
|
|
|
437
516
|
isSelected = false,
|
|
438
517
|
onToggleSelect,
|
|
439
518
|
onResolveMediaUrl,
|
|
519
|
+
onInteractiveSelect,
|
|
440
520
|
className
|
|
441
521
|
}) {
|
|
442
522
|
const { bubble, selection } = useConversationLocales();
|
|
443
|
-
const [lightboxSrc, setLightboxSrc] =
|
|
523
|
+
const [lightboxSrc, setLightboxSrc] = useState4(null);
|
|
444
524
|
const context = useConversations();
|
|
445
525
|
const resolveMediaUrl = useMemo(
|
|
446
526
|
() => onResolveMediaUrl ?? (context?.api ? createMediaUrlResolver(context.api) : void 0),
|
|
@@ -450,10 +530,11 @@ function MessageBubble({
|
|
|
450
530
|
const hasError = message.status === "failed";
|
|
451
531
|
const isMedia = MEDIA_TYPES.has(message.type);
|
|
452
532
|
const isTemplate = message.type === "template";
|
|
533
|
+
const isInteractive = message.type === "interactive";
|
|
453
534
|
const displayName = message.sender === "agent" && senderName ? senderName : bubble[message.sender] ?? message.sender;
|
|
454
535
|
const tooltipText = message.status === "read" && message.readAt ? `${bubble.readAt}${formatDateTime(message.readAt)}` : message.status === "failed" ? bubble.windowExpired : void 0;
|
|
455
536
|
const tailCornerClass = isFirstInGroup ? isMine ? "rounded-tr-md" : "rounded-tl-md" : "";
|
|
456
|
-
const checkbox = /* @__PURE__ */
|
|
537
|
+
const checkbox = /* @__PURE__ */ jsx9(
|
|
457
538
|
"button",
|
|
458
539
|
{
|
|
459
540
|
onClick: (e) => {
|
|
@@ -466,10 +547,10 @@ function MessageBubble({
|
|
|
466
547
|
${isSelected ? "bg-teal-600 border-teal-600" : "bg-white/80 dark:bg-black/40 border-black/20 dark:border-white/30"}
|
|
467
548
|
${isSelecting ? "opacity-100" : "opacity-0 group-hover:opacity-100"}
|
|
468
549
|
`,
|
|
469
|
-
children: isSelected && /* @__PURE__ */
|
|
550
|
+
children: isSelected && /* @__PURE__ */ jsx9(Check, { size: 12, className: "text-white", strokeWidth: 3 })
|
|
470
551
|
}
|
|
471
552
|
);
|
|
472
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ jsxs6(
|
|
473
554
|
"div",
|
|
474
555
|
{
|
|
475
556
|
className: cn(
|
|
@@ -480,7 +561,7 @@ function MessageBubble({
|
|
|
480
561
|
),
|
|
481
562
|
children: [
|
|
482
563
|
isMine && checkbox,
|
|
483
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ jsxs6(
|
|
484
565
|
"div",
|
|
485
566
|
{
|
|
486
567
|
onClick: isSelecting ? onToggleSelect : void 0,
|
|
@@ -493,121 +574,286 @@ function MessageBubble({
|
|
|
493
574
|
relative
|
|
494
575
|
`,
|
|
495
576
|
children: [
|
|
496
|
-
isMine && isFirstInGroup && (message.sender === "bot" || message.sender === "agent" && senderName) && /* @__PURE__ */
|
|
497
|
-
message.moderation?.isOffensive && /* @__PURE__ */
|
|
577
|
+
isMine && isFirstInGroup && (message.sender === "bot" || message.sender === "agent" && senderName) && /* @__PURE__ */ jsx9("div", { className: "text-xs font-semibold mb-0.5 text-teal-700 dark:text-teal-400", children: displayName }),
|
|
578
|
+
message.moderation?.isOffensive && /* @__PURE__ */ jsxs6(
|
|
498
579
|
"div",
|
|
499
580
|
{
|
|
500
581
|
className: "mb-1 inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",
|
|
501
582
|
title: message.moderation.terms.length > 0 ? message.moderation.terms.join(", ") : void 0,
|
|
502
583
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": true, children: "\u26A0\uFE0F" }),
|
|
585
|
+
/* @__PURE__ */ jsx9("span", { children: bubble.moderationFlagged })
|
|
505
586
|
]
|
|
506
587
|
}
|
|
507
588
|
),
|
|
508
|
-
isMedia ? /* @__PURE__ */
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
589
|
+
isMedia ? /* @__PURE__ */ jsx9(MediaRenderer, { message, onLightbox: setLightboxSrc, onResolveUrl: resolveMediaUrl }) : isInteractive && message.payload ? (
|
|
590
|
+
// O texto da mensagem interativa mora dentro do payload (`body.text`), e `content` guarda
|
|
591
|
+
// só uma cópia achatada para busca — renderizar `content` aqui duplicaria o corpo.
|
|
592
|
+
/* @__PURE__ */ jsx9(InteractiveMessage, { payload: message.payload, onSelect: onInteractiveSelect })
|
|
593
|
+
) : /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
594
|
+
isTemplate && /* @__PURE__ */ jsxs6("p", { className: "text-xs text-gray-500 dark:text-gray-400 flex items-center gap-1 mb-0.5", children: [
|
|
595
|
+
/* @__PURE__ */ jsx9("span", { children: "\u{1F4E8}" }),
|
|
596
|
+
/* @__PURE__ */ jsxs6("span", { className: "font-medium", children: [
|
|
512
597
|
bubble.templateLabel,
|
|
513
598
|
message.templateName ? ` \u2014 ${message.templateName}` : ""
|
|
514
599
|
] })
|
|
515
600
|
] }),
|
|
516
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ jsx9("div", { className: "text-sm text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words leading-[19px]", children: parseWhatsAppFormatting(message.content ?? "") })
|
|
517
602
|
] }),
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
isMine && message.status && /* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-end gap-1 mt-0.5 select-none", children: [
|
|
604
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs text-black/40 dark:text-white/40 font-medium", children: formatTimestamp(message.timestamp) }),
|
|
605
|
+
isMine && message.status && /* @__PURE__ */ jsx9(StatusTicks, { status: message.status, title: tooltipText })
|
|
521
606
|
] })
|
|
522
607
|
]
|
|
523
608
|
}
|
|
524
609
|
),
|
|
525
610
|
!isMine && checkbox,
|
|
526
|
-
lightboxSrc && /* @__PURE__ */
|
|
611
|
+
lightboxSrc && /* @__PURE__ */ jsx9(Lightbox, { imageUrl: lightboxSrc, onClose: () => setLightboxSrc(null) })
|
|
527
612
|
]
|
|
528
613
|
}
|
|
529
614
|
);
|
|
530
615
|
}
|
|
531
616
|
|
|
532
617
|
// src/Wallpaper.tsx
|
|
533
|
-
import { jsx as
|
|
618
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
534
619
|
function ConversationWallpaper({ children, className }) {
|
|
535
|
-
return /* @__PURE__ */
|
|
620
|
+
return /* @__PURE__ */ jsx10("div", { className: cn("cv-wallpaper", className), children });
|
|
536
621
|
}
|
|
537
622
|
|
|
538
|
-
// src/
|
|
539
|
-
import { useState as useState4, useCallback } from "react";
|
|
540
|
-
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
623
|
+
// src/emojiCatalog.ts
|
|
541
624
|
var EMOJI_CATEGORIES = [
|
|
542
625
|
{
|
|
543
626
|
name: "Smileys",
|
|
544
|
-
|
|
627
|
+
entries: [
|
|
628
|
+
{ emoji: "\u{1F600}", keywords: ["sorriso", "feliz", "alegre"] },
|
|
629
|
+
{ emoji: "\u{1F603}", keywords: ["sorriso", "feliz", "animado"] },
|
|
630
|
+
{ emoji: "\u{1F604}", keywords: ["sorriso", "feliz", "risada"] },
|
|
631
|
+
{ emoji: "\u{1F601}", keywords: ["sorriso", "dentes", "feliz"] },
|
|
632
|
+
{ emoji: "\u{1F605}", keywords: ["alivio", "al\xEDvio", "suor", "nervoso"] },
|
|
633
|
+
{ emoji: "\u{1F602}", keywords: ["risada", "chorando", "engracado", "engra\xE7ado"] },
|
|
634
|
+
{ emoji: "\u{1F923}", keywords: ["risada", "rolando", "engracado", "engra\xE7ado"] },
|
|
635
|
+
{ emoji: "\u{1F60A}", keywords: ["sorriso", "timido", "t\xEDmido", "feliz"] },
|
|
636
|
+
{ emoji: "\u{1F607}", keywords: ["anjo", "inocente", "santo"] },
|
|
637
|
+
{ emoji: "\u{1F642}", keywords: ["sorriso", "leve", "ok"] },
|
|
638
|
+
{ emoji: "\u{1F609}", keywords: ["piscada", "piscar", "flerte"] },
|
|
639
|
+
{ emoji: "\u{1F60C}", keywords: ["aliviado", "calmo", "tranquilo"] },
|
|
640
|
+
{ emoji: "\u{1F60D}", keywords: ["amor", "apaixonado", "coracao", "cora\xE7\xE3o", "olhos"] },
|
|
641
|
+
{ emoji: "\u{1F970}", keywords: ["amor", "apaixonado", "carinho"] },
|
|
642
|
+
{ emoji: "\u{1F618}", keywords: ["beijo", "amor", "carinho"] },
|
|
643
|
+
{ emoji: "\u{1F60B}", keywords: ["gostoso", "delicia", "del\xEDcia", "lingua", "l\xEDngua"] },
|
|
644
|
+
{ emoji: "\u{1F61C}", keywords: ["lingua", "l\xEDngua", "brincadeira", "piscada"] },
|
|
645
|
+
{ emoji: "\u{1F92A}", keywords: ["maluco", "doido", "brincadeira"] },
|
|
646
|
+
{ emoji: "\u{1F914}", keywords: ["pensando", "duvida", "d\xFAvida", "hmm"] },
|
|
647
|
+
{ emoji: "\u{1F917}", keywords: ["abraco", "abra\xE7o", "carinho"] },
|
|
648
|
+
{ emoji: "\u{1F610}", keywords: ["neutro", "serio", "s\xE9rio", "indiferente"] },
|
|
649
|
+
{ emoji: "\u{1F634}", keywords: ["dormindo", "sono", "cansado"] },
|
|
650
|
+
{ emoji: "\u{1F62D}", keywords: ["chorando", "triste", "lagrima", "l\xE1grima"] },
|
|
651
|
+
{ emoji: "\u{1F622}", keywords: ["triste", "chorando", "lagrima", "l\xE1grima"] },
|
|
652
|
+
{ emoji: "\u{1F621}", keywords: ["raiva", "bravo", "irritado"] },
|
|
653
|
+
{ emoji: "\u{1F631}", keywords: ["susto", "medo", "assustado"] },
|
|
654
|
+
{ emoji: "\u{1F92F}", keywords: ["explodindo", "chocado", "surpresa"] },
|
|
655
|
+
{ emoji: "\u{1F60E}", keywords: ["oculos", "\xF3culos", "legal", "estiloso"] },
|
|
656
|
+
{ emoji: "\u{1F973}", keywords: ["festa", "comemorar", "aniversario", "anivers\xE1rio"] },
|
|
657
|
+
{ emoji: "\u{1F637}", keywords: ["mascara", "m\xE1scara", "doente", "saude", "sa\xFAde"] }
|
|
658
|
+
]
|
|
545
659
|
},
|
|
546
660
|
{
|
|
547
|
-
name: "
|
|
548
|
-
|
|
661
|
+
name: "Gestos",
|
|
662
|
+
entries: [
|
|
663
|
+
{ emoji: "\u{1F44D}", keywords: ["joia", "j\xF3ia", "polegar", "ok", "positivo", "curtir"] },
|
|
664
|
+
{ emoji: "\u{1F44E}", keywords: ["polegar", "negativo", "ruim", "nao", "n\xE3o"] },
|
|
665
|
+
{ emoji: "\u{1F44C}", keywords: ["ok", "certo", "perfeito"] },
|
|
666
|
+
{ emoji: "\u270C\uFE0F", keywords: ["paz", "vitoria", "vit\xF3ria", "dois"] },
|
|
667
|
+
{ emoji: "\u{1F91E}", keywords: ["sorte", "dedos", "cruzados", "torcendo"] },
|
|
668
|
+
{ emoji: "\u{1F919}", keywords: ["chama", "ligar", "shaka"] },
|
|
669
|
+
{ emoji: "\u{1F44B}", keywords: ["tchau", "ola", "ol\xE1", "aceno", "oi"] },
|
|
670
|
+
{ emoji: "\u270B", keywords: ["mao", "m\xE3o", "parar", "pare"] },
|
|
671
|
+
{ emoji: "\u{1F44F}", keywords: ["palmas", "aplauso", "parabens", "parab\xE9ns"] },
|
|
672
|
+
{ emoji: "\u{1F64C}", keywords: ["comemorar", "maos", "m\xE3os", "sucesso"] },
|
|
673
|
+
{ emoji: "\u{1F91D}", keywords: ["acordo", "aperto", "mao", "m\xE3o", "negocio", "neg\xF3cio", "parceria"] },
|
|
674
|
+
{ emoji: "\u{1F64F}", keywords: ["obrigado", "reza", "oracao", "ora\xE7\xE3o", "por favor"] },
|
|
675
|
+
{ emoji: "\u270D\uFE0F", keywords: ["escrever", "assinar", "assinatura"] },
|
|
676
|
+
{ emoji: "\u{1F4AA}", keywords: ["forca", "for\xE7a", "musculo", "m\xFAsculo", "braco", "bra\xE7o"] },
|
|
677
|
+
{ emoji: "\u{1F447}", keywords: ["abaixo", "baixo", "apontar", "seta"] },
|
|
678
|
+
{ emoji: "\u{1F449}", keywords: ["direita", "apontar", "seta"] },
|
|
679
|
+
{ emoji: "\u261D\uFE0F", keywords: ["acima", "cima", "apontar", "atencao", "aten\xE7\xE3o"] }
|
|
680
|
+
]
|
|
549
681
|
},
|
|
550
682
|
{
|
|
551
|
-
name: "
|
|
552
|
-
|
|
683
|
+
name: "Cora\xE7\xF5es",
|
|
684
|
+
entries: [
|
|
685
|
+
{ emoji: "\u2764\uFE0F", keywords: ["coracao", "cora\xE7\xE3o", "amor", "vermelho"] },
|
|
686
|
+
{ emoji: "\u{1F9E1}", keywords: ["coracao", "cora\xE7\xE3o", "laranja"] },
|
|
687
|
+
{ emoji: "\u{1F49B}", keywords: ["coracao", "cora\xE7\xE3o", "amarelo"] },
|
|
688
|
+
{ emoji: "\u{1F49A}", keywords: ["coracao", "cora\xE7\xE3o", "verde"] },
|
|
689
|
+
{ emoji: "\u{1F499}", keywords: ["coracao", "cora\xE7\xE3o", "azul"] },
|
|
690
|
+
{ emoji: "\u{1F49C}", keywords: ["coracao", "cora\xE7\xE3o", "roxo"] },
|
|
691
|
+
{ emoji: "\u{1F5A4}", keywords: ["coracao", "cora\xE7\xE3o", "preto"] },
|
|
692
|
+
{ emoji: "\u{1F90D}", keywords: ["coracao", "cora\xE7\xE3o", "branco"] },
|
|
693
|
+
{ emoji: "\u{1F494}", keywords: ["coracao", "cora\xE7\xE3o", "partido", "triste"] },
|
|
694
|
+
{ emoji: "\u{1F495}", keywords: ["coracao", "cora\xE7\xE3o", "amor", "casal"] },
|
|
695
|
+
{ emoji: "\u{1F496}", keywords: ["coracao", "cora\xE7\xE3o", "brilho", "amor"] },
|
|
696
|
+
{ emoji: "\u{1F49D}", keywords: ["coracao", "cora\xE7\xE3o", "presente", "laco", "la\xE7o"] }
|
|
697
|
+
]
|
|
553
698
|
},
|
|
554
699
|
{
|
|
555
|
-
name: "
|
|
556
|
-
|
|
700
|
+
name: "Neg\xF3cios",
|
|
701
|
+
entries: [
|
|
702
|
+
{ emoji: "\u{1F3E0}", keywords: ["casa", "imovel", "im\xF3vel", "residencia", "resid\xEAncia", "moradia"] },
|
|
703
|
+
{ emoji: "\u{1F3E1}", keywords: ["casa", "imovel", "im\xF3vel", "jardim", "moradia"] },
|
|
704
|
+
{ emoji: "\u{1F3E2}", keywords: ["predio", "pr\xE9dio", "empresa", "escritorio", "escrit\xF3rio"] },
|
|
705
|
+
{ emoji: "\u{1F3E6}", keywords: ["banco", "financiamento", "agencia", "ag\xEAncia"] },
|
|
706
|
+
{ emoji: "\u{1F511}", keywords: ["chave", "casa", "entrega", "imovel", "im\xF3vel"] },
|
|
707
|
+
{ emoji: "\u{1F4C4}", keywords: ["documento", "papel", "contrato", "arquivo"] },
|
|
708
|
+
{ emoji: "\u{1F4CB}", keywords: ["prancheta", "lista", "documento", "checklist"] },
|
|
709
|
+
{ emoji: "\u{1F4DD}", keywords: ["anotar", "escrever", "nota", "formulario", "formul\xE1rio"] },
|
|
710
|
+
{ emoji: "\u2705", keywords: ["ok", "certo", "aprovado", "concluido", "conclu\xEDdo", "check"] },
|
|
711
|
+
{ emoji: "\u274C", keywords: ["errado", "negado", "recusado", "cancelar"] },
|
|
712
|
+
{ emoji: "\u26A0\uFE0F", keywords: ["atencao", "aten\xE7\xE3o", "alerta", "cuidado"] },
|
|
713
|
+
{ emoji: "\u{1F4B0}", keywords: ["dinheiro", "valor", "saco", "grana", "pagamento"] },
|
|
714
|
+
{ emoji: "\u{1F4B5}", keywords: ["dinheiro", "nota", "valor", "pagamento"] },
|
|
715
|
+
{ emoji: "\u{1F4B3}", keywords: ["cartao", "cart\xE3o", "credito", "cr\xE9dito", "pagamento"] },
|
|
716
|
+
{ emoji: "\u{1F9FE}", keywords: ["recibo", "nota", "fiscal", "comprovante"] },
|
|
717
|
+
{ emoji: "\u{1F4CA}", keywords: ["grafico", "gr\xE1fico", "relatorio", "relat\xF3rio", "dados"] },
|
|
718
|
+
{ emoji: "\u{1F4C8}", keywords: ["grafico", "gr\xE1fico", "subindo", "crescimento", "alta"] },
|
|
719
|
+
{ emoji: "\u{1F4C9}", keywords: ["grafico", "gr\xE1fico", "caindo", "queda", "baixa"] },
|
|
720
|
+
{ emoji: "\u{1F5D3}\uFE0F", keywords: ["calendario", "calend\xE1rio", "data", "agenda", "prazo"] },
|
|
721
|
+
{ emoji: "\u23F0", keywords: ["relogio", "rel\xF3gio", "hora", "prazo", "alarme"] },
|
|
722
|
+
{ emoji: "\u{1F4DE}", keywords: ["telefone", "ligar", "contato", "chamada"] },
|
|
723
|
+
{ emoji: "\u{1F4F1}", keywords: ["celular", "telefone", "whatsapp", "contato"] },
|
|
724
|
+
{ emoji: "\u{1F4E7}", keywords: ["email", "e-mail", "mensagem", "contato"] },
|
|
725
|
+
{ emoji: "\u{1F4CE}", keywords: ["anexo", "clipe", "arquivo"] },
|
|
726
|
+
{ emoji: "\u{1F50D}", keywords: ["buscar", "procurar", "lupa", "pesquisa", "consulta"] },
|
|
727
|
+
{ emoji: "\u{1F916}", keywords: ["robo", "rob\xF4", "bot", "assistente", "automatico", "autom\xE1tico"] },
|
|
728
|
+
{ emoji: "\u{1F4AC}", keywords: ["mensagem", "conversa", "balao", "bal\xE3o", "chat"] }
|
|
729
|
+
]
|
|
557
730
|
},
|
|
558
731
|
{
|
|
559
|
-
name: "
|
|
560
|
-
|
|
732
|
+
name: "Objetos",
|
|
733
|
+
entries: [
|
|
734
|
+
{ emoji: "\u{1F381}", keywords: ["presente", "brinde", "surpresa"] },
|
|
735
|
+
{ emoji: "\u{1F389}", keywords: ["festa", "comemorar", "parabens", "parab\xE9ns"] },
|
|
736
|
+
{ emoji: "\u{1F38A}", keywords: ["festa", "confete", "comemorar"] },
|
|
737
|
+
{ emoji: "\u{1F382}", keywords: ["bolo", "aniversario", "anivers\xE1rio", "festa"] },
|
|
738
|
+
{ emoji: "\u{1F4A1}", keywords: ["ideia", "ide\xEDa", "lampada", "l\xE2mpada", "dica"] },
|
|
739
|
+
{ emoji: "\u{1F514}", keywords: ["sino", "aviso", "notificacao", "notifica\xE7\xE3o", "lembrete"] },
|
|
740
|
+
{ emoji: "\u2B50", keywords: ["estrela", "favorito", "avaliacao", "avalia\xE7\xE3o"] },
|
|
741
|
+
{ emoji: "\u{1F525}", keywords: ["fogo", "quente", "destaque", "top"] },
|
|
742
|
+
{ emoji: "\u{1F680}", keywords: ["foguete", "rapido", "r\xE1pido", "lancamento", "lan\xE7amento"] },
|
|
743
|
+
{ emoji: "\u{1F4BB}", keywords: ["computador", "notebook", "trabalho"] },
|
|
744
|
+
{ emoji: "\u{1F4F7}", keywords: ["foto", "camera", "c\xE2mera", "imagem"] },
|
|
745
|
+
{ emoji: "\u{1F697}", keywords: ["carro", "veiculo", "ve\xEDculo", "automovel", "autom\xF3vel"] },
|
|
746
|
+
{ emoji: "\u2708\uFE0F", keywords: ["aviao", "avi\xE3o", "viagem", "voo"] }
|
|
747
|
+
]
|
|
561
748
|
},
|
|
562
749
|
{
|
|
563
|
-
name: "
|
|
564
|
-
|
|
750
|
+
name: "Comida",
|
|
751
|
+
entries: [
|
|
752
|
+
{ emoji: "\u{1F354}", keywords: ["hamburguer", "hamb\xFArguer", "lanche", "comida"] },
|
|
753
|
+
{ emoji: "\u{1F355}", keywords: ["pizza", "comida", "lanche"] },
|
|
754
|
+
{ emoji: "\u{1F35F}", keywords: ["batata", "frita", "lanche"] },
|
|
755
|
+
{ emoji: "\u{1F37F}", keywords: ["pipoca", "cinema", "filme"] },
|
|
756
|
+
{ emoji: "\u{1F35E}", keywords: ["pao", "p\xE3o", "padaria"] },
|
|
757
|
+
{ emoji: "\u{1F9C0}", keywords: ["queijo", "comida"] },
|
|
758
|
+
{ emoji: "\u{1F957}", keywords: ["salada", "saudavel", "saud\xE1vel", "comida"] },
|
|
759
|
+
{ emoji: "\u2615", keywords: ["cafe", "caf\xE9", "bebida", "quente"] },
|
|
760
|
+
{ emoji: "\u{1F37A}", keywords: ["cerveja", "bebida", "chopp"] },
|
|
761
|
+
{ emoji: "\u{1F377}", keywords: ["vinho", "bebida", "taca", "ta\xE7a"] },
|
|
762
|
+
{ emoji: "\u{1F942}", keywords: ["brinde", "comemorar", "champanhe"] },
|
|
763
|
+
{ emoji: "\u{1F964}", keywords: ["refrigerante", "bebida", "copo"] }
|
|
764
|
+
]
|
|
565
765
|
}
|
|
566
766
|
];
|
|
567
|
-
var
|
|
568
|
-
|
|
767
|
+
var ALL_ENTRIES = EMOJI_CATEGORIES.flatMap((category) => category.entries);
|
|
768
|
+
function normalize(value) {
|
|
769
|
+
return value.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "").trim();
|
|
770
|
+
}
|
|
771
|
+
function searchEmojis(query) {
|
|
772
|
+
const term = normalize(query);
|
|
773
|
+
if (!term) return ALL_ENTRIES;
|
|
774
|
+
return ALL_ENTRIES.filter((entry) => entry.keywords.some((keyword) => normalize(keyword).startsWith(term)));
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/EmojiPicker.tsx
|
|
778
|
+
import { useState as useState5, useCallback, useMemo as useMemo2 } from "react";
|
|
779
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
780
|
+
var DEFAULT_EMOJI_PICKER_LABELS = {
|
|
781
|
+
search: "Buscar emoji",
|
|
782
|
+
noResults: "Nenhum emoji encontrado"
|
|
783
|
+
};
|
|
784
|
+
var EmojiPicker = ({ onSelect, labels, className = "" }) => {
|
|
785
|
+
const searchLabel = labels?.search ?? DEFAULT_EMOJI_PICKER_LABELS.search;
|
|
786
|
+
const noResultsLabel = labels?.noResults ?? DEFAULT_EMOJI_PICKER_LABELS.noResults;
|
|
787
|
+
const [activeCategory, setActiveCategory] = useState5(0);
|
|
788
|
+
const [query, setQuery] = useState5("");
|
|
569
789
|
const handleSelect = useCallback(
|
|
570
790
|
(emoji) => {
|
|
571
791
|
onSelect(emoji);
|
|
572
792
|
},
|
|
573
793
|
[onSelect]
|
|
574
794
|
);
|
|
575
|
-
|
|
576
|
-
|
|
795
|
+
const isSearching = query.trim().length > 0;
|
|
796
|
+
const visibleEntries = useMemo2(
|
|
797
|
+
() => isSearching ? searchEmojis(query) : EMOJI_CATEGORIES[activeCategory].entries,
|
|
798
|
+
[isSearching, query, activeCategory]
|
|
799
|
+
);
|
|
800
|
+
return /* @__PURE__ */ jsxs7("div", { className: `bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden ${className}`, children: [
|
|
801
|
+
/* @__PURE__ */ jsx11("div", { className: "p-2 border-b border-gray-200", children: /* @__PURE__ */ jsx11(
|
|
802
|
+
"input",
|
|
803
|
+
{
|
|
804
|
+
type: "search",
|
|
805
|
+
value: query,
|
|
806
|
+
onChange: (event) => setQuery(event.target.value),
|
|
807
|
+
placeholder: searchLabel,
|
|
808
|
+
"aria-label": searchLabel,
|
|
809
|
+
className: "w-full rounded-md border border-gray-200 px-2 py-1.5 text-sm outline-none focus:border-blue-500"
|
|
810
|
+
}
|
|
811
|
+
) }),
|
|
812
|
+
isSearching ? null : /* @__PURE__ */ jsx11("div", { className: "flex border-b border-gray-200 overflow-x-auto", children: EMOJI_CATEGORIES.map((category, index) => /* @__PURE__ */ jsxs7(
|
|
577
813
|
"button",
|
|
578
814
|
{
|
|
579
815
|
onClick: () => setActiveCategory(index),
|
|
580
816
|
className: `px-3 py-2 text-xs font-medium whitespace-nowrap border-b-2 transition-colors ${activeCategory === index ? "border-blue-500 text-blue-600" : "border-transparent text-gray-500 hover:text-gray-700"}`,
|
|
581
817
|
children: [
|
|
582
|
-
category.
|
|
818
|
+
category.entries[0].emoji,
|
|
583
819
|
" ",
|
|
584
820
|
category.name
|
|
585
821
|
]
|
|
586
822
|
},
|
|
587
823
|
category.name
|
|
588
824
|
)) }),
|
|
589
|
-
/* @__PURE__ */
|
|
825
|
+
visibleEntries.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "px-3 py-6 text-center text-sm text-gray-500", children: noResultsLabel }) : /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-10 gap-0.5 p-2 max-h-[240px] overflow-y-auto", children: visibleEntries.map((entry) => /* @__PURE__ */ jsx11(
|
|
590
826
|
"button",
|
|
591
827
|
{
|
|
592
|
-
onClick: () => handleSelect(emoji),
|
|
828
|
+
onClick: () => handleSelect(entry.emoji),
|
|
593
829
|
className: "w-8 h-8 flex items-center justify-center text-lg hover:bg-gray-100 rounded transition-colors cursor-pointer",
|
|
594
|
-
"aria-label": emoji,
|
|
595
|
-
|
|
830
|
+
"aria-label": entry.emoji,
|
|
831
|
+
title: entry.keywords[0],
|
|
832
|
+
children: entry.emoji
|
|
596
833
|
},
|
|
597
|
-
emoji
|
|
834
|
+
entry.emoji
|
|
598
835
|
)) })
|
|
599
836
|
] });
|
|
600
837
|
};
|
|
601
838
|
|
|
602
839
|
// src/MessageComposer.tsx
|
|
603
|
-
import { useState as
|
|
604
|
-
import { Fragment as Fragment2, jsx as
|
|
840
|
+
import { useState as useState6, useRef as useRef2, useCallback as useCallback2 } from "react";
|
|
841
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
605
842
|
var DEFAULT_MESSAGE_COMPOSER_LABELS = {
|
|
606
843
|
emoji: "Emoji",
|
|
607
844
|
attach: "Anexar",
|
|
608
845
|
send: "Enviar"
|
|
609
846
|
};
|
|
610
|
-
var DEFAULT_ACCEPTED_FILE_TYPES =
|
|
847
|
+
var DEFAULT_ACCEPTED_FILE_TYPES = [
|
|
848
|
+
"image/jpeg,image/png,image/webp",
|
|
849
|
+
"audio/aac,audio/mp4,audio/mpeg,audio/amr,audio/ogg",
|
|
850
|
+
"video/mp4,video/3gpp",
|
|
851
|
+
"application/pdf,text/plain,text/csv",
|
|
852
|
+
"application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint",
|
|
853
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
854
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
855
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
856
|
+
].join(",");
|
|
611
857
|
var MessageComposer = ({
|
|
612
858
|
onSend,
|
|
613
859
|
onAttach,
|
|
@@ -625,9 +871,9 @@ var MessageComposer = ({
|
|
|
625
871
|
const emojiLabel = labels?.emoji ?? DEFAULT_MESSAGE_COMPOSER_LABELS.emoji;
|
|
626
872
|
const attachLabel = labels?.attach ?? DEFAULT_MESSAGE_COMPOSER_LABELS.attach;
|
|
627
873
|
const sendLabel = labels?.send ?? DEFAULT_MESSAGE_COMPOSER_LABELS.send;
|
|
628
|
-
const [internalText, setInternalText] =
|
|
629
|
-
const [showEmoji, setShowEmoji] =
|
|
630
|
-
const [attachments, setAttachments] =
|
|
874
|
+
const [internalText, setInternalText] = useState6("");
|
|
875
|
+
const [showEmoji, setShowEmoji] = useState6(false);
|
|
876
|
+
const [attachments, setAttachments] = useState6([]);
|
|
631
877
|
const textareaRef = useRef2(null);
|
|
632
878
|
const fileInputRef = useRef2(null);
|
|
633
879
|
const isControlled = externalValue !== void 0;
|
|
@@ -721,25 +967,25 @@ var MessageComposer = ({
|
|
|
721
967
|
/* A barra é a superfície (cinza, largura cheia, sem raio) e o campo dentro é que arredonda —
|
|
722
968
|
ordem do WhatsApp. Invertido, o pill arredondado ia até a borda da tela e os cantos
|
|
723
969
|
descobriam o fundo branco da página, que lia como defeito. */
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
726
|
-
a.previewUrl ? /* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
970
|
+
/* @__PURE__ */ jsxs8("div", { className: cn("bg-[#f0f2f5] px-2 py-2", className), children: [
|
|
971
|
+
attachments.length > 0 && /* @__PURE__ */ jsx12("div", { className: "flex gap-2 px-1 pb-2 overflow-x-auto", children: attachments.map((a, i) => /* @__PURE__ */ jsxs8("div", { className: "relative flex-shrink-0", children: [
|
|
972
|
+
a.previewUrl ? /* @__PURE__ */ jsx12("img", { src: a.previewUrl, alt: "", className: "w-16 h-16 object-cover rounded-lg border border-gray-200" }) : /* @__PURE__ */ jsx12("div", { className: "w-16 h-16 bg-gray-100 rounded-lg border border-gray-200 flex items-center justify-center", children: /* @__PURE__ */ jsxs8("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", children: [
|
|
973
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
974
|
+
/* @__PURE__ */ jsx12("polyline", { points: "14 2 14 8 20 8" })
|
|
729
975
|
] }) }),
|
|
730
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => removeAttachment(i), className: "absolute -top-2 -right-2 w-5 h-5 bg-gray-600 text-white rounded-full flex items-center justify-center hover:bg-gray-800 text-xs", children: "\u2715" })
|
|
731
977
|
] }, i)) }),
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
showEmojiButton && /* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ jsxs8("div", { className: cn("flex items-end gap-1.5 rounded-xl bg-white px-3 py-2", classNames?.field), children: [
|
|
979
|
+
showEmojiButton && /* @__PURE__ */ jsxs8("div", { className: "relative flex-shrink-0", children: [
|
|
980
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setShowEmoji((v) => !v), className: "w-9 h-9 flex items-center justify-center rounded-full text-gray-500 hover:bg-gray-200 transition-colors", "aria-label": emojiLabel, children: /* @__PURE__ */ jsxs8("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
981
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "12", r: "10" }),
|
|
982
|
+
/* @__PURE__ */ jsx12("path", { d: "M8 14s1.5 2 4 2 4-2 4-2" }),
|
|
983
|
+
/* @__PURE__ */ jsx12("circle", { cx: "9", cy: "9", r: "0.5", fill: "currentColor" }),
|
|
984
|
+
/* @__PURE__ */ jsx12("circle", { cx: "15", cy: "9", r: "0.5", fill: "currentColor" })
|
|
739
985
|
] }) }),
|
|
740
|
-
showEmoji && /* @__PURE__ */
|
|
986
|
+
showEmoji && /* @__PURE__ */ jsx12("div", { className: "absolute bottom-full left-0 mb-2 z-10", children: /* @__PURE__ */ jsx12(EmojiPicker, { onSelect: handleEmojiSelect }) })
|
|
741
987
|
] }),
|
|
742
|
-
/* @__PURE__ */
|
|
988
|
+
/* @__PURE__ */ jsx12(
|
|
743
989
|
"textarea",
|
|
744
990
|
{
|
|
745
991
|
ref: textareaRef,
|
|
@@ -756,31 +1002,31 @@ var MessageComposer = ({
|
|
|
756
1002
|
style: { fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" }
|
|
757
1003
|
}
|
|
758
1004
|
),
|
|
759
|
-
showAttachButton && /* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
/* @__PURE__ */
|
|
1005
|
+
showAttachButton && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1006
|
+
/* @__PURE__ */ jsx12("input", { ref: fileInputRef, type: "file", multiple: true, accept: acceptedFileTypes, onChange: handleFileChange, className: "hidden" }),
|
|
1007
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => fileInputRef.current?.click(), className: "w-9 h-9 flex items-center justify-center rounded-full text-gray-500 hover:bg-gray-200 flex-shrink-0 transition-colors", "aria-label": attachLabel, children: /* @__PURE__ */ jsx12("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx12("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" }) }) })
|
|
762
1008
|
] }),
|
|
763
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ jsx12(
|
|
764
1010
|
"button",
|
|
765
1011
|
{
|
|
766
1012
|
onClick: sendMessage,
|
|
767
1013
|
disabled: !canSend || disabled,
|
|
768
1014
|
className: `w-10 h-10 flex items-center justify-center rounded-full flex-shrink-0 transition-all ${canSend && !disabled ? "bg-[#00a884] text-white hover:bg-[#06cf9c] shadow-sm" : "bg-gray-200 text-gray-400 cursor-not-allowed"}`,
|
|
769
1015
|
"aria-label": sendLabel,
|
|
770
|
-
children: /* @__PURE__ */
|
|
1016
|
+
children: /* @__PURE__ */ jsx12("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx12("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) })
|
|
771
1017
|
}
|
|
772
1018
|
)
|
|
773
1019
|
] }),
|
|
774
|
-
remaining !== null && /* @__PURE__ */
|
|
1020
|
+
remaining !== null && /* @__PURE__ */ jsx12("div", { className: "flex justify-end mt-1 pr-1", children: /* @__PURE__ */ jsx12("span", { className: `text-xs ${remaining < 20 ? "text-red-500" : "text-gray-400"}`, children: remaining }) })
|
|
775
1021
|
] })
|
|
776
1022
|
);
|
|
777
1023
|
};
|
|
778
1024
|
|
|
779
1025
|
// src/DateDivider.tsx
|
|
780
|
-
import { jsx as
|
|
1026
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
781
1027
|
function DateDivider({ iso, className, classNames }) {
|
|
782
1028
|
const { dateDivider } = useConversationLocales();
|
|
783
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ jsx13("div", { className: cn("flex justify-center sticky top-0 z-10 my-2 pointer-events-none", classNames?.root, className), children: /* @__PURE__ */ jsx13(
|
|
784
1030
|
"span",
|
|
785
1031
|
{
|
|
786
1032
|
className: cn(
|
|
@@ -847,11 +1093,11 @@ function phoneInitials(number) {
|
|
|
847
1093
|
}
|
|
848
1094
|
|
|
849
1095
|
// src/hooks/useAsyncResource.ts
|
|
850
|
-
import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef3, useState as
|
|
1096
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef3, useState as useState7 } from "react";
|
|
851
1097
|
function useAsyncResource(fetcher, deps) {
|
|
852
|
-
const [data, setData] =
|
|
853
|
-
const [loading, setLoading] =
|
|
854
|
-
const [error, setError] =
|
|
1098
|
+
const [data, setData] = useState7(void 0);
|
|
1099
|
+
const [loading, setLoading] = useState7(false);
|
|
1100
|
+
const [error, setError] = useState7(void 0);
|
|
855
1101
|
const requestIdRef = useRef3(0);
|
|
856
1102
|
const load = useCallback3(async () => {
|
|
857
1103
|
const requestId = ++requestIdRef.current;
|
|
@@ -901,9 +1147,9 @@ function useConversationDocuments(conversationId, params) {
|
|
|
901
1147
|
}
|
|
902
1148
|
|
|
903
1149
|
// src/ConversationDocumentsPanel.tsx
|
|
904
|
-
import { useState as
|
|
1150
|
+
import { useState as useState8 } from "react";
|
|
905
1151
|
import { ArrowUpDown, Bot, Download, Eye, Users } from "lucide-react";
|
|
906
|
-
import { jsx as
|
|
1152
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
907
1153
|
var DOCUMENT_SOURCE_FILTER = {
|
|
908
1154
|
ALL: "all",
|
|
909
1155
|
CUSTOMER: "customer",
|
|
@@ -943,12 +1189,12 @@ function ConversationDocumentsPanel({
|
|
|
943
1189
|
}) {
|
|
944
1190
|
const labels = { ...DEFAULT_CONVERSATION_DOCUMENTS_LABELS, ...labelsOverride };
|
|
945
1191
|
const context = useConversations();
|
|
946
|
-
const [search, setSearch] =
|
|
947
|
-
const [sourceFilter, setSourceFilter] =
|
|
948
|
-
const [sortDirection, setSortDirection] =
|
|
949
|
-
const [page, setPage] =
|
|
950
|
-
const [selectedIds, setSelectedIds] =
|
|
951
|
-
const [archiveError, setArchiveError] =
|
|
1192
|
+
const [search, setSearch] = useState8("");
|
|
1193
|
+
const [sourceFilter, setSourceFilter] = useState8(DOCUMENT_SOURCE_FILTER.ALL);
|
|
1194
|
+
const [sortDirection, setSortDirection] = useState8("desc");
|
|
1195
|
+
const [page, setPage] = useState8(1);
|
|
1196
|
+
const [selectedIds, setSelectedIds] = useState8([]);
|
|
1197
|
+
const [archiveError, setArchiveError] = useState8(false);
|
|
952
1198
|
const hasFilters = search !== "" || sourceFilter !== DOCUMENT_SOURCE_FILTER.ALL || sortDirection !== "desc";
|
|
953
1199
|
const { documents, total, loading, error } = useConversationDocuments(open ? conversationId : void 0, {
|
|
954
1200
|
search,
|
|
@@ -999,10 +1245,10 @@ function ConversationDocumentsPanel({
|
|
|
999
1245
|
}
|
|
1000
1246
|
}
|
|
1001
1247
|
if (!open) return null;
|
|
1002
|
-
return /* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1248
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("border-b", classNames?.root, className), children: /* @__PURE__ */ jsxs9("section", { className: cn("px-4 py-3", classNames?.body), children: [
|
|
1249
|
+
/* @__PURE__ */ jsx14("p", { className: cn("mb-2 text-sm font-medium", classNames?.title), children: labels.title }),
|
|
1250
|
+
/* @__PURE__ */ jsxs9("div", { className: cn("mb-2 flex flex-wrap items-center gap-2 border-b pb-2", classNames?.filters), children: [
|
|
1251
|
+
/* @__PURE__ */ jsx14(
|
|
1006
1252
|
"input",
|
|
1007
1253
|
{
|
|
1008
1254
|
type: "search",
|
|
@@ -1013,7 +1259,7 @@ function ConversationDocumentsPanel({
|
|
|
1013
1259
|
className: cn("w-full rounded-md border px-3 py-2 text-sm sm:w-52", classNames?.search)
|
|
1014
1260
|
}
|
|
1015
1261
|
),
|
|
1016
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ jsxs9(
|
|
1017
1263
|
"select",
|
|
1018
1264
|
{
|
|
1019
1265
|
value: sourceFilter,
|
|
@@ -1021,25 +1267,25 @@ function ConversationDocumentsPanel({
|
|
|
1021
1267
|
"aria-label": labels.sourceFilterAll,
|
|
1022
1268
|
className: cn("w-full rounded-md border px-2 py-2 text-sm sm:w-36", classNames?.sourceSelect),
|
|
1023
1269
|
children: [
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ jsx14("option", { value: DOCUMENT_SOURCE_FILTER.ALL, children: labels.sourceFilterAll }),
|
|
1271
|
+
/* @__PURE__ */ jsx14("option", { value: DOCUMENT_SOURCE_FILTER.CUSTOMER, children: labels.sourceFilterCustomer }),
|
|
1272
|
+
/* @__PURE__ */ jsx14("option", { value: DOCUMENT_SOURCE_FILTER.TEAM, children: labels.sourceFilterTeam })
|
|
1027
1273
|
]
|
|
1028
1274
|
}
|
|
1029
1275
|
),
|
|
1030
|
-
/* @__PURE__ */
|
|
1276
|
+
/* @__PURE__ */ jsxs9(
|
|
1031
1277
|
"button",
|
|
1032
1278
|
{
|
|
1033
1279
|
type: "button",
|
|
1034
1280
|
onClick: () => applyFilter(() => setSortDirection(sortDirection === "desc" ? "asc" : "desc")),
|
|
1035
1281
|
className: cn("cv-header-action inline-flex items-center gap-1", classNames?.sortButton),
|
|
1036
1282
|
children: [
|
|
1037
|
-
/* @__PURE__ */
|
|
1283
|
+
/* @__PURE__ */ jsx14(ArrowUpDown, { size: 14 }),
|
|
1038
1284
|
sortDirection === "desc" ? labels.sortMostRecent : labels.sortOldest
|
|
1039
1285
|
]
|
|
1040
1286
|
}
|
|
1041
1287
|
),
|
|
1042
|
-
hasFilters ? /* @__PURE__ */
|
|
1288
|
+
hasFilters ? /* @__PURE__ */ jsx14(
|
|
1043
1289
|
"button",
|
|
1044
1290
|
{
|
|
1045
1291
|
type: "button",
|
|
@@ -1053,12 +1299,12 @@ function ConversationDocumentsPanel({
|
|
|
1053
1299
|
}
|
|
1054
1300
|
) : null
|
|
1055
1301
|
] }),
|
|
1056
|
-
loading ? /* @__PURE__ */
|
|
1057
|
-
error ? /* @__PURE__ */
|
|
1058
|
-
!loading && !error && documents.length === 0 ? /* @__PURE__ */
|
|
1059
|
-
canArchive && documents.length > 0 ? /* @__PURE__ */
|
|
1060
|
-
/* @__PURE__ */
|
|
1061
|
-
/* @__PURE__ */
|
|
1302
|
+
loading ? /* @__PURE__ */ jsx14("p", { className: cn("text-xs text-gray-500", classNames?.status), children: labels.loading }) : null,
|
|
1303
|
+
error ? /* @__PURE__ */ jsx14("p", { role: "alert", className: cn("text-xs text-red-600 dark:text-red-400", classNames?.status), children: labels.failure }) : null,
|
|
1304
|
+
!loading && !error && documents.length === 0 ? /* @__PURE__ */ jsx14("p", { className: cn("text-xs text-gray-500", classNames?.status), children: hasFilters ? labels.noResults : labels.empty }) : null,
|
|
1305
|
+
canArchive && documents.length > 0 ? /* @__PURE__ */ jsxs9("div", { className: cn("mb-2 flex flex-wrap items-center gap-3 text-xs", classNames?.selectionBar), children: [
|
|
1306
|
+
/* @__PURE__ */ jsxs9("label", { className: "inline-flex items-center gap-1.5", children: [
|
|
1307
|
+
/* @__PURE__ */ jsx14(
|
|
1062
1308
|
"input",
|
|
1063
1309
|
{
|
|
1064
1310
|
type: "checkbox",
|
|
@@ -1069,13 +1315,13 @@ function ConversationDocumentsPanel({
|
|
|
1069
1315
|
),
|
|
1070
1316
|
labels.selectAll
|
|
1071
1317
|
] }),
|
|
1072
|
-
selectedIds.length > 0 ? /* @__PURE__ */
|
|
1073
|
-
archiveError ? /* @__PURE__ */
|
|
1318
|
+
selectedIds.length > 0 ? /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => void handleDownloadSelected(), className: "cv-header-action", children: labels.downloadSelected(selectedIds.length) }) : null,
|
|
1319
|
+
archiveError ? /* @__PURE__ */ jsx14("span", { role: "alert", className: "text-red-600 dark:text-red-400", children: labels.archiveFailed }) : null
|
|
1074
1320
|
] }) : null,
|
|
1075
|
-
/* @__PURE__ */
|
|
1321
|
+
/* @__PURE__ */ jsx14("ul", { className: cn("space-y-2", classNames?.list), children: documents.map((document2) => {
|
|
1076
1322
|
const isFromCustomer = !TEAM_SOURCES.has(document2.source);
|
|
1077
1323
|
const SourceIcon = isFromCustomer ? Users : Bot;
|
|
1078
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsxs9(
|
|
1079
1325
|
"li",
|
|
1080
1326
|
{
|
|
1081
1327
|
className: cn(
|
|
@@ -1083,8 +1329,8 @@ function ConversationDocumentsPanel({
|
|
|
1083
1329
|
classNames?.item
|
|
1084
1330
|
),
|
|
1085
1331
|
children: [
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
canArchive ? /* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
1333
|
+
canArchive ? /* @__PURE__ */ jsx14(
|
|
1088
1334
|
"input",
|
|
1089
1335
|
{
|
|
1090
1336
|
type: "checkbox",
|
|
@@ -1094,9 +1340,9 @@ function ConversationDocumentsPanel({
|
|
|
1094
1340
|
className: cn("shrink-0", classNames?.checkbox)
|
|
1095
1341
|
}
|
|
1096
1342
|
) : null,
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx14(FileIcon, { filename: document2.filename, mimeType: document2.mimeType }),
|
|
1344
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
|
|
1345
|
+
/* @__PURE__ */ jsxs9(
|
|
1100
1346
|
"div",
|
|
1101
1347
|
{
|
|
1102
1348
|
className: cn(
|
|
@@ -1105,12 +1351,12 @@ function ConversationDocumentsPanel({
|
|
|
1105
1351
|
classNames?.sourceBadge
|
|
1106
1352
|
),
|
|
1107
1353
|
children: [
|
|
1108
|
-
/* @__PURE__ */
|
|
1354
|
+
/* @__PURE__ */ jsx14(SourceIcon, { size: 11 }),
|
|
1109
1355
|
isFromCustomer ? labels.sourceFilterCustomer : labels.sourceFilterTeam
|
|
1110
1356
|
]
|
|
1111
1357
|
}
|
|
1112
1358
|
),
|
|
1113
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ jsx14(
|
|
1114
1360
|
"div",
|
|
1115
1361
|
{
|
|
1116
1362
|
className: cn("truncate text-sm font-medium", classNames?.filename),
|
|
@@ -1118,15 +1364,15 @@ function ConversationDocumentsPanel({
|
|
|
1118
1364
|
children: document2.filename
|
|
1119
1365
|
}
|
|
1120
1366
|
),
|
|
1121
|
-
/* @__PURE__ */
|
|
1367
|
+
/* @__PURE__ */ jsxs9("div", { className: cn("text-xs text-gray-500 dark:text-gray-400", classNames?.meta), children: [
|
|
1122
1368
|
formatDateTime(document2.linkedAt),
|
|
1123
1369
|
" \xB7 ",
|
|
1124
1370
|
formatFileSize(document2.sizeBytes)
|
|
1125
1371
|
] })
|
|
1126
1372
|
] })
|
|
1127
1373
|
] }),
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex shrink-0 gap-1", children: [
|
|
1375
|
+
/* @__PURE__ */ jsx14(
|
|
1130
1376
|
"button",
|
|
1131
1377
|
{
|
|
1132
1378
|
type: "button",
|
|
@@ -1134,10 +1380,10 @@ function ConversationDocumentsPanel({
|
|
|
1134
1380
|
title: labels.view,
|
|
1135
1381
|
"aria-label": `${labels.view}: ${document2.filename}`,
|
|
1136
1382
|
className: cn("cv-header-icon", classNames?.viewButton),
|
|
1137
|
-
children: /* @__PURE__ */
|
|
1383
|
+
children: /* @__PURE__ */ jsx14(Eye, { size: 14 })
|
|
1138
1384
|
}
|
|
1139
1385
|
),
|
|
1140
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ jsx14(
|
|
1141
1387
|
"button",
|
|
1142
1388
|
{
|
|
1143
1389
|
type: "button",
|
|
@@ -1145,7 +1391,7 @@ function ConversationDocumentsPanel({
|
|
|
1145
1391
|
title: labels.download,
|
|
1146
1392
|
"aria-label": `${labels.download}: ${document2.filename}`,
|
|
1147
1393
|
className: cn("cv-header-icon", classNames?.downloadButton),
|
|
1148
|
-
children: /* @__PURE__ */
|
|
1394
|
+
children: /* @__PURE__ */ jsx14(Download, { size: 14 })
|
|
1149
1395
|
}
|
|
1150
1396
|
)
|
|
1151
1397
|
] })
|
|
@@ -1154,7 +1400,7 @@ function ConversationDocumentsPanel({
|
|
|
1154
1400
|
document2.id
|
|
1155
1401
|
);
|
|
1156
1402
|
}) }),
|
|
1157
|
-
total > perPage ? /* @__PURE__ */
|
|
1403
|
+
total > perPage ? /* @__PURE__ */ jsxs9(
|
|
1158
1404
|
"div",
|
|
1159
1405
|
{
|
|
1160
1406
|
className: cn(
|
|
@@ -1162,9 +1408,9 @@ function ConversationDocumentsPanel({
|
|
|
1162
1408
|
classNames?.pagination
|
|
1163
1409
|
),
|
|
1164
1410
|
children: [
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ jsx14("span", { className: "text-gray-400", children: labels.total(total) }),
|
|
1412
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
1413
|
+
/* @__PURE__ */ jsx14(
|
|
1168
1414
|
"button",
|
|
1169
1415
|
{
|
|
1170
1416
|
type: "button",
|
|
@@ -1175,8 +1421,8 @@ function ConversationDocumentsPanel({
|
|
|
1175
1421
|
children: "\u2039"
|
|
1176
1422
|
}
|
|
1177
1423
|
),
|
|
1178
|
-
/* @__PURE__ */
|
|
1179
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ jsx14("span", { className: "text-gray-500", children: labels.page(page, lastPage) }),
|
|
1425
|
+
/* @__PURE__ */ jsx14(
|
|
1180
1426
|
"button",
|
|
1181
1427
|
{
|
|
1182
1428
|
type: "button",
|
|
@@ -1195,9 +1441,9 @@ function ConversationDocumentsPanel({
|
|
|
1195
1441
|
}
|
|
1196
1442
|
|
|
1197
1443
|
// src/DocumentsLibrary.tsx
|
|
1198
|
-
import { useEffect as useEffect3, useState as
|
|
1444
|
+
import { useEffect as useEffect3, useState as useState9 } from "react";
|
|
1199
1445
|
import { ArrowUpDown as ArrowUpDown2, Bot as Bot2, Download as Download2, Eye as Eye2, MessageSquare, Users as Users2 } from "lucide-react";
|
|
1200
|
-
import { jsx as
|
|
1446
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1201
1447
|
var DEFAULT_DOCUMENTS_LIBRARY_LABELS = {
|
|
1202
1448
|
title: "Documentos",
|
|
1203
1449
|
searchPlaceholder: "Buscar por nome do arquivo ou telefone",
|
|
@@ -1228,14 +1474,14 @@ function DocumentsLibrary({
|
|
|
1228
1474
|
}) {
|
|
1229
1475
|
const labels = { ...DEFAULT_DOCUMENTS_LIBRARY_LABELS, ...labelsOverride };
|
|
1230
1476
|
const context = useConversations();
|
|
1231
|
-
const [search, setSearch] =
|
|
1232
|
-
const [sourceFilter, setSourceFilter] =
|
|
1233
|
-
const [sortDirection, setSortDirection] =
|
|
1234
|
-
const [page, setPage] =
|
|
1235
|
-
const [documents, setDocuments] =
|
|
1236
|
-
const [total, setTotal] =
|
|
1237
|
-
const [loading, setLoading] =
|
|
1238
|
-
const [failed, setFailed] =
|
|
1477
|
+
const [search, setSearch] = useState9("");
|
|
1478
|
+
const [sourceFilter, setSourceFilter] = useState9(DOCUMENT_SOURCE_FILTER.ALL);
|
|
1479
|
+
const [sortDirection, setSortDirection] = useState9("desc");
|
|
1480
|
+
const [page, setPage] = useState9(1);
|
|
1481
|
+
const [documents, setDocuments] = useState9([]);
|
|
1482
|
+
const [total, setTotal] = useState9(0);
|
|
1483
|
+
const [loading, setLoading] = useState9(false);
|
|
1484
|
+
const [failed, setFailed] = useState9(false);
|
|
1239
1485
|
const hasFilters = search !== "" || sourceFilter !== DOCUMENT_SOURCE_FILTER.ALL || sortDirection !== "desc";
|
|
1240
1486
|
const lastPage = Math.max(1, Math.ceil(total / perPage));
|
|
1241
1487
|
const fetchAll = context?.api.getAllDocuments;
|
|
@@ -1272,10 +1518,10 @@ function DocumentsLibrary({
|
|
|
1272
1518
|
if (url) window.open(url, "_blank", "noopener,noreferrer");
|
|
1273
1519
|
}
|
|
1274
1520
|
if (!fetchAll) return null;
|
|
1275
|
-
return /* @__PURE__ */
|
|
1276
|
-
/* @__PURE__ */
|
|
1277
|
-
/* @__PURE__ */
|
|
1278
|
-
/* @__PURE__ */
|
|
1521
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn("space-y-3", classNames?.root, className), children: [
|
|
1522
|
+
/* @__PURE__ */ jsx15("h2", { className: cn("text-lg font-semibold", classNames?.title), children: labels.title }),
|
|
1523
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex flex-wrap items-center gap-2", classNames?.filters), children: [
|
|
1524
|
+
/* @__PURE__ */ jsx15(
|
|
1279
1525
|
"input",
|
|
1280
1526
|
{
|
|
1281
1527
|
type: "search",
|
|
@@ -1286,7 +1532,7 @@ function DocumentsLibrary({
|
|
|
1286
1532
|
className: cn("w-full rounded-md border px-3 py-2 text-sm sm:w-64", classNames?.search)
|
|
1287
1533
|
}
|
|
1288
1534
|
),
|
|
1289
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsxs10(
|
|
1290
1536
|
"select",
|
|
1291
1537
|
{
|
|
1292
1538
|
value: sourceFilter,
|
|
@@ -1294,25 +1540,25 @@ function DocumentsLibrary({
|
|
|
1294
1540
|
"aria-label": labels.sourceFilterAll,
|
|
1295
1541
|
className: cn("w-full rounded-md border px-2 py-2 text-sm sm:w-40", classNames?.sourceSelect),
|
|
1296
1542
|
children: [
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ jsx15("option", { value: DOCUMENT_SOURCE_FILTER.ALL, children: labels.sourceFilterAll }),
|
|
1544
|
+
/* @__PURE__ */ jsx15("option", { value: DOCUMENT_SOURCE_FILTER.CUSTOMER, children: labels.sourceFilterCustomer }),
|
|
1545
|
+
/* @__PURE__ */ jsx15("option", { value: DOCUMENT_SOURCE_FILTER.TEAM, children: labels.sourceFilterTeam })
|
|
1300
1546
|
]
|
|
1301
1547
|
}
|
|
1302
1548
|
),
|
|
1303
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ jsxs10(
|
|
1304
1550
|
"button",
|
|
1305
1551
|
{
|
|
1306
1552
|
type: "button",
|
|
1307
1553
|
onClick: () => applyFilter(() => setSortDirection(sortDirection === "desc" ? "asc" : "desc")),
|
|
1308
1554
|
className: cn("cv-header-action inline-flex items-center gap-1", classNames?.sortButton),
|
|
1309
1555
|
children: [
|
|
1310
|
-
/* @__PURE__ */
|
|
1556
|
+
/* @__PURE__ */ jsx15(ArrowUpDown2, { size: 14 }),
|
|
1311
1557
|
sortDirection === "desc" ? labels.sortMostRecent : labels.sortOldest
|
|
1312
1558
|
]
|
|
1313
1559
|
}
|
|
1314
1560
|
),
|
|
1315
|
-
hasFilters ? /* @__PURE__ */
|
|
1561
|
+
hasFilters ? /* @__PURE__ */ jsx15(
|
|
1316
1562
|
"button",
|
|
1317
1563
|
{
|
|
1318
1564
|
type: "button",
|
|
@@ -1326,13 +1572,13 @@ function DocumentsLibrary({
|
|
|
1326
1572
|
}
|
|
1327
1573
|
) : null
|
|
1328
1574
|
] }),
|
|
1329
|
-
loading ? /* @__PURE__ */
|
|
1330
|
-
failed ? /* @__PURE__ */
|
|
1331
|
-
!loading && !failed && documents.length === 0 ? /* @__PURE__ */
|
|
1332
|
-
/* @__PURE__ */
|
|
1575
|
+
loading ? /* @__PURE__ */ jsx15("p", { className: cn("text-sm text-gray-500", classNames?.status), children: labels.loading }) : null,
|
|
1576
|
+
failed ? /* @__PURE__ */ jsx15("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.failure }) : null,
|
|
1577
|
+
!loading && !failed && documents.length === 0 ? /* @__PURE__ */ jsx15("p", { className: cn("text-sm text-gray-500", classNames?.status), children: hasFilters ? labels.noResults : labels.empty }) : null,
|
|
1578
|
+
/* @__PURE__ */ jsx15("ul", { className: cn("space-y-2", classNames?.list), children: documents.map((document2) => {
|
|
1333
1579
|
const isFromCustomer = !TEAM_SOURCES2.has(document2.source);
|
|
1334
1580
|
const SourceIcon = isFromCustomer ? Users2 : Bot2;
|
|
1335
|
-
return /* @__PURE__ */
|
|
1581
|
+
return /* @__PURE__ */ jsxs10(
|
|
1336
1582
|
"li",
|
|
1337
1583
|
{
|
|
1338
1584
|
className: cn(
|
|
@@ -1340,23 +1586,23 @@ function DocumentsLibrary({
|
|
|
1340
1586
|
classNames?.item
|
|
1341
1587
|
),
|
|
1342
1588
|
children: [
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1589
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
1590
|
+
/* @__PURE__ */ jsx15(FileIcon, { filename: document2.filename, mimeType: document2.mimeType }),
|
|
1591
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
|
|
1592
|
+
/* @__PURE__ */ jsx15("div", { className: cn("truncate text-sm font-medium", classNames?.filename), title: document2.filename, children: document2.filename }),
|
|
1593
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex flex-wrap items-center gap-x-2 text-xs text-gray-500", classNames?.meta), children: [
|
|
1594
|
+
/* @__PURE__ */ jsxs10("span", { className: "inline-flex items-center gap-1", children: [
|
|
1595
|
+
/* @__PURE__ */ jsx15(SourceIcon, { size: 11 }),
|
|
1350
1596
|
isFromCustomer ? labels.sourceFilterCustomer : labels.sourceFilterTeam
|
|
1351
1597
|
] }),
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ jsx15("span", { children: "\xB7" }),
|
|
1599
|
+
/* @__PURE__ */ jsx15("span", { children: formatDateTime(document2.linkedAt) }),
|
|
1600
|
+
/* @__PURE__ */ jsx15("span", { children: "\xB7" }),
|
|
1601
|
+
/* @__PURE__ */ jsx15("span", { children: formatFileSize(document2.sizeBytes) })
|
|
1356
1602
|
] })
|
|
1357
1603
|
] })
|
|
1358
1604
|
] }),
|
|
1359
|
-
onOpenConversation ? /* @__PURE__ */
|
|
1605
|
+
onOpenConversation ? /* @__PURE__ */ jsxs10(
|
|
1360
1606
|
"button",
|
|
1361
1607
|
{
|
|
1362
1608
|
type: "button",
|
|
@@ -1364,13 +1610,13 @@ function DocumentsLibrary({
|
|
|
1364
1610
|
title: labels.openConversation,
|
|
1365
1611
|
className: cn("cv-header-action inline-flex shrink-0 items-center gap-1", classNames?.conversationLink),
|
|
1366
1612
|
children: [
|
|
1367
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsx15(MessageSquare, { size: 12 }),
|
|
1368
1614
|
formatPhone(document2.conversationId)
|
|
1369
1615
|
]
|
|
1370
1616
|
}
|
|
1371
|
-
) : /* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1617
|
+
) : /* @__PURE__ */ jsx15("span", { className: cn("shrink-0 text-xs text-gray-500", classNames?.conversationLink), children: formatPhone(document2.conversationId) }),
|
|
1618
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 gap-1", children: [
|
|
1619
|
+
/* @__PURE__ */ jsx15(
|
|
1374
1620
|
"button",
|
|
1375
1621
|
{
|
|
1376
1622
|
type: "button",
|
|
@@ -1378,10 +1624,10 @@ function DocumentsLibrary({
|
|
|
1378
1624
|
title: labels.view,
|
|
1379
1625
|
"aria-label": `${labels.view}: ${document2.filename}`,
|
|
1380
1626
|
className: "cv-header-icon",
|
|
1381
|
-
children: /* @__PURE__ */
|
|
1627
|
+
children: /* @__PURE__ */ jsx15(Eye2, { size: 14 })
|
|
1382
1628
|
}
|
|
1383
1629
|
),
|
|
1384
|
-
/* @__PURE__ */
|
|
1630
|
+
/* @__PURE__ */ jsx15(
|
|
1385
1631
|
"button",
|
|
1386
1632
|
{
|
|
1387
1633
|
type: "button",
|
|
@@ -1389,7 +1635,7 @@ function DocumentsLibrary({
|
|
|
1389
1635
|
title: labels.download,
|
|
1390
1636
|
"aria-label": `${labels.download}: ${document2.filename}`,
|
|
1391
1637
|
className: "cv-header-icon",
|
|
1392
|
-
children: /* @__PURE__ */
|
|
1638
|
+
children: /* @__PURE__ */ jsx15(Download2, { size: 14 })
|
|
1393
1639
|
}
|
|
1394
1640
|
)
|
|
1395
1641
|
] })
|
|
@@ -1398,10 +1644,10 @@ function DocumentsLibrary({
|
|
|
1398
1644
|
`${document2.conversationId}:${document2.id}`
|
|
1399
1645
|
);
|
|
1400
1646
|
}) }),
|
|
1401
|
-
total > perPage ? /* @__PURE__ */
|
|
1402
|
-
/* @__PURE__ */
|
|
1403
|
-
/* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1647
|
+
total > perPage ? /* @__PURE__ */ jsxs10("div", { className: cn("flex items-center justify-between border-t pt-2 text-xs dark:border-gray-700", classNames?.pagination), children: [
|
|
1648
|
+
/* @__PURE__ */ jsx15("span", { className: "text-gray-400", children: labels.total(total) }),
|
|
1649
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
1650
|
+
/* @__PURE__ */ jsx15(
|
|
1405
1651
|
"button",
|
|
1406
1652
|
{
|
|
1407
1653
|
type: "button",
|
|
@@ -1411,8 +1657,8 @@ function DocumentsLibrary({
|
|
|
1411
1657
|
children: "\u2039"
|
|
1412
1658
|
}
|
|
1413
1659
|
),
|
|
1414
|
-
/* @__PURE__ */
|
|
1415
|
-
/* @__PURE__ */
|
|
1660
|
+
/* @__PURE__ */ jsx15("span", { className: "text-gray-500", children: labels.page(page, lastPage) }),
|
|
1661
|
+
/* @__PURE__ */ jsx15(
|
|
1416
1662
|
"button",
|
|
1417
1663
|
{
|
|
1418
1664
|
type: "button",
|
|
@@ -1441,13 +1687,19 @@ export {
|
|
|
1441
1687
|
MediaRenderer,
|
|
1442
1688
|
DEFAULT_LIGHTBOX_LABELS,
|
|
1443
1689
|
Lightbox,
|
|
1690
|
+
DEFAULT_INTERACTIVE_MESSAGE_LABELS,
|
|
1691
|
+
InteractiveMessage,
|
|
1444
1692
|
createMediaUrlResolver,
|
|
1445
1693
|
ConversationsProvider,
|
|
1446
1694
|
useConversations,
|
|
1447
1695
|
MessageBubble,
|
|
1448
1696
|
ConversationWallpaper,
|
|
1697
|
+
EMOJI_CATEGORIES,
|
|
1698
|
+
searchEmojis,
|
|
1699
|
+
DEFAULT_EMOJI_PICKER_LABELS,
|
|
1449
1700
|
EmojiPicker,
|
|
1450
1701
|
DEFAULT_MESSAGE_COMPOSER_LABELS,
|
|
1702
|
+
DEFAULT_ACCEPTED_FILE_TYPES,
|
|
1451
1703
|
MessageComposer,
|
|
1452
1704
|
DateDivider,
|
|
1453
1705
|
formatPhone,
|