@fayz-ai/plugin-conversations 0.31.0 → 0.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { ConversationsContextProvider, useConversationsStore, assinarChegada, useConversationsConfig, CHANNEL_LABELS, isWaitingOnUs, MessagePreview, mediaPreviewKind } from './chunk-NXYQFOT7.js';
1
+ import { ConversationsContextProvider, useConversationsStore, assinarChegada, useConversationsConfig, CHANNEL_LABELS, isWaitingOnUs, MessagePreview, mediaPreviewKind } from './chunk-XOMWIVPC.js';
2
2
  import { providersApi } from './chunk-HMWUU5O7.js';
3
3
  import * as React7 from 'react';
4
4
  import React7__default from 'react';
5
- import { SquarePen, MessageSquare, Globe, Mail, Instagram, Phone, Search, User, Archive, Inbox, CheckCheck, ChevronLeft, MoreHorizontal, ArchiveRestore, X, Building2, CheckCircle2, MoreVertical, Loader2, Forward, AlertTriangle, Check, Clock, ExternalLink, Reply, FileText, Trash2, Paperclip, Square, Mic, Send, Snowflake, Sun, Flame, Ban, BarChart3, MapPin, UserRound, Copy, Download } from 'lucide-react';
5
+ import { SquarePen, MessageSquare, LifeBuoy, Globe, Mail, Instagram, Phone, Search, User, Archive, Inbox, CheckCheck, ChevronLeft, MoreHorizontal, ArchiveRestore, X, Building2, CheckCircle2, MoreVertical, Loader2, Forward, AlertTriangle, Check, Clock, ExternalLink, Reply, FileText, Trash2, Paperclip, Square, Mic, Send, Snowflake, Sun, Flame, Ban, BarChart3, MapPin, UserRound, Copy, Download } from 'lucide-react';
6
6
  import { PageHeaderActions, cn, Button, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, Textarea, ModalFooter, Input, FilterChip, Skeleton, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, toast } from '@fayz-ai/ui';
7
7
  import { useRightRailStore, PageActions, useLimitGuard, ContactPicker, invalidateLimit, useConnectors, adminNavigateTo } from '@fayz-ai/admin';
8
8
  import { currentAppPath, appHref, onAppPathChange, replaceApp, useTranslation, useActiveTenantId, errorMessage, tl, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
@@ -13,15 +13,21 @@ var CHANNEL_ICON = {
13
13
  whatsapp: MessageSquare,
14
14
  instagram: Instagram,
15
15
  email: Mail,
16
- webchat: Globe
16
+ webchat: Globe,
17
+ support: LifeBuoy
17
18
  };
18
19
  var CHANNEL_ACCENT = {
19
20
  whatsapp: { color: "#22c55e", badge: "bg-[#22c55e]/12 text-[#15803d] dark:text-[#4ade80]" },
20
21
  sms: { color: "#6366f1", badge: "bg-[#6366f1]/12 text-[#4338ca] dark:text-[#a5b4fc]" },
21
22
  instagram: { color: "#ec4899", badge: "bg-[#ec4899]/12 text-[#be185d] dark:text-[#f9a8d4]" },
22
23
  email: { color: "#0ea5e9", badge: "bg-[#0ea5e9]/12 text-[#0369a1] dark:text-[#7dd3fc]" },
23
- webchat: { color: "#f59e0b", badge: "bg-[#f59e0b]/12 text-[#b45309] dark:text-[#fcd34d]" }
24
+ webchat: { color: "#f59e0b", badge: "bg-[#f59e0b]/12 text-[#b45309] dark:text-[#fcd34d]" },
25
+ support: { color: "#64748b", badge: "bg-[#64748b]/12 text-[#334155] dark:text-[#cbd5e1]" }
24
26
  };
27
+ var UNKNOWN_ACCENT = { color: "#64748b", badge: "bg-muted text-muted-foreground" };
28
+ var channelAccent = (ch) => CHANNEL_ACCENT[ch] ?? UNKNOWN_ACCENT;
29
+ var channelIcon = (ch) => CHANNEL_ICON[ch] ?? MessageSquare;
30
+ var channelLabel = (ch) => CHANNEL_LABELS[ch] ?? String(ch ?? "");
25
31
  function useMediaQuery(query) {
26
32
  const [matches, setMatches] = React7__default.useState(
27
33
  () => typeof window !== "undefined" && window.matchMedia(query).matches
@@ -41,7 +47,7 @@ function initialsOf(name) {
41
47
  }
42
48
  function Avatar({ name, accent, size = "md", channel }) {
43
49
  const dims = size === "lg" ? "h-14 w-14 text-lg" : size === "sm" ? "h-9 w-9 text-xs" : "h-10 w-10 text-sm";
44
- const Icon = channel ? CHANNEL_ICON[channel] : null;
50
+ const Icon = channel ? channelIcon(channel) : null;
45
51
  return /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
46
52
  /* @__PURE__ */ jsx(
47
53
  "div",
@@ -55,25 +61,25 @@ function Avatar({ name, accent, size = "md", channel }) {
55
61
  "span",
56
62
  {
57
63
  className: "absolute -bottom-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full ring-2 ring-card",
58
- style: { backgroundColor: CHANNEL_ACCENT[channel].color },
64
+ style: { backgroundColor: channelAccent(channel).color },
59
65
  children: /* @__PURE__ */ jsx(Icon, { className: "h-2.5 w-2.5 text-white" })
60
66
  }
61
67
  )
62
68
  ] });
63
69
  }
64
70
  function ChannelBadge({ channel, className }) {
65
- const Icon = CHANNEL_ICON[channel];
71
+ const Icon = channelIcon(channel);
66
72
  return /* @__PURE__ */ jsxs(
67
73
  "span",
68
74
  {
69
75
  className: cn(
70
76
  "inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px] font-medium",
71
- CHANNEL_ACCENT[channel].badge,
77
+ channelAccent(channel).badge,
72
78
  className
73
79
  ),
74
80
  children: [
75
81
  /* @__PURE__ */ jsx(Icon, { className: "h-2.5 w-2.5" }),
76
- CHANNEL_LABELS[channel]
82
+ channelLabel(channel)
77
83
  ]
78
84
  }
79
85
  );
@@ -1146,7 +1152,7 @@ function MessageThread({ selected, onTogglePanel, panelOpen, onBack, backAlways,
1146
1152
  document.removeEventListener("visibilitychange", onVis);
1147
1153
  };
1148
1154
  }, [selected.id, refreshMessages]);
1149
- const accent = CHANNEL_ACCENT[selected.channel];
1155
+ const accent = channelAccent(selected.channel);
1150
1156
  const rows = React7__default.useMemo(() => buildRows(messages.filter((m) => !isFoldedRow(m))), [messages]);
1151
1157
  const jumpTo = React7__default.useCallback((providerId) => {
1152
1158
  const el = threadRef.current?.querySelector(`[data-provider-id="${CSS.escape(providerId)}"]`);
@@ -1277,7 +1283,7 @@ function MessageThread({ selected, onTogglePanel, panelOpen, onBack, backAlways,
1277
1283
  {
1278
1284
  canType,
1279
1285
  sending,
1280
- placeholder: canType ? t("conversations.thread.reply", { channel: CHANNEL_LABELS[selected.channel] }) : win.mode.kind === "blocked" ? "Envio bloqueado" : "Fora da janela \u2014 envie um template",
1286
+ placeholder: canType ? t("conversations.thread.reply", { channel: channelLabel(selected.channel) }) : win.mode.kind === "blocked" ? "Envio bloqueado" : "Fora da janela \u2014 envie um template",
1281
1287
  onSendText: (text) => send(text),
1282
1288
  onSendMedia: (input) => sendMedia(input)
1283
1289
  }
@@ -1469,7 +1475,7 @@ function ContactPanel({ contact, onClose, className }) {
1469
1475
  profile === null && /* @__PURE__ */ jsx("p", { className: "px-4 pt-4 text-xs text-muted-foreground", children: t("conversations.profile.notInCrm") }),
1470
1476
  profile && /* @__PURE__ */ jsx(ProfileSections, { profile }),
1471
1477
  /* @__PURE__ */ jsx(Section, { title: t("conversations.profile.conversation"), children: /* @__PURE__ */ jsx(Rows, { rows: [
1472
- [t("conversations.contact.channel"), CHANNEL_LABELS[contact.channel]],
1478
+ [t("conversations.contact.channel"), channelLabel(contact.channel)],
1473
1479
  [t("conversations.contact.status"), t(`conversations.status.${contact.status}`)],
1474
1480
  [t("conversations.contact.assignedTo"), contact.assignedTo],
1475
1481
  // Who answers this conversation may not be who follows the lead up:
@@ -1553,7 +1559,8 @@ var HANDLE_LABEL_KEY = {
1553
1559
  sms: "conversations.new.handleLabel.phone",
1554
1560
  email: "conversations.new.handleLabel.email",
1555
1561
  instagram: "conversations.new.handleLabel.instagram",
1556
- webchat: "conversations.new.handleLabel.webchat"
1562
+ webchat: "conversations.new.handleLabel.webchat",
1563
+ support: "conversations.new.handleLabel.email"
1557
1564
  };
1558
1565
  function NewConversationPanel({
1559
1566
  open,
@@ -1839,5 +1846,5 @@ function ConversationsPage({ store, config }) {
1839
1846
  }
1840
1847
 
1841
1848
  export { ConversationsPage, conversationIdFromPath };
1842
- //# sourceMappingURL=ConversationsPage-VXGZBHZG.js.map
1843
- //# sourceMappingURL=ConversationsPage-VXGZBHZG.js.map
1849
+ //# sourceMappingURL=ConversationsPage-C6FMGA72.js.map
1850
+ //# sourceMappingURL=ConversationsPage-C6FMGA72.js.map