@fayz-ai/plugin-conversations 0.34.0 → 0.34.1
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/{ConversationsPage-32XXQKCP.js → ConversationsPage-HULLLSJZ.js} +21 -49
- package/dist/ConversationsPage-HULLLSJZ.js.map +1 -0
- package/dist/components/Composer.d.ts +4 -1
- package/dist/components/Composer.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/views/ConversationList.d.ts.map +1 -1
- package/dist/views/MessageThread.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/ConversationsPage-32XXQKCP.js.map +0 -1
- package/dist/views/WhatsAppConnectionFooter.d.ts +0 -8
- package/dist/views/WhatsAppConnectionFooter.d.ts.map +0 -1
|
@@ -2,10 +2,10 @@ import { ConversationsContextProvider, useConversationsStore, assinarChegada, us
|
|
|
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, LifeBuoy, Globe, Mail, Instagram, Phone, Search, User, Archive, Inbox, CheckCheck, ChevronLeft, MoreHorizontal, ArchiveRestore, X, Building2,
|
|
5
|
+
import { SquarePen, MessageSquare, LifeBuoy, Globe, Mail, Instagram, Phone, Search, User, Archive, Inbox, CheckCheck, ChevronLeft, MoreHorizontal, ArchiveRestore, X, Building2, 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
|
-
import { useRightRailStore, PageActions, useLimitGuard, ContactPicker, invalidateLimit, useConnectors
|
|
8
|
-
import { currentAppPath, appHref, onAppPathChange, replaceApp, useTranslation, useActiveTenantId, errorMessage,
|
|
7
|
+
import { useRightRailStore, PageActions, useLimitGuard, ContactPicker, invalidateLimit, useConnectors } from '@fayz-ai/admin';
|
|
8
|
+
import { currentAppPath, appHref, onAppPathChange, replaceApp, useTranslation, useActiveTenantId, errorMessage, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
var CHANNEL_ICON = {
|
|
@@ -131,42 +131,6 @@ function useChannelConnections() {
|
|
|
131
131
|
return { whatsapp: whatsapp || live("whatsapp"), email: live("mail"), instagram: live("instagram") };
|
|
132
132
|
}, [whatsapp, connectors]);
|
|
133
133
|
}
|
|
134
|
-
var CONNECTORS_ROUTE = "/settings/conversations/connectors";
|
|
135
|
-
function WhatsAppConnectionFooter() {
|
|
136
|
-
const connected = useChannelConnections();
|
|
137
|
-
return /* @__PURE__ */ jsx("div", { className: "shrink-0 border-t border-border p-3", children: connected === void 0 ? /* @__PURE__ */ jsx("div", { className: "h-10", "aria-hidden": true }) : connected.whatsapp ? /* @__PURE__ */ jsxs(
|
|
138
|
-
Button,
|
|
139
|
-
{
|
|
140
|
-
variant: "bare",
|
|
141
|
-
size: "bare",
|
|
142
|
-
type: "button",
|
|
143
|
-
onClick: () => adminNavigateTo(CONNECTORS_ROUTE),
|
|
144
|
-
className: "font-normal whitespace-normal justify-start fz-tap flex h-10 w-full items-center gap-2 rounded-button px-2 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
145
|
-
children: [
|
|
146
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 text-[#25D366]", "aria-hidden": true }),
|
|
147
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left", children: tl("WhatsApp connected", "WhatsApp conectado") }),
|
|
148
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-primary", children: tl("Manage", "Gerenciar") })
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
) : /* @__PURE__ */ jsxs(
|
|
152
|
-
Button,
|
|
153
|
-
{
|
|
154
|
-
variant: "bare",
|
|
155
|
-
size: "bare",
|
|
156
|
-
type: "button",
|
|
157
|
-
onClick: () => adminNavigateTo(CONNECTORS_ROUTE),
|
|
158
|
-
"data-testid": "inbox-connect-whatsapp",
|
|
159
|
-
className: "font-normal whitespace-normal fz-tap flex h-11 w-full items-center justify-center gap-2 rounded-button bg-[#25D366] text-sm font-semibold text-white shadow-sm transition-colors hover:bg-[#1EBE5A] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#25D366] focus-visible:ring-offset-2",
|
|
160
|
-
children: [
|
|
161
|
-
/* @__PURE__ */ jsx(WhatsAppMark, { className: "h-[18px] w-[18px]" }),
|
|
162
|
-
tl("Connect WhatsApp", "Conectar WhatsApp")
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
) });
|
|
166
|
-
}
|
|
167
|
-
function WhatsAppMark({ className }) {
|
|
168
|
-
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", className, "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M17.47 14.38c-.3-.15-1.76-.87-2.03-.97-.27-.1-.47-.15-.67.15-.2.3-.77.96-.94 1.16-.17.2-.35.22-.65.07-.3-.15-1.26-.46-2.4-1.48-.89-.79-1.49-1.77-1.66-2.07-.17-.3-.02-.46.13-.61.13-.13.3-.35.45-.52.15-.17.2-.3.3-.5.1-.2.05-.37-.02-.52-.08-.15-.67-1.61-.92-2.2-.24-.58-.49-.5-.67-.51h-.57c-.2 0-.52.07-.79.37-.27.3-1.04 1.02-1.04 2.48s1.07 2.88 1.21 3.08c.15.2 2.1 3.2 5.08 4.49.71.31 1.26.49 1.69.63.71.22 1.36.19 1.87.12.57-.09 1.76-.72 2.01-1.41.25-.7.25-1.29.17-1.41-.07-.13-.27-.2-.57-.35zM12.05 21.5h-.01a9.4 9.4 0 0 1-4.8-1.32l-.34-.2-3.56.93.95-3.47-.22-.36a9.4 9.4 0 0 1-1.44-5.02c0-5.2 4.23-9.43 9.43-9.43 2.52 0 4.89.98 6.67 2.77a9.37 9.37 0 0 1 2.76 6.67c0 5.2-4.23 9.43-9.44 9.43zm8.03-17.46A11.3 11.3 0 0 0 12.05.72C5.79.72.7 5.81.7 12.07c0 2 .52 3.95 1.52 5.67L.6 23.6l6-1.57a11.32 11.32 0 0 0 5.44 1.39h.01c6.26 0 11.35-5.1 11.35-11.35 0-3.03-1.18-5.88-3.32-8.03z" }) });
|
|
169
|
-
}
|
|
170
134
|
var FILTERS = ["all", "whatsapp", "instagram", "email"];
|
|
171
135
|
function ConversationList({ className }) {
|
|
172
136
|
const t = useTranslation();
|
|
@@ -376,8 +340,7 @@ function ConversationList({ className }) {
|
|
|
376
340
|
] }, c.id)
|
|
377
341
|
);
|
|
378
342
|
})
|
|
379
|
-
] })
|
|
380
|
-
/* @__PURE__ */ jsx(WhatsAppConnectionFooter, {})
|
|
343
|
+
] })
|
|
381
344
|
] });
|
|
382
345
|
}
|
|
383
346
|
function useSendWindow(conversationId, contactHandle) {
|
|
@@ -778,7 +741,7 @@ function recordingMime() {
|
|
|
778
741
|
function clock(seconds) {
|
|
779
742
|
return `${Math.floor(seconds / 60)}:${String(Math.floor(seconds % 60)).padStart(2, "0")}`;
|
|
780
743
|
}
|
|
781
|
-
function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
744
|
+
function Composer({ canType, placeholder, sending, onSendText, onSendMedia, clearAssistant = false }) {
|
|
782
745
|
const t = useTranslation();
|
|
783
746
|
const [draft, setDraft] = React7.useState("");
|
|
784
747
|
const [file, setFile] = React7.useState(null);
|
|
@@ -870,6 +833,13 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
870
833
|
recorder.current = null;
|
|
871
834
|
}
|
|
872
835
|
const empty = !draft.trim() && !file;
|
|
836
|
+
const boxRef = React7.useRef(null);
|
|
837
|
+
React7.useLayoutEffect(() => {
|
|
838
|
+
const el = boxRef.current;
|
|
839
|
+
if (!el) return;
|
|
840
|
+
el.style.height = "auto";
|
|
841
|
+
el.style.height = `${Math.min(el.scrollHeight, 128)}px`;
|
|
842
|
+
}, [draft]);
|
|
873
843
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
874
844
|
file && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-b border-border bg-muted/30 px-4 py-2", children: [
|
|
875
845
|
preview && file.type.startsWith("image/") ? /* @__PURE__ */ jsx("img", { src: preview, alt: "", className: "h-14 w-14 rounded-md object-cover" }) : preview && file.type.startsWith("video/") ? /* @__PURE__ */ jsx("video", { src: preview, className: "h-14 w-20 rounded-md object-cover" }) : /* @__PURE__ */ jsx("span", { className: "flex h-14 w-14 items-center justify-center rounded-md bg-card", children: /* @__PURE__ */ jsx(FileText, { className: "h-6 w-6 text-muted-foreground" }) }),
|
|
@@ -883,7 +853,7 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
883
853
|
] }),
|
|
884
854
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", onClick: () => setFile(null), "aria-label": t("conversations.composer.removeFile"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) })
|
|
885
855
|
] }),
|
|
886
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
856
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex items-end gap-1.5 bg-muted/30 py-2 pl-2 pr-3", clearAssistant && "md:pr-20", !canType && "opacity-60"), children: [
|
|
887
857
|
/* @__PURE__ */ jsx(
|
|
888
858
|
"input",
|
|
889
859
|
{
|
|
@@ -898,16 +868,17 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
898
868
|
}
|
|
899
869
|
}
|
|
900
870
|
),
|
|
901
|
-
recording ? /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-3 rounded-
|
|
871
|
+
recording ? /* @__PURE__ */ jsxs("div", { className: "flex h-9 flex-1 items-center gap-3 rounded-full border border-destructive/40 bg-destructive-soft/40 px-4", children: [
|
|
902
872
|
/* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 animate-pulse rounded-full bg-destructive" }),
|
|
903
873
|
/* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums", children: clock(seconds) }),
|
|
904
874
|
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("conversations.composer.recording") }),
|
|
905
875
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "ml-auto h-8 w-8", onClick: () => stopRecording(false), "aria-label": t("conversations.composer.discard"), children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" }) })
|
|
906
876
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
907
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "shrink-0", disabled: !canType || busy, onClick: () => inputRef.current?.click(), "aria-label": t("conversations.composer.attach"), children: /* @__PURE__ */ jsx(Paperclip, { className: "h-4 w-4" }) }),
|
|
877
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-9 w-9 shrink-0 rounded-full text-muted-foreground", disabled: !canType || busy, onClick: () => inputRef.current?.click(), "aria-label": t("conversations.composer.attach"), children: /* @__PURE__ */ jsx(Paperclip, { className: "h-4 w-4" }) }),
|
|
908
878
|
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
909
879
|
Textarea,
|
|
910
880
|
{
|
|
881
|
+
ref: boxRef,
|
|
911
882
|
value: draft,
|
|
912
883
|
onChange: (e) => setDraft(e.target.value),
|
|
913
884
|
onKeyDown: (e) => {
|
|
@@ -926,11 +897,11 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
926
897
|
rows: 1,
|
|
927
898
|
disabled: !canType,
|
|
928
899
|
placeholder: file ? t("conversations.composer.caption") : placeholder,
|
|
929
|
-
className: "max-h-32 min-h-
|
|
900
|
+
className: "block h-9 max-h-32 min-h-9 resize-none overflow-y-auto rounded-[18px] border-border bg-background px-4 py-[7px] text-sm leading-5 shadow-none focus:border-primary focus-visible:ring-0 focus-visible:ring-offset-0 disabled:bg-muted/40 disabled:text-muted-foreground disabled:opacity-100"
|
|
930
901
|
}
|
|
931
902
|
) })
|
|
932
903
|
] }),
|
|
933
|
-
recording ? /* @__PURE__ */ jsx(Button, { onClick: () => stopRecording(true), "aria-label": t("conversations.thread.send"), children: /* @__PURE__ */ jsx(Square, { className: "h-3.5 w-3.5 fill-current" }) }) : empty ? /* @__PURE__ */ jsx(Button, { onClick: () => void startRecording(), disabled: !canType || busy || sending, "aria-label": t("conversations.composer.record"), className: cn(busy && "opacity-70"), children: busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Mic, { className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx(Button, { onClick: () => void send(), disabled: !canType || busy || sending, "aria-label": t("conversations.thread.send"), children: busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" }) })
|
|
904
|
+
recording ? /* @__PURE__ */ jsx(Button, { size: "icon", className: "h-9 w-9 shrink-0 rounded-full", onClick: () => stopRecording(true), "aria-label": t("conversations.thread.send"), children: /* @__PURE__ */ jsx(Square, { className: "h-3.5 w-3.5 fill-current" }) }) : empty ? /* @__PURE__ */ jsx(Button, { size: "icon", onClick: () => void startRecording(), disabled: !canType || busy || sending, "aria-label": t("conversations.composer.record"), className: cn("h-9 w-9 shrink-0 rounded-full", busy && "opacity-70"), children: busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Mic, { className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx(Button, { size: "icon", className: "h-9 w-9 shrink-0 rounded-full", onClick: () => void send(), disabled: !canType || busy || sending, "aria-label": t("conversations.thread.send"), children: busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" }) })
|
|
934
905
|
] })
|
|
935
906
|
] });
|
|
936
907
|
}
|
|
@@ -1328,6 +1299,7 @@ function MessageThread({ selected, onTogglePanel, panelOpen, onBack, backAlways,
|
|
|
1328
1299
|
/* @__PURE__ */ jsx(
|
|
1329
1300
|
Composer,
|
|
1330
1301
|
{
|
|
1302
|
+
clearAssistant: !panelOpen,
|
|
1331
1303
|
canType,
|
|
1332
1304
|
sending,
|
|
1333
1305
|
placeholder: canType ? t("conversations.thread.reply", { channel: channelLabel(selected.channel) }) : win.mode.kind === "blocked" ? win.mode.reason === "opted_out" ? "Esta pessoa pediu para sair" : "Envio bloqueado" : "Fora da janela \u2014 envie um template",
|
|
@@ -1893,5 +1865,5 @@ function ConversationsPage({ store, config }) {
|
|
|
1893
1865
|
}
|
|
1894
1866
|
|
|
1895
1867
|
export { ConversationsPage, conversationIdFromPath };
|
|
1896
|
-
//# sourceMappingURL=ConversationsPage-
|
|
1897
|
-
//# sourceMappingURL=ConversationsPage-
|
|
1868
|
+
//# sourceMappingURL=ConversationsPage-HULLLSJZ.js.map
|
|
1869
|
+
//# sourceMappingURL=ConversationsPage-HULLLSJZ.js.map
|