@fayz-ai/plugin-conversations 0.33.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-6DVS3C2L.js → ConversationsPage-HULLLSJZ.js} +73 -56
- package/dist/ConversationsPage-HULLLSJZ.js.map +1 -0
- package/dist/{chunk-XOMWIVPC.js → chunk-OJ3Q4S5Y.js} +2 -2
- package/dist/chunk-OJ3Q4S5Y.js.map +1 -0
- package/dist/components/Composer.d.ts +4 -1
- package/dist/components/Composer.d.ts.map +1 -1
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +2 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +121 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/views/ConversationList.d.ts.map +1 -1
- package/dist/views/MessageThread.d.ts.map +1 -1
- package/dist/views/SendWindow.d.ts +2 -2
- package/dist/views/SendWindow.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ConversationsPage-6DVS3C2L.js.map +0 -1
- package/dist/chunk-XOMWIVPC.js.map +0 -1
- package/dist/views/WhatsAppConnectionFooter.d.ts +0 -8
- package/dist/views/WhatsAppConnectionFooter.d.ts.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ConversationsContextProvider, useConversationsStore, assinarChegada, useConversationsConfig, CHANNEL_LABELS, isWaitingOnUs, MessagePreview, mediaPreviewKind } from './chunk-
|
|
1
|
+
import { ConversationsContextProvider, useConversationsStore, assinarChegada, useConversationsConfig, CHANNEL_LABELS, isWaitingOnUs, MessagePreview, mediaPreviewKind } from './chunk-OJ3Q4S5Y.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, 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();
|
|
@@ -185,11 +149,15 @@ function ConversationList({ className }) {
|
|
|
185
149
|
setSearch
|
|
186
150
|
} = useConversationsStore((s) => s);
|
|
187
151
|
const [archived, setArchived] = React7__default.useState(false);
|
|
152
|
+
const [inbox, setInbox] = React7__default.useState("commercial");
|
|
153
|
+
const inboxes = React7__default.useMemo(() => new Set(conversations.map((c) => c.inbox ?? "commercial")), [conversations]);
|
|
154
|
+
const bothInboxes = inboxes.size > 1;
|
|
155
|
+
const waitingIn = (which) => conversations.filter((c) => (c.inbox ?? "commercial") === which && c.status !== "closed" && isWaitingOnUs(c)).length;
|
|
188
156
|
const shown = React7__default.useMemo(
|
|
189
157
|
// Waiting on us stays pinned on top (newest first among them): a red thread
|
|
190
158
|
// is a contact to make, and it must not sink under newer chatter.
|
|
191
|
-
() => conversations.filter((c) => archived ? c.status === "closed" : c.status !== "closed").map((c, i) => ({ c, i, waiting: isWaitingOnUs(c) })).sort((a, b) => a.waiting === b.waiting ? a.i - b.i : a.waiting ? -1 : 1).map(({ c }) => c),
|
|
192
|
-
[conversations, archived]
|
|
159
|
+
() => conversations.filter((c) => !bothInboxes || (c.inbox ?? "commercial") === inbox).filter((c) => archived ? c.status === "closed" : c.status !== "closed").map((c, i) => ({ c, i, waiting: isWaitingOnUs(c) })).sort((a, b) => a.waiting === b.waiting ? a.i - b.i : a.waiting ? -1 : 1).map(({ c }) => c),
|
|
160
|
+
[conversations, archived, bothInboxes, inbox]
|
|
193
161
|
);
|
|
194
162
|
const donos = React7__default.useMemo(() => {
|
|
195
163
|
const vistos = /* @__PURE__ */ new Map();
|
|
@@ -199,6 +167,25 @@ function ConversationList({ className }) {
|
|
|
199
167
|
return [...vistos].map(([value, label]) => ({ value, label }));
|
|
200
168
|
}, [conversations]);
|
|
201
169
|
return /* @__PURE__ */ jsxs("aside", { className: cn("w-full shrink-0 flex-col border-r border-border bg-card lg:w-[320px]", className), children: [
|
|
170
|
+
bothInboxes && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 border-b border-border text-sm", children: ["commercial", "support"].map((which) => {
|
|
171
|
+
const n = waitingIn(which);
|
|
172
|
+
return /* @__PURE__ */ jsxs(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
onClick: () => setInbox(which),
|
|
177
|
+
className: cn(
|
|
178
|
+
"flex items-center justify-center gap-1.5 py-2.5 font-medium transition-colors",
|
|
179
|
+
inbox === which ? "border-b-2 border-primary text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
180
|
+
),
|
|
181
|
+
children: [
|
|
182
|
+
which === "commercial" ? "Comercial" : "Suporte",
|
|
183
|
+
n > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-destructive px-1.5 text-[10px] font-semibold text-destructive-foreground", children: n })
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
which
|
|
187
|
+
);
|
|
188
|
+
}) }),
|
|
202
189
|
/* @__PURE__ */ jsxs("div", { className: "border-b border-border px-3 py-3", children: [
|
|
203
190
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
204
191
|
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
@@ -353,12 +340,12 @@ function ConversationList({ className }) {
|
|
|
353
340
|
] }, c.id)
|
|
354
341
|
);
|
|
355
342
|
})
|
|
356
|
-
] })
|
|
357
|
-
/* @__PURE__ */ jsx(WhatsAppConnectionFooter, {})
|
|
343
|
+
] })
|
|
358
344
|
] });
|
|
359
345
|
}
|
|
360
|
-
function useSendWindow(conversationId) {
|
|
346
|
+
function useSendWindow(conversationId, contactHandle) {
|
|
361
347
|
const [row, setRow] = React7__default.useState(null);
|
|
348
|
+
const [optedOut, setOptedOut] = React7__default.useState(false);
|
|
362
349
|
const [providers, setProviders] = React7__default.useState(null);
|
|
363
350
|
React7__default.useEffect(() => {
|
|
364
351
|
let alive = true;
|
|
@@ -391,8 +378,23 @@ function useSendWindow(conversationId) {
|
|
|
391
378
|
alive = false;
|
|
392
379
|
};
|
|
393
380
|
}, [conversationId]);
|
|
381
|
+
React7__default.useEffect(() => {
|
|
382
|
+
let alive = true;
|
|
383
|
+
setOptedOut(false);
|
|
384
|
+
const last8 = String(contactHandle ?? "").replace(/\D/gu, "").slice(-8);
|
|
385
|
+
const sb = getSupabaseClientOptional();
|
|
386
|
+
if (!sb || last8.length < 8) return;
|
|
387
|
+
sb.from("plg_conversations_optouts").select("id").eq("tenant_id", getActiveTenantId()).eq("channel", "whatsapp").eq("active", true).like("phone_e164", `%${last8}`).limit(1).then(({ data }) => {
|
|
388
|
+
if (alive) setOptedOut((data ?? []).length > 0);
|
|
389
|
+
}).catch(() => {
|
|
390
|
+
});
|
|
391
|
+
return () => {
|
|
392
|
+
alive = false;
|
|
393
|
+
};
|
|
394
|
+
}, [contactHandle]);
|
|
394
395
|
const provider = (providers ?? []).find((p) => p.isActive);
|
|
395
396
|
const mode = React7__default.useMemo(() => {
|
|
397
|
+
if (optedOut) return { kind: "blocked", reason: "opted_out" };
|
|
396
398
|
if (!provider) return { kind: "blocked", reason: "no_provider" };
|
|
397
399
|
if (!provider.capabilities?.requires_template) {
|
|
398
400
|
return { kind: "free", until: null, minutesLeft: null };
|
|
@@ -401,7 +403,7 @@ function useSendWindow(conversationId) {
|
|
|
401
403
|
return { kind: "free", until: row.window_expires_at, minutesLeft: row.minutes_left };
|
|
402
404
|
}
|
|
403
405
|
return { kind: "template", reason: row?.last_inbound_at ? "window_closed" : "never_replied" };
|
|
404
|
-
}, [row, provider]);
|
|
406
|
+
}, [row, provider, optedOut]);
|
|
405
407
|
return { loading: providers === null, mode, provider };
|
|
406
408
|
}
|
|
407
409
|
function humanLeft(minutes) {
|
|
@@ -421,6 +423,12 @@ function SendWindowBanner({ state }) {
|
|
|
421
423
|
humanLeft(mode.minutesLeft)
|
|
422
424
|
] });
|
|
423
425
|
}
|
|
426
|
+
if (mode.kind === "blocked" && mode.reason === "opted_out") {
|
|
427
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 bg-muted px-4 py-2 text-[11px] text-muted-foreground", children: [
|
|
428
|
+
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-muted-foreground" }),
|
|
429
|
+
"Esta pessoa pediu para n\xE3o receber mais mensagens (SAIR). N\xE3o \xE9 poss\xEDvel responder por aqui."
|
|
430
|
+
] });
|
|
431
|
+
}
|
|
424
432
|
if (mode.kind === "blocked") {
|
|
425
433
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 bg-destructive-soft px-4 py-2 text-[11px] text-destructive-soft-foreground", children: [
|
|
426
434
|
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-destructive" }),
|
|
@@ -733,7 +741,7 @@ function recordingMime() {
|
|
|
733
741
|
function clock(seconds) {
|
|
734
742
|
return `${Math.floor(seconds / 60)}:${String(Math.floor(seconds % 60)).padStart(2, "0")}`;
|
|
735
743
|
}
|
|
736
|
-
function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
744
|
+
function Composer({ canType, placeholder, sending, onSendText, onSendMedia, clearAssistant = false }) {
|
|
737
745
|
const t = useTranslation();
|
|
738
746
|
const [draft, setDraft] = React7.useState("");
|
|
739
747
|
const [file, setFile] = React7.useState(null);
|
|
@@ -825,6 +833,13 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
825
833
|
recorder.current = null;
|
|
826
834
|
}
|
|
827
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]);
|
|
828
843
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
829
844
|
file && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-b border-border bg-muted/30 px-4 py-2", children: [
|
|
830
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" }) }),
|
|
@@ -838,7 +853,7 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
838
853
|
] }),
|
|
839
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" }) })
|
|
840
855
|
] }),
|
|
841
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-
|
|
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: [
|
|
842
857
|
/* @__PURE__ */ jsx(
|
|
843
858
|
"input",
|
|
844
859
|
{
|
|
@@ -853,16 +868,17 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
853
868
|
}
|
|
854
869
|
}
|
|
855
870
|
),
|
|
856
|
-
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: [
|
|
857
872
|
/* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 animate-pulse rounded-full bg-destructive" }),
|
|
858
873
|
/* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums", children: clock(seconds) }),
|
|
859
874
|
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("conversations.composer.recording") }),
|
|
860
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" }) })
|
|
861
876
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
862
|
-
/* @__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" }) }),
|
|
863
878
|
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
864
879
|
Textarea,
|
|
865
880
|
{
|
|
881
|
+
ref: boxRef,
|
|
866
882
|
value: draft,
|
|
867
883
|
onChange: (e) => setDraft(e.target.value),
|
|
868
884
|
onKeyDown: (e) => {
|
|
@@ -881,11 +897,11 @@ function Composer({ canType, placeholder, sending, onSendText, onSendMedia }) {
|
|
|
881
897
|
rows: 1,
|
|
882
898
|
disabled: !canType,
|
|
883
899
|
placeholder: file ? t("conversations.composer.caption") : placeholder,
|
|
884
|
-
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"
|
|
885
901
|
}
|
|
886
902
|
) })
|
|
887
903
|
] }),
|
|
888
|
-
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" }) })
|
|
889
905
|
] })
|
|
890
906
|
] });
|
|
891
907
|
}
|
|
@@ -1126,7 +1142,7 @@ function buildRows(messages) {
|
|
|
1126
1142
|
function MessageThread({ selected, onTogglePanel, panelOpen, onBack, backAlways, className }) {
|
|
1127
1143
|
const t = useTranslation();
|
|
1128
1144
|
const { messages, sending, send, sendMedia, setStatus, refreshMessages } = useConversationsStore((s) => s);
|
|
1129
|
-
const win = useSendWindow(selected.id);
|
|
1145
|
+
const win = useSendWindow(selected.id, selected.channel === "whatsapp" ? selected.contactHandle : void 0);
|
|
1130
1146
|
const canType = win.mode.kind === "free";
|
|
1131
1147
|
const threadRef = React7__default.useRef(null);
|
|
1132
1148
|
React7__default.useEffect(() => {
|
|
@@ -1283,9 +1299,10 @@ function MessageThread({ selected, onTogglePanel, panelOpen, onBack, backAlways,
|
|
|
1283
1299
|
/* @__PURE__ */ jsx(
|
|
1284
1300
|
Composer,
|
|
1285
1301
|
{
|
|
1302
|
+
clearAssistant: !panelOpen,
|
|
1286
1303
|
canType,
|
|
1287
1304
|
sending,
|
|
1288
|
-
placeholder: canType ? t("conversations.thread.reply", { channel: channelLabel(selected.channel) }) : win.mode.kind === "blocked" ? "Envio bloqueado" : "Fora da janela \u2014 envie um template",
|
|
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",
|
|
1289
1306
|
onSendText: (text) => send(text),
|
|
1290
1307
|
onSendMedia: (input) => sendMedia(input)
|
|
1291
1308
|
}
|
|
@@ -1848,5 +1865,5 @@ function ConversationsPage({ store, config }) {
|
|
|
1848
1865
|
}
|
|
1849
1866
|
|
|
1850
1867
|
export { ConversationsPage, conversationIdFromPath };
|
|
1851
|
-
//# sourceMappingURL=ConversationsPage-
|
|
1852
|
-
//# sourceMappingURL=ConversationsPage-
|
|
1868
|
+
//# sourceMappingURL=ConversationsPage-HULLLSJZ.js.map
|
|
1869
|
+
//# sourceMappingURL=ConversationsPage-HULLLSJZ.js.map
|