@fayz-ai/plugin-conversations 0.34.1 → 0.35.0
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-HULLLSJZ.js → ConversationsPage-AV34J5DY.js} +48 -18
- package/dist/ConversationsPage-AV34J5DY.js.map +1 -0
- package/dist/chunk-NWH5AIUH.js +322 -0
- package/dist/chunk-NWH5AIUH.js.map +1 -0
- package/dist/index.js +3 -223
- 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 +33 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/store.d.ts +1 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/views/ConversationList.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/ConversationsPage-HULLLSJZ.js.map +0 -1
- package/dist/chunk-OJ3Q4S5Y.js +0 -102
- package/dist/chunk-OJ3Q4S5Y.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ConversationsContextProvider, useConversationsStore, assinarChegada, useConversationsConfig, CHANNEL_LABELS, isWaitingOnUs, MessagePreview, mediaPreviewKind } from './chunk-
|
|
1
|
+
import { ConversationsContextProvider, useConversationsStore, assinarChegada, useConversationsConfig, CHANNEL_LABELS, currentUserId, isWaitingOnUs, MessagePreview, mediaPreviewKind } from './chunk-NWH5AIUH.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,
|
|
5
|
+
import { SquarePen, MessageSquare, LifeBuoy, Globe, Mail, Instagram, Phone, Search, Inbox, User, Archive, 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
7
|
import { useRightRailStore, PageActions, useLimitGuard, ContactPicker, invalidateLimit, useConnectors } from '@fayz-ai/admin';
|
|
8
8
|
import { currentAppPath, appHref, onAppPathChange, replaceApp, useTranslation, useActiveTenantId, errorMessage, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
|
|
@@ -149,6 +149,16 @@ function ConversationList({ className }) {
|
|
|
149
149
|
setSearch
|
|
150
150
|
} = useConversationsStore((s) => s);
|
|
151
151
|
const [archived, setArchived] = React7__default.useState(false);
|
|
152
|
+
const [mineOnly, setMineOnly] = React7__default.useState(false);
|
|
153
|
+
const [me, setMe] = React7__default.useState(null);
|
|
154
|
+
React7__default.useEffect(() => {
|
|
155
|
+
void currentUserId().then(setMe);
|
|
156
|
+
}, []);
|
|
157
|
+
const isMineWaiting = React7__default.useCallback(
|
|
158
|
+
(c) => Boolean(me) && c.leadOwnerId === me && c.status !== "closed" && isWaitingOnUs(c),
|
|
159
|
+
[me]
|
|
160
|
+
);
|
|
161
|
+
const mineCount = React7__default.useMemo(() => conversations.filter(isMineWaiting).length, [conversations, isMineWaiting]);
|
|
152
162
|
const [inbox, setInbox] = React7__default.useState("commercial");
|
|
153
163
|
const inboxes = React7__default.useMemo(() => new Set(conversations.map((c) => c.inbox ?? "commercial")), [conversations]);
|
|
154
164
|
const bothInboxes = inboxes.size > 1;
|
|
@@ -156,8 +166,8 @@ function ConversationList({ className }) {
|
|
|
156
166
|
const shown = React7__default.useMemo(
|
|
157
167
|
// Waiting on us stays pinned on top (newest first among them): a red thread
|
|
158
168
|
// is a contact to make, and it must not sink under newer chatter.
|
|
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]
|
|
169
|
+
() => conversations.filter((c) => !bothInboxes || (c.inbox ?? "commercial") === inbox).filter((c) => !mineOnly || isMineWaiting(c)).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),
|
|
170
|
+
[conversations, archived, bothInboxes, inbox, mineOnly, isMineWaiting]
|
|
161
171
|
);
|
|
162
172
|
const donos = React7__default.useMemo(() => {
|
|
163
173
|
const vistos = /* @__PURE__ */ new Map();
|
|
@@ -199,24 +209,44 @@ function ConversationList({ className }) {
|
|
|
199
209
|
}
|
|
200
210
|
)
|
|
201
211
|
] }),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
204
|
-
return /* @__PURE__ */ jsx(
|
|
212
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap gap-1", children: [
|
|
213
|
+
/* @__PURE__ */ jsxs(
|
|
205
214
|
Button,
|
|
206
215
|
{
|
|
207
216
|
variant: "bare",
|
|
208
217
|
size: "bare",
|
|
209
|
-
onClick: () =>
|
|
210
|
-
title:
|
|
218
|
+
onClick: () => setMineOnly((v) => !v),
|
|
219
|
+
title: "S\xF3 os meus leads esperando resposta",
|
|
211
220
|
className: cn(
|
|
212
|
-
"rounded-full border px-2.5 py-1 text-xs font-medium transition-colors",
|
|
213
|
-
|
|
221
|
+
"inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors",
|
|
222
|
+
mineOnly ? "border-transparent bg-primary text-primary-foreground" : "border-transparent bg-muted text-muted-foreground hover:bg-muted/70"
|
|
214
223
|
),
|
|
215
|
-
children:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx(Inbox, { className: "h-3 w-3" }),
|
|
226
|
+
" Inbox",
|
|
227
|
+
mineCount > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-destructive px-1.5 text-[10px] font-semibold text-destructive-foreground", children: mineCount })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
FILTERS.map((id) => {
|
|
232
|
+
const off = id !== "all" && connected !== void 0 && !connected[id];
|
|
233
|
+
return /* @__PURE__ */ jsx(
|
|
234
|
+
Button,
|
|
235
|
+
{
|
|
236
|
+
variant: "bare",
|
|
237
|
+
size: "bare",
|
|
238
|
+
onClick: () => setChannelFilter(id),
|
|
239
|
+
title: off ? t("conversations.filter.notConnected") : void 0,
|
|
240
|
+
className: cn(
|
|
241
|
+
"rounded-full border px-2.5 py-1 text-xs font-medium transition-colors",
|
|
242
|
+
channelFilter === id ? "border-transparent bg-primary text-primary-foreground" : off ? "border-dashed border-muted-foreground/40 bg-transparent text-muted-foreground hover:bg-muted/50" : "border-transparent bg-muted text-muted-foreground hover:bg-muted/70"
|
|
243
|
+
),
|
|
244
|
+
children: t(`conversations.filter.${id}`)
|
|
245
|
+
},
|
|
246
|
+
id
|
|
247
|
+
);
|
|
248
|
+
})
|
|
249
|
+
] }),
|
|
220
250
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-1", children: [
|
|
221
251
|
donos.length > 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
222
252
|
FilterChip,
|
|
@@ -1865,5 +1895,5 @@ function ConversationsPage({ store, config }) {
|
|
|
1865
1895
|
}
|
|
1866
1896
|
|
|
1867
1897
|
export { ConversationsPage, conversationIdFromPath };
|
|
1868
|
-
//# sourceMappingURL=ConversationsPage-
|
|
1869
|
-
//# sourceMappingURL=ConversationsPage-
|
|
1898
|
+
//# sourceMappingURL=ConversationsPage-AV34J5DY.js.map
|
|
1899
|
+
//# sourceMappingURL=ConversationsPage-AV34J5DY.js.map
|