@adatechnology/conversations-ui 0.4.1 → 0.5.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/README.md +169 -0
- package/dist/{ConversationSimulatorPanel-DnXElfY8.d.ts → ConversationSimulatorPanel-CrfFjiWh.d.ts} +2 -268
- package/dist/{chunk-PJNR6UMN.js → chunk-CBYEHPX6.js} +1 -63
- package/dist/{chunk-HMCOTZAX.js → chunk-HOKNKXIT.js} +1 -1
- package/dist/{chunk-4P5KMWOI.js → chunk-JXJCPN34.js} +327 -522
- package/dist/chunk-MRVFFJEH.js +64 -0
- package/dist/chunk-RJMSM3YA.js +249 -0
- package/dist/chunk-WSFGNR5R.js +55 -0
- package/dist/flows/index.js +5 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +783 -807
- package/dist/participant/index.d.ts +162 -0
- package/dist/participant/index.js +1448 -0
- package/dist/preview/index.d.ts +4 -2
- package/dist/preview/index.js +4 -2
- package/dist/quickReply.types-B4gmZsSr.d.ts +274 -0
- package/dist/styles.css +591 -0
- package/package.json +9 -5
- package/src/ChannelIcon.tsx +2 -0
- package/src/MessageBubble.test.tsx +2 -2
- package/src/MessageText.test.tsx +59 -0
- package/src/MessageText.tsx +20 -12
- package/src/MessageTextCopiedBadge.tsx +7 -0
- package/src/StatusTicks.test.tsx +30 -0
- package/src/StatusTicks.tsx +24 -9
- package/src/buildOutput.test.ts +41 -0
- package/src/channelCapability.test.ts +17 -0
- package/src/conversationChannel.test.ts +30 -1
- package/src/conversationChannel.ts +19 -1
- package/src/participant/ParticipantAttachmentItem.tsx +77 -0
- package/src/participant/ParticipantComposer.test.tsx +97 -0
- package/src/participant/ParticipantComposer.tsx +167 -0
- package/src/participant/ParticipantConversations.test.tsx +90 -0
- package/src/participant/ParticipantConversations.tsx +42 -0
- package/src/participant/ParticipantConversationsScreen.tsx +67 -0
- package/src/participant/ParticipantInbox.test.tsx +147 -0
- package/src/participant/ParticipantInbox.tsx +168 -0
- package/src/participant/ParticipantLoadState.tsx +27 -0
- package/src/participant/ParticipantMessageBubble.test.tsx +165 -0
- package/src/participant/ParticipantMessageBubble.tsx +185 -0
- package/src/participant/ParticipantThread.test.tsx +132 -0
- package/src/participant/ParticipantThread.tsx +174 -0
- package/src/participant/ParticipantThreadScreen.tsx +135 -0
- package/src/participant/bindAttachmentUrlResolver.test.ts +25 -0
- package/src/participant/bindAttachmentUrlResolver.ts +7 -0
- package/src/participant/index.ts +25 -0
- package/src/participant/participant.types.ts +43 -0
- package/src/participant/participantApi.types.ts +59 -0
- package/src/participant/participantAttachmentUrl.test.ts +32 -0
- package/src/participant/participantAttachmentUrl.ts +10 -0
- package/src/participant/participantBubbleActions.test.ts +44 -0
- package/src/participant/participantBubbleActions.ts +40 -0
- package/src/participant/participantDrafts.test.ts +65 -0
- package/src/participant/participantDrafts.ts +50 -0
- package/src/participant/participantFileValidation.test.ts +86 -0
- package/src/participant/participantFileValidation.ts +72 -0
- package/src/participant/participantFixtures.test-helper.ts +41 -0
- package/src/participant/participantGrouping.test.ts +138 -0
- package/src/participant/participantGrouping.ts +77 -0
- package/src/participant/participantInboxState.test.ts +69 -0
- package/src/participant/participantInboxState.ts +74 -0
- package/src/participant/participantLabels.ts +86 -0
- package/src/participant/participantLoadView.test.ts +23 -0
- package/src/participant/participantLoadView.ts +21 -0
- package/src/participant/participantMessages.test.ts +128 -0
- package/src/participant/participantMessages.ts +73 -0
- package/src/participant/participantNewMessages.test.ts +54 -0
- package/src/participant/participantNewMessages.ts +29 -0
- package/src/participant/participantQuickReply.test.ts +23 -0
- package/src/participant/participantQuickReply.ts +6 -0
- package/src/participant/participantScroll.test.ts +69 -0
- package/src/participant/participantScroll.ts +43 -0
- package/src/participant/participantSendController.test.ts +201 -0
- package/src/participant/participantSendController.ts +134 -0
- package/src/participant/participantSendStates.ts +31 -0
- package/src/participant/participantTheme.ts +20 -0
- package/src/participant/participantThreadState.test.ts +75 -0
- package/src/participant/participantThreadState.ts +59 -0
- package/src/participant/shouldMarkRead.test.ts +24 -0
- package/src/participant/shouldMarkRead.ts +16 -0
- package/src/participant/useDocumentVisibility.ts +18 -0
- package/src/participant/useParticipantConversationView.ts +60 -0
- package/src/participant/useParticipantDraft.ts +45 -0
- package/src/participant/useParticipantInbox.ts +57 -0
- package/src/participant/useParticipantMarkRead.ts +26 -0
- package/src/participant/useParticipantRevalidation.ts +36 -0
- package/src/participant/useParticipantSend.ts +84 -0
- package/src/participant/useParticipantThread.ts +116 -0
- package/src/participant/useParticipantThreadScroll.ts +26 -0
- package/src/participant/useStickToBottom.ts +77 -0
- package/src/preview/ConversationSimulatorPanel.tsx +8 -0
- package/src/styles.css +160 -0
- package/src/types.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -2,20 +2,22 @@ import {
|
|
|
2
2
|
TOOLTIP_ATTRIBUTE,
|
|
3
3
|
TooltipLayer,
|
|
4
4
|
WhatsAppMessagePreview
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HOKNKXIT.js";
|
|
6
|
+
import {
|
|
7
|
+
CHAT_TEXT_PRIMARY_CLASS,
|
|
8
|
+
CHAT_TEXT_SECONDARY_CLASS,
|
|
9
|
+
MessageText
|
|
10
|
+
} from "./chunk-WSFGNR5R.js";
|
|
6
11
|
import {
|
|
7
12
|
AudioPlayer,
|
|
8
13
|
AudioRecorderButton,
|
|
9
14
|
AudioTranscription,
|
|
10
|
-
CHANNEL_CAPABILITIES,
|
|
11
|
-
CHANNEL_FILTER_ALL,
|
|
12
15
|
COMPOSER_BAR_CLASS,
|
|
13
16
|
COMPOSER_COMPACT_WIDTH,
|
|
14
17
|
COMPOSER_MONOSPACE_CLASS,
|
|
15
18
|
COMPOSER_TOOL_BUTTON_ACTIVE_CLASS,
|
|
16
19
|
COMPOSER_TOOL_BUTTON_CLASS,
|
|
17
20
|
COMPOSER_TOOL_BUTTON_IDLE_CLASS,
|
|
18
|
-
CONVERSATION_CHANNEL,
|
|
19
21
|
ConversationDocumentsPanel,
|
|
20
22
|
ConversationLocalesProvider,
|
|
21
23
|
ConversationSimulatorPanel,
|
|
@@ -23,7 +25,6 @@ import {
|
|
|
23
25
|
ConversationsProvider,
|
|
24
26
|
DEFAULT_ACCEPTED_FILE_TYPES,
|
|
25
27
|
DEFAULT_AUDIO_RECORDER_BUTTON_LABELS,
|
|
26
|
-
DEFAULT_CONVERSATION_CHANNEL,
|
|
27
28
|
DEFAULT_CONVERSATION_DOCUMENTS_LABELS,
|
|
28
29
|
DEFAULT_DOCUMENTS_LIBRARY_LABELS,
|
|
29
30
|
DEFAULT_EMOJI_PICKER_LABELS,
|
|
@@ -39,7 +40,6 @@ import {
|
|
|
39
40
|
EMOJI_CATEGORIES,
|
|
40
41
|
EmojiPicker,
|
|
41
42
|
FileIcon,
|
|
42
|
-
HANDLE_KIND,
|
|
43
43
|
InteractiveMessage,
|
|
44
44
|
Lightbox,
|
|
45
45
|
MediaRenderer,
|
|
@@ -48,27 +48,14 @@ import {
|
|
|
48
48
|
PAGINATION_LABELS,
|
|
49
49
|
QUICK_REPLY_PILL_CLASS,
|
|
50
50
|
QuickRepliesPicker,
|
|
51
|
-
REOPEN_MECHANISM,
|
|
52
|
-
StatusTicks,
|
|
53
51
|
applyQuickReplyVariables,
|
|
54
|
-
capabilitiesOf,
|
|
55
|
-
channelCapabilityFor,
|
|
56
|
-
channelFiltersFor,
|
|
57
|
-
contactFlag,
|
|
58
52
|
conversationsOf,
|
|
59
53
|
createMediaUrlResolver,
|
|
60
54
|
detectQuickReplyShortcut,
|
|
61
55
|
documentTypeLabel,
|
|
62
56
|
filterQuickReplies,
|
|
63
|
-
formatContactHandle,
|
|
64
|
-
formatDateTime,
|
|
65
|
-
formatFileSize,
|
|
66
|
-
formatPhone,
|
|
67
|
-
formatTimestamp,
|
|
68
57
|
highlightMatch,
|
|
69
|
-
isSameDay,
|
|
70
58
|
normalizeForSearch,
|
|
71
|
-
phoneInitials,
|
|
72
59
|
resolveQuickReply,
|
|
73
60
|
searchEmojis,
|
|
74
61
|
totalOf,
|
|
@@ -77,17 +64,39 @@ import {
|
|
|
77
64
|
useConversationLocales,
|
|
78
65
|
useConversations,
|
|
79
66
|
useQuickRepliesPicker
|
|
80
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-JXJCPN34.js";
|
|
81
68
|
import {
|
|
82
|
-
ZERO_WIDTH_SPACE,
|
|
83
69
|
cn,
|
|
70
|
+
useDarkMode,
|
|
71
|
+
useIsDarkTheme
|
|
72
|
+
} from "./chunk-MRVFFJEH.js";
|
|
73
|
+
import {
|
|
74
|
+
CHANNEL_CAPABILITIES,
|
|
75
|
+
CHANNEL_FILTER_ALL,
|
|
76
|
+
CONVERSATION_CHANNEL,
|
|
77
|
+
DEFAULT_CONVERSATION_CHANNEL,
|
|
78
|
+
HANDLE_KIND,
|
|
79
|
+
REOPEN_MECHANISM,
|
|
80
|
+
StatusTicks,
|
|
81
|
+
capabilitiesOf,
|
|
82
|
+
channelCapabilityFor,
|
|
83
|
+
channelFiltersFor,
|
|
84
|
+
contactFlag,
|
|
85
|
+
formatContactHandle,
|
|
86
|
+
formatDateTime,
|
|
87
|
+
formatFileSize,
|
|
88
|
+
formatPhone,
|
|
89
|
+
formatTimestamp,
|
|
90
|
+
isSameDay,
|
|
91
|
+
phoneInitials
|
|
92
|
+
} from "./chunk-RJMSM3YA.js";
|
|
93
|
+
import {
|
|
94
|
+
ZERO_WIDTH_SPACE,
|
|
84
95
|
htmlToWA,
|
|
85
96
|
parseWhatsAppFormatting,
|
|
86
|
-
useDarkMode,
|
|
87
|
-
useIsDarkTheme,
|
|
88
97
|
waToHTML,
|
|
89
98
|
waToHTMLInline
|
|
90
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-CBYEHPX6.js";
|
|
91
100
|
|
|
92
101
|
// src/RichMessageComposer.tsx
|
|
93
102
|
import {
|
|
@@ -1072,12 +1081,6 @@ function Avatar({ name, avatarUrl, size = "md", className = "", labels }) {
|
|
|
1072
1081
|
|
|
1073
1082
|
// src/ConversationListItem.tsx
|
|
1074
1083
|
import { useMemo } from "react";
|
|
1075
|
-
|
|
1076
|
-
// src/theme.ts
|
|
1077
|
-
var CHAT_TEXT_PRIMARY_CLASS = "text-[#111b21] dark:text-[#e9edef]";
|
|
1078
|
-
var CHAT_TEXT_SECONDARY_CLASS = "text-[#667781] dark:text-[#8696a0]";
|
|
1079
|
-
|
|
1080
|
-
// src/ConversationListItem.tsx
|
|
1081
1084
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1082
1085
|
var DEFAULT_CONVERSATION_LIST_ITEM_LABELS = {
|
|
1083
1086
|
expiredWindow: "Janela expirada",
|
|
@@ -1314,50 +1317,21 @@ function useToast() {
|
|
|
1314
1317
|
return context;
|
|
1315
1318
|
}
|
|
1316
1319
|
|
|
1317
|
-
// src/MessageText.tsx
|
|
1318
|
-
import { useCallback as useCallback3, useState as useState5 } from "react";
|
|
1319
|
-
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1320
|
-
function MessageText({ message }) {
|
|
1321
|
-
const [copied, setCopied] = useState5(false);
|
|
1322
|
-
const handleCopy = useCallback3(async () => {
|
|
1323
|
-
if (!message.content) return;
|
|
1324
|
-
try {
|
|
1325
|
-
await navigator.clipboard.writeText(message.content);
|
|
1326
|
-
setCopied(true);
|
|
1327
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
1328
|
-
} catch {
|
|
1329
|
-
}
|
|
1330
|
-
}, [message.content]);
|
|
1331
|
-
if (message.type === "template")
|
|
1332
|
-
return /* @__PURE__ */ jsx7("p", { className: `text-sm italic ${CHAT_TEXT_SECONDARY_CLASS}`, children: message.content ?? "Template message" });
|
|
1333
|
-
return /* @__PURE__ */ jsxs6(
|
|
1334
|
-
"div",
|
|
1335
|
-
{
|
|
1336
|
-
onClick: handleCopy,
|
|
1337
|
-
className: "text-[14.2px] leading-[19px] whitespace-pre-wrap break-words select-all [&_strong]:font-bold [&_em]:italic [&_del]:line-through",
|
|
1338
|
-
children: [
|
|
1339
|
-
/* @__PURE__ */ jsx7("div", { children: parseWhatsAppFormatting(message.content ?? "") }),
|
|
1340
|
-
copied && /* @__PURE__ */ jsx7("span", { className: "absolute top-0 right-0 -translate-y-full bg-[#3b4a54] text-white text-[11px] px-1.5 py-0.5 rounded shadow-lg", children: "Copiado!" })
|
|
1341
|
-
]
|
|
1342
|
-
}
|
|
1343
|
-
);
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
1320
|
// src/MessageTimestamp.tsx
|
|
1347
|
-
import { jsx as
|
|
1321
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1348
1322
|
function MessageTimestamp({ timestamp, status, isOutbound }) {
|
|
1349
|
-
return /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
isOutbound && status && /* @__PURE__ */
|
|
1323
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-end gap-[3px]", children: [
|
|
1324
|
+
/* @__PURE__ */ jsx7("span", { className: `text-[11px] ${CHAT_TEXT_SECONDARY_CLASS} leading-[15px] select-none`, children: timestamp }),
|
|
1325
|
+
isOutbound && status && /* @__PURE__ */ jsx7("span", { className: "flex items-center -mr-[2px]", children: /* @__PURE__ */ jsx7(StatusTicks, { status }) })
|
|
1352
1326
|
] });
|
|
1353
1327
|
}
|
|
1354
1328
|
|
|
1355
1329
|
// src/MessageTail.tsx
|
|
1356
|
-
import { jsx as
|
|
1330
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1357
1331
|
function MessageTail({ isOutbound }) {
|
|
1358
1332
|
if (isOutbound)
|
|
1359
|
-
return /* @__PURE__ */
|
|
1360
|
-
return /* @__PURE__ */
|
|
1333
|
+
return /* @__PURE__ */ jsx8("svg", { className: "absolute top-0 -right-[5px] w-[5px] h-[11px]", viewBox: "0 0 5 11", fill: "#d9fdd3", children: /* @__PURE__ */ jsx8("path", { d: "M5 0H0v11c1.5-2 4.5-2 5-4V0z" }) });
|
|
1334
|
+
return /* @__PURE__ */ jsx8("svg", { className: "absolute top-0 -left-[5px] w-[5px] h-[11px]", viewBox: "0 0 5 11", fill: "white", children: /* @__PURE__ */ jsx8("path", { d: "M0 0h5v11C3.5 9 .5 9 0 7V0z" }) });
|
|
1361
1335
|
}
|
|
1362
1336
|
|
|
1363
1337
|
// src/conversationWindow.ts
|
|
@@ -1434,20 +1408,22 @@ var ICON_SIZE_INLINE = 14;
|
|
|
1434
1408
|
var ICON_SIZE_ACTION = 16;
|
|
1435
1409
|
|
|
1436
1410
|
// src/ChannelIcon.tsx
|
|
1437
|
-
import { Fragment as Fragment3, jsx as
|
|
1411
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1438
1412
|
var CHANNEL_BRAND_COLOR = {
|
|
1439
1413
|
[CONVERSATION_CHANNEL.WHATSAPP]: "#25D366",
|
|
1440
1414
|
[CONVERSATION_CHANNEL.MESSENGER]: "#0084FF",
|
|
1441
1415
|
[CONVERSATION_CHANNEL.INSTAGRAM]: "#E4405F",
|
|
1416
|
+
[CONVERSATION_CHANNEL.APP]: "#7C3AED",
|
|
1417
|
+
[CONVERSATION_CHANNEL.PORTAL]: "#0F766E",
|
|
1442
1418
|
[CONVERSATION_CHANNEL.WEBCHAT]: "#64748B",
|
|
1443
1419
|
[CONVERSATION_CHANNEL.EMAIL]: "#EA4335"
|
|
1444
1420
|
};
|
|
1445
1421
|
function Glyph({ channel }) {
|
|
1446
1422
|
const color = CHANNEL_BRAND_COLOR[channel];
|
|
1447
1423
|
if (channel === CONVERSATION_CHANNEL.WHATSAPP) {
|
|
1448
|
-
return /* @__PURE__ */
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
/* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1425
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1426
|
+
/* @__PURE__ */ jsx9(
|
|
1451
1427
|
"path",
|
|
1452
1428
|
{
|
|
1453
1429
|
d: "M8.6 7.2c.3-.1.7 0 .9.3l1 1.6c.2.3.1.7-.1.9l-.7.7c.6 1.3 1.6 2.3 2.9 2.9l.7-.7c.2-.2.6-.3.9-.1l1.6 1c.3.2.4.6.3.9-.4 1-1.4 1.6-2.4 1.4-3-.5-5.4-2.9-5.9-5.9-.2-1 .4-2 1.4-2.4Z",
|
|
@@ -1457,34 +1433,34 @@ function Glyph({ channel }) {
|
|
|
1457
1433
|
] });
|
|
1458
1434
|
}
|
|
1459
1435
|
if (channel === CONVERSATION_CHANNEL.MESSENGER) {
|
|
1460
|
-
return /* @__PURE__ */
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1437
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1438
|
+
/* @__PURE__ */ jsx9("path", { d: "M6.5 15.5 11 10.8l2.4 2.4L17.5 9l-4.6 4.9-2.4-2.4-4 4Z", fill: "#fff", stroke: "#fff", strokeWidth: "1.4", strokeLinejoin: "round" })
|
|
1463
1439
|
] });
|
|
1464
1440
|
}
|
|
1465
1441
|
if (channel === CONVERSATION_CHANNEL.INSTAGRAM) {
|
|
1466
|
-
return /* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1443
|
+
/* @__PURE__ */ jsx9("rect", { x: "2", y: "2", width: "20", height: "20", rx: "6", fill: color }),
|
|
1444
|
+
/* @__PURE__ */ jsx9("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "3.5", fill: "none", stroke: "#fff", strokeWidth: "1.6" }),
|
|
1445
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "2.6", fill: "none", stroke: "#fff", strokeWidth: "1.6" }),
|
|
1446
|
+
/* @__PURE__ */ jsx9("circle", { cx: "16.4", cy: "7.6", r: "1", fill: "#fff" })
|
|
1471
1447
|
] });
|
|
1472
1448
|
}
|
|
1473
1449
|
if (channel === CONVERSATION_CHANNEL.EMAIL) {
|
|
1474
|
-
return /* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1450
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1451
|
+
/* @__PURE__ */ jsx9("rect", { x: "2", y: "4", width: "20", height: "16", rx: "3", fill: color }),
|
|
1452
|
+
/* @__PURE__ */ jsx9("path", { d: "M3.5 6.5 12 13l8.5-6.5", fill: "none", stroke: "#fff", strokeWidth: "1.6", strokeLinejoin: "round", strokeLinecap: "round" })
|
|
1477
1453
|
] });
|
|
1478
1454
|
}
|
|
1479
|
-
return /* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1456
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1457
|
+
/* @__PURE__ */ jsx9("path", { d: "M6.5 8.5h11v7h-5.5L8.5 18v-2.5h-2v-7Z", fill: "#fff" })
|
|
1482
1458
|
] });
|
|
1483
1459
|
}
|
|
1484
1460
|
function ChannelIcon({ channel, size = 14, className = "" }) {
|
|
1485
1461
|
const resolved = channel ?? CONVERSATION_CHANNEL.WHATSAPP;
|
|
1486
1462
|
const { label } = capabilitiesOf(resolved);
|
|
1487
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ jsx9(
|
|
1488
1464
|
"svg",
|
|
1489
1465
|
{
|
|
1490
1466
|
viewBox: "0 0 24 24",
|
|
@@ -1493,13 +1469,13 @@ function ChannelIcon({ channel, size = 14, className = "" }) {
|
|
|
1493
1469
|
className: `inline-block shrink-0 ${className}`.trim(),
|
|
1494
1470
|
role: "img",
|
|
1495
1471
|
"aria-label": label,
|
|
1496
|
-
children: /* @__PURE__ */
|
|
1472
|
+
children: /* @__PURE__ */ jsx9(Glyph, { channel: resolved })
|
|
1497
1473
|
}
|
|
1498
1474
|
);
|
|
1499
1475
|
}
|
|
1500
1476
|
|
|
1501
1477
|
// src/ConversationRow.tsx
|
|
1502
|
-
import { jsx as
|
|
1478
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1503
1479
|
var WINDOW_TITLE = {
|
|
1504
1480
|
[CONVERSATION_WINDOW.ALL]: "",
|
|
1505
1481
|
[CONVERSATION_WINDOW.FRESH]: "Janela de 24h aberta (menos de 12h)",
|
|
@@ -1543,8 +1519,8 @@ function ConversationRow({
|
|
|
1543
1519
|
lastInboundAt: conversation.lastInboundAt,
|
|
1544
1520
|
now
|
|
1545
1521
|
});
|
|
1546
|
-
return /* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("cv-row flex border-b", active && "cv-row--active", classNames?.root, className), children: [
|
|
1523
|
+
/* @__PURE__ */ jsx10(
|
|
1548
1524
|
"span",
|
|
1549
1525
|
{
|
|
1550
1526
|
className: cn("w-1 shrink-0", WINDOW_BAR_CLASS[window2], classNames?.windowBar),
|
|
@@ -1552,9 +1528,9 @@ function ConversationRow({
|
|
|
1552
1528
|
"aria-label": WINDOW_TITLE[window2]
|
|
1553
1529
|
}
|
|
1554
1530
|
),
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
/* @__PURE__ */
|
|
1531
|
+
/* @__PURE__ */ jsxs8("div", { className: "min-w-0 flex-1", children: [
|
|
1532
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-start gap-2 px-2 pt-2", children: [
|
|
1533
|
+
/* @__PURE__ */ jsx10(
|
|
1558
1534
|
"input",
|
|
1559
1535
|
{
|
|
1560
1536
|
type: "checkbox",
|
|
@@ -1564,7 +1540,7 @@ function ConversationRow({
|
|
|
1564
1540
|
className: "mt-3"
|
|
1565
1541
|
}
|
|
1566
1542
|
),
|
|
1567
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ jsx10("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx10(
|
|
1568
1544
|
ConversationListItem,
|
|
1569
1545
|
{
|
|
1570
1546
|
conversation,
|
|
@@ -1575,37 +1551,37 @@ function ConversationRow({
|
|
|
1575
1551
|
}
|
|
1576
1552
|
) })
|
|
1577
1553
|
] }),
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-1.5 px-4 pb-2 pl-8", children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs8("span", { className: "cv-pill", children: [
|
|
1556
|
+
/* @__PURE__ */ jsx10(ChannelIcon, { channel: conversation.channel }),
|
|
1581
1557
|
" ",
|
|
1582
1558
|
capabilities.label
|
|
1583
1559
|
] }),
|
|
1584
|
-
conversation.mode === "human" ? /* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1560
|
+
conversation.mode === "human" ? /* @__PURE__ */ jsxs8("span", { className: "cv-pill cv-pill--success", children: [
|
|
1561
|
+
/* @__PURE__ */ jsx10(UserRound, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1586
1562
|
" em atendimento"
|
|
1587
1563
|
] }) : null,
|
|
1588
|
-
isWaiting ? /* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */
|
|
1564
|
+
isWaiting ? /* @__PURE__ */ jsxs8("span", { className: "cv-pill cv-pill--warning", children: [
|
|
1565
|
+
/* @__PURE__ */ jsx10(Hourglass, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1590
1566
|
" aguardando atendimento"
|
|
1591
1567
|
] }) : null,
|
|
1592
|
-
!isWaiting && conversation.mode === "bot" ? /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1568
|
+
!isWaiting && conversation.mode === "bot" ? /* @__PURE__ */ jsxs8("span", { className: "cv-pill", children: [
|
|
1569
|
+
/* @__PURE__ */ jsx10(Bot, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1594
1570
|
" bot ativo"
|
|
1595
1571
|
] }) : null,
|
|
1596
|
-
replyLatency ? /* @__PURE__ */
|
|
1597
|
-
/* @__PURE__ */
|
|
1572
|
+
replyLatency ? /* @__PURE__ */ jsxs8("span", { className: cn("cv-pill", REPLY_LATENCY_PILL_CLASS[replyLatency]), children: [
|
|
1573
|
+
/* @__PURE__ */ jsx10(AlarmClock, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1598
1574
|
" sem resposta h\xE1",
|
|
1599
1575
|
" ",
|
|
1600
1576
|
formatStalledFor(conversation.lastInboundAt ?? conversation.lastAt, now)
|
|
1601
1577
|
] }) : null,
|
|
1602
|
-
isStalled ? /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1578
|
+
isStalled ? /* @__PURE__ */ jsxs8("span", { className: "cv-pill cv-pill--danger", children: [
|
|
1579
|
+
/* @__PURE__ */ jsx10(AlarmClock, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1604
1580
|
" parada h\xE1",
|
|
1605
1581
|
" ",
|
|
1606
1582
|
formatStalledFor(conversation.lastAt, now)
|
|
1607
1583
|
] }) : null,
|
|
1608
|
-
isWaiting ? /* @__PURE__ */
|
|
1584
|
+
isWaiting ? /* @__PURE__ */ jsxs8(
|
|
1609
1585
|
"button",
|
|
1610
1586
|
{
|
|
1611
1587
|
type: "button",
|
|
@@ -1615,7 +1591,7 @@ function ConversationRow({
|
|
|
1615
1591
|
"aria-label": TAKEOVER_LABEL,
|
|
1616
1592
|
className: "cv-header-action",
|
|
1617
1593
|
children: [
|
|
1618
|
-
/* @__PURE__ */
|
|
1594
|
+
/* @__PURE__ */ jsx10(Play, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
1619
1595
|
" ",
|
|
1620
1596
|
TAKEOVER_LABEL
|
|
1621
1597
|
]
|
|
@@ -1627,9 +1603,9 @@ function ConversationRow({
|
|
|
1627
1603
|
}
|
|
1628
1604
|
|
|
1629
1605
|
// src/ConversationHeader.tsx
|
|
1630
|
-
import { useRef as useRef4, useState as
|
|
1606
|
+
import { useRef as useRef4, useState as useState5 } from "react";
|
|
1631
1607
|
import { ArrowLeft, Bot as Bot2, Download, FileText, Headset, MoreVertical, UserRound as UserRound2, X } from "lucide-react";
|
|
1632
|
-
import { jsx as
|
|
1608
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1633
1609
|
var HEADER_UTILITIES_MIN_WIDTH = 720;
|
|
1634
1610
|
var HEADER_ACTIONS_MIN_WIDTH = 600;
|
|
1635
1611
|
var DEFAULT_CONVERSATION_HEADER_LABELS = {
|
|
@@ -1666,7 +1642,7 @@ function ConversationHeader({
|
|
|
1666
1642
|
const displayHandle = formatContactHandle({ handle, channel: conversation.channel });
|
|
1667
1643
|
const flag = contactFlag({ handle, channel: conversation.channel });
|
|
1668
1644
|
const capabilities = capabilitiesOf(conversation.channel);
|
|
1669
|
-
const [menuOpen, setMenuOpen] =
|
|
1645
|
+
const [menuOpen, setMenuOpen] = useState5(false);
|
|
1670
1646
|
const headerRef = useRef4(null);
|
|
1671
1647
|
const headerWidth = useContainerWidth(headerRef);
|
|
1672
1648
|
const showsUtilitiesInline = headerWidth === void 0 || headerWidth >= HEADER_UTILITIES_MIN_WIDTH;
|
|
@@ -1674,14 +1650,14 @@ function ConversationHeader({
|
|
|
1674
1650
|
const utilityCandidates = [
|
|
1675
1651
|
onOpenDocuments ? {
|
|
1676
1652
|
key: "documents",
|
|
1677
|
-
icon: /* @__PURE__ */
|
|
1653
|
+
icon: /* @__PURE__ */ jsx11(FileText, { size: ICON_SIZE_ACTION }),
|
|
1678
1654
|
label: labels.documents,
|
|
1679
1655
|
run: onOpenDocuments,
|
|
1680
1656
|
active: documentsOpen
|
|
1681
1657
|
} : void 0,
|
|
1682
1658
|
onDownload ? {
|
|
1683
1659
|
key: "download",
|
|
1684
|
-
icon: /* @__PURE__ */
|
|
1660
|
+
icon: /* @__PURE__ */ jsx11(Download, { size: ICON_SIZE_ACTION }),
|
|
1685
1661
|
label: labels.download,
|
|
1686
1662
|
run: onDownload,
|
|
1687
1663
|
active: false
|
|
@@ -1692,7 +1668,7 @@ function ConversationHeader({
|
|
|
1692
1668
|
const actionCandidates = [
|
|
1693
1669
|
!isHuman && onTakeover ? {
|
|
1694
1670
|
key: "takeover",
|
|
1695
|
-
icon: /* @__PURE__ */
|
|
1671
|
+
icon: /* @__PURE__ */ jsx11(Headset, { size: ICON_SIZE_ACTION }),
|
|
1696
1672
|
label: labels.takeover,
|
|
1697
1673
|
hint: labels.takeover,
|
|
1698
1674
|
run: onTakeover,
|
|
@@ -1700,7 +1676,7 @@ function ConversationHeader({
|
|
|
1700
1676
|
} : void 0,
|
|
1701
1677
|
isHuman && onReturnToBot ? {
|
|
1702
1678
|
key: "release",
|
|
1703
|
-
icon: /* @__PURE__ */
|
|
1679
|
+
icon: /* @__PURE__ */ jsx11(Bot2, { size: ICON_SIZE_ACTION }),
|
|
1704
1680
|
label: labels.returnToBot,
|
|
1705
1681
|
hint: labels.returnToBot,
|
|
1706
1682
|
run: onReturnToBot,
|
|
@@ -1708,7 +1684,7 @@ function ConversationHeader({
|
|
|
1708
1684
|
} : void 0,
|
|
1709
1685
|
isHuman && onFinish ? {
|
|
1710
1686
|
key: "finish",
|
|
1711
|
-
icon: /* @__PURE__ */
|
|
1687
|
+
icon: /* @__PURE__ */ jsx11(X, { size: ICON_SIZE_ACTION }),
|
|
1712
1688
|
label: labels.finish,
|
|
1713
1689
|
hint: labels.finish,
|
|
1714
1690
|
run: onFinish,
|
|
@@ -1727,7 +1703,7 @@ function ConversationHeader({
|
|
|
1727
1703
|
})),
|
|
1728
1704
|
...showsActionsInline ? [] : actions
|
|
1729
1705
|
];
|
|
1730
|
-
return /* @__PURE__ */
|
|
1706
|
+
return /* @__PURE__ */ jsxs9(
|
|
1731
1707
|
"header",
|
|
1732
1708
|
{
|
|
1733
1709
|
ref: headerRef,
|
|
@@ -1737,37 +1713,37 @@ function ConversationHeader({
|
|
|
1737
1713
|
className
|
|
1738
1714
|
),
|
|
1739
1715
|
children: [
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
onBack ? /* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ jsxs9("div", { className: cn("flex min-w-0 flex-1 items-center gap-3", classNames?.identity), children: [
|
|
1717
|
+
onBack ? /* @__PURE__ */ jsx11("button", { type: "button", onClick: onBack, className: "cv-back cv-touch", "aria-label": labels.back, "data-cv-tooltip": labels.back, children: /* @__PURE__ */ jsx11(ArrowLeft, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }) }) : null,
|
|
1718
|
+
/* @__PURE__ */ jsx11(Avatar, { name: conversation.clientName, size: "md" }),
|
|
1719
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
|
|
1720
|
+
/* @__PURE__ */ jsx11("p", { className: cn("truncate font-medium", classNames?.name), children: conversation.clientName ?? displayHandle }),
|
|
1721
|
+
/* @__PURE__ */ jsxs9("p", { className: cn("flex min-w-0 flex-nowrap items-center gap-2 overflow-hidden text-xs text-gray-500", classNames?.meta), children: [
|
|
1722
|
+
/* @__PURE__ */ jsxs9("span", { className: "truncate", children: [
|
|
1747
1723
|
flag ? `${flag} ` : "",
|
|
1748
1724
|
displayHandle
|
|
1749
1725
|
] }),
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
showsUtilitiesInline ? /* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-shrink-0 items-center gap-1", children: [
|
|
1727
|
+
/* @__PURE__ */ jsx11(ChannelIcon, { channel: conversation.channel }),
|
|
1728
|
+
showsUtilitiesInline ? /* @__PURE__ */ jsx11("span", { children: capabilities.label }) : null
|
|
1753
1729
|
] }),
|
|
1754
|
-
/* @__PURE__ */
|
|
1730
|
+
/* @__PURE__ */ jsxs9(
|
|
1755
1731
|
"span",
|
|
1756
1732
|
{
|
|
1757
1733
|
className: "inline-flex flex-shrink-0 items-center gap-1",
|
|
1758
1734
|
...showsUtilitiesInline ? {} : { role: "img", "aria-label": isHuman ? labels.humanMode : labels.botMode, "data-cv-tooltip": isHuman ? labels.humanMode : labels.botMode },
|
|
1759
1735
|
children: [
|
|
1760
|
-
isHuman ? /* @__PURE__ */
|
|
1761
|
-
showsUtilitiesInline ? /* @__PURE__ */
|
|
1736
|
+
isHuman ? /* @__PURE__ */ jsx11(UserRound2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }) : /* @__PURE__ */ jsx11(Bot2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
1737
|
+
showsUtilitiesInline ? /* @__PURE__ */ jsx11("span", { children: isHuman ? labels.humanMode : labels.botMode }) : null
|
|
1762
1738
|
]
|
|
1763
1739
|
}
|
|
1764
1740
|
)
|
|
1765
1741
|
] })
|
|
1766
1742
|
] })
|
|
1767
1743
|
] }),
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
(showsUtilitiesInline ? utilities : []).map((utility) => /* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ jsxs9("div", { className: cn("flex shrink-0 items-center gap-2", classNames?.actions), children: [
|
|
1745
|
+
/* @__PURE__ */ jsxs9("div", { className: cn("flex items-center gap-2", classNames?.desktopActions), children: [
|
|
1746
|
+
(showsUtilitiesInline ? utilities : []).map((utility) => /* @__PURE__ */ jsx11(
|
|
1771
1747
|
"button",
|
|
1772
1748
|
{
|
|
1773
1749
|
type: "button",
|
|
@@ -1781,7 +1757,7 @@ function ConversationHeader({
|
|
|
1781
1757
|
},
|
|
1782
1758
|
utility.key
|
|
1783
1759
|
)),
|
|
1784
|
-
(showsActionsInline ? actions : []).map((action) => /* @__PURE__ */
|
|
1760
|
+
(showsActionsInline ? actions : []).map((action) => /* @__PURE__ */ jsxs9(
|
|
1785
1761
|
"button",
|
|
1786
1762
|
{
|
|
1787
1763
|
type: "button",
|
|
@@ -1798,8 +1774,8 @@ function ConversationHeader({
|
|
|
1798
1774
|
action.key
|
|
1799
1775
|
))
|
|
1800
1776
|
] }),
|
|
1801
|
-
menuItems.length > 0 ? /* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1777
|
+
menuItems.length > 0 ? /* @__PURE__ */ jsxs9("div", { className: cn("cv-menu", classNames?.mobileMenu), children: [
|
|
1778
|
+
/* @__PURE__ */ jsx11(
|
|
1803
1779
|
"button",
|
|
1804
1780
|
{
|
|
1805
1781
|
type: "button",
|
|
@@ -1808,10 +1784,10 @@ function ConversationHeader({
|
|
|
1808
1784
|
"aria-label": labels.moreActions,
|
|
1809
1785
|
"data-cv-tooltip": labels.moreActions,
|
|
1810
1786
|
className: "cv-header-icon cv-touch",
|
|
1811
|
-
children: /* @__PURE__ */
|
|
1787
|
+
children: /* @__PURE__ */ jsx11(MoreVertical, { size: ICON_SIZE_ACTION, "aria-hidden": "true" })
|
|
1812
1788
|
}
|
|
1813
1789
|
),
|
|
1814
|
-
menuOpen ? /* @__PURE__ */
|
|
1790
|
+
menuOpen ? /* @__PURE__ */ jsx11("div", { className: "cv-menu-panel", role: "menu", children: menuItems.map((item) => /* @__PURE__ */ jsxs9(
|
|
1815
1791
|
"button",
|
|
1816
1792
|
{
|
|
1817
1793
|
type: "button",
|
|
@@ -1839,14 +1815,14 @@ function ConversationHeader({
|
|
|
1839
1815
|
}
|
|
1840
1816
|
|
|
1841
1817
|
// src/ConversationContextPanel.tsx
|
|
1842
|
-
import { useState as
|
|
1818
|
+
import { useState as useState7 } from "react";
|
|
1843
1819
|
import { Check, ChevronDown, ChevronUp, Clock, Pencil } from "lucide-react";
|
|
1844
1820
|
|
|
1845
1821
|
// src/useIsNarrow.ts
|
|
1846
|
-
import { useEffect as useEffect5, useState as
|
|
1822
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
1847
1823
|
var NARROW_MAX_WIDTH_PX = 1023;
|
|
1848
1824
|
function useIsNarrow() {
|
|
1849
|
-
const [isNarrow, setIsNarrow] =
|
|
1825
|
+
const [isNarrow, setIsNarrow] = useState6(
|
|
1850
1826
|
() => typeof window !== "undefined" && window.matchMedia(`(max-width: ${NARROW_MAX_WIDTH_PX}px)`).matches
|
|
1851
1827
|
);
|
|
1852
1828
|
useEffect5(() => {
|
|
@@ -1860,7 +1836,7 @@ function useIsNarrow() {
|
|
|
1860
1836
|
}
|
|
1861
1837
|
|
|
1862
1838
|
// src/ConversationContextPanel.tsx
|
|
1863
|
-
import { jsx as
|
|
1839
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1864
1840
|
var DEFAULT_CONVERSATION_CONTEXT_LABELS = {
|
|
1865
1841
|
title: "Suas Sele\xE7\xF5es",
|
|
1866
1842
|
empty: "Nada coletado ainda nesta conversa.",
|
|
@@ -1884,9 +1860,9 @@ var GLYPH_STYLE = {
|
|
|
1884
1860
|
};
|
|
1885
1861
|
function StatusGlyph({ status }) {
|
|
1886
1862
|
const size = 11;
|
|
1887
|
-
if (status === "completed") return /* @__PURE__ */
|
|
1888
|
-
if (status === "editing") return /* @__PURE__ */
|
|
1889
|
-
return /* @__PURE__ */
|
|
1863
|
+
if (status === "completed") return /* @__PURE__ */ jsx12(Check, { size, "aria-hidden": true });
|
|
1864
|
+
if (status === "editing") return /* @__PURE__ */ jsx12(Pencil, { size, "aria-hidden": true });
|
|
1865
|
+
return /* @__PURE__ */ jsx12(Clock, { size, "aria-hidden": true });
|
|
1890
1866
|
}
|
|
1891
1867
|
function CountPill({
|
|
1892
1868
|
status,
|
|
@@ -1894,8 +1870,8 @@ function CountPill({
|
|
|
1894
1870
|
className
|
|
1895
1871
|
}) {
|
|
1896
1872
|
if (count === 0) return null;
|
|
1897
|
-
return /* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
1873
|
+
return /* @__PURE__ */ jsxs10("span", { className: cn("flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium", className), children: [
|
|
1874
|
+
/* @__PURE__ */ jsx12(StatusGlyph, { status }),
|
|
1899
1875
|
count
|
|
1900
1876
|
] });
|
|
1901
1877
|
}
|
|
@@ -1911,12 +1887,12 @@ function ConversationContextPanel({
|
|
|
1911
1887
|
const counts = { completed: 0, pending: 0, editing: 0 };
|
|
1912
1888
|
for (const entry of entries) counts[statusOf(entry)] += 1;
|
|
1913
1889
|
const isNarrow = useIsNarrow();
|
|
1914
|
-
const [manualOpen, setManualOpen] =
|
|
1890
|
+
const [manualOpen, setManualOpen] = useState7(void 0);
|
|
1915
1891
|
const open = manualOpen ?? defaultOpen ?? (!isNarrow && counts.completed > 0);
|
|
1916
1892
|
return (
|
|
1917
1893
|
// Faixa azul clara com separador, como o wrapper do financiamento: sem ela o card encostava
|
|
1918
1894
|
// direto no papel de parede da conversa e os dois blocos se misturavam.
|
|
1919
|
-
/* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ jsx12("div", { className: cn("border-b bg-blue-50/60 px-3 py-3 dark:border-gray-700 dark:bg-blue-950/20", className), children: /* @__PURE__ */ jsxs10(
|
|
1920
1896
|
"section",
|
|
1921
1897
|
{
|
|
1922
1898
|
className: cn(
|
|
@@ -1924,7 +1900,7 @@ function ConversationContextPanel({
|
|
|
1924
1900
|
classNames?.root
|
|
1925
1901
|
),
|
|
1926
1902
|
children: [
|
|
1927
|
-
/* @__PURE__ */
|
|
1903
|
+
/* @__PURE__ */ jsxs10(
|
|
1928
1904
|
"button",
|
|
1929
1905
|
{
|
|
1930
1906
|
type: "button",
|
|
@@ -1937,11 +1913,11 @@ function ConversationContextPanel({
|
|
|
1937
1913
|
classNames?.toggle
|
|
1938
1914
|
),
|
|
1939
1915
|
children: [
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */
|
|
1942
|
-
/* @__PURE__ */
|
|
1943
|
-
flowLabel ? /* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
1916
|
+
/* @__PURE__ */ jsxs10("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1917
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u{1F4CB}" }),
|
|
1918
|
+
/* @__PURE__ */ jsx12("span", { className: "truncate text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.title }),
|
|
1919
|
+
flowLabel ? /* @__PURE__ */ jsx12("span", { className: "truncate text-xs font-medium text-blue-600 dark:text-blue-400", children: flowLabel }) : null,
|
|
1920
|
+
/* @__PURE__ */ jsx12(
|
|
1945
1921
|
"span",
|
|
1946
1922
|
{
|
|
1947
1923
|
className: cn(
|
|
@@ -1952,8 +1928,8 @@ function ConversationContextPanel({
|
|
|
1952
1928
|
}
|
|
1953
1929
|
)
|
|
1954
1930
|
] }),
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1931
|
+
/* @__PURE__ */ jsxs10("span", { className: "flex flex-shrink-0 items-center gap-2", children: [
|
|
1932
|
+
/* @__PURE__ */ jsx12(
|
|
1957
1933
|
CountPill,
|
|
1958
1934
|
{
|
|
1959
1935
|
status: "completed",
|
|
@@ -1961,7 +1937,7 @@ function ConversationContextPanel({
|
|
|
1961
1937
|
className: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"
|
|
1962
1938
|
}
|
|
1963
1939
|
),
|
|
1964
|
-
/* @__PURE__ */
|
|
1940
|
+
/* @__PURE__ */ jsx12(
|
|
1965
1941
|
CountPill,
|
|
1966
1942
|
{
|
|
1967
1943
|
status: "editing",
|
|
@@ -1969,7 +1945,7 @@ function ConversationContextPanel({
|
|
|
1969
1945
|
className: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"
|
|
1970
1946
|
}
|
|
1971
1947
|
),
|
|
1972
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ jsx12(
|
|
1973
1949
|
CountPill,
|
|
1974
1950
|
{
|
|
1975
1951
|
status: "pending",
|
|
@@ -1977,7 +1953,7 @@ function ConversationContextPanel({
|
|
|
1977
1953
|
className: "bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"
|
|
1978
1954
|
}
|
|
1979
1955
|
),
|
|
1980
|
-
open ? /* @__PURE__ */
|
|
1956
|
+
open ? /* @__PURE__ */ jsx12(ChevronUp, { size: 15, className: "flex-shrink-0 text-blue-500", "aria-hidden": true }) : /* @__PURE__ */ jsx12(ChevronDown, { size: 15, className: "flex-shrink-0 text-blue-500", "aria-hidden": true })
|
|
1981
1957
|
] })
|
|
1982
1958
|
]
|
|
1983
1959
|
}
|
|
@@ -1993,14 +1969,14 @@ function ConversationContextPanel({
|
|
|
1993
1969
|
* Aqui só o corpo rola — o cabeçalho é o que fecha o painel, e perder o clique de fechar
|
|
1994
1970
|
* no meio da rolagem é pior do que a economia de uma linha de markup.
|
|
1995
1971
|
*/
|
|
1996
|
-
/* @__PURE__ */
|
|
1972
|
+
/* @__PURE__ */ jsx12(
|
|
1997
1973
|
"div",
|
|
1998
1974
|
{
|
|
1999
1975
|
className: cn(
|
|
2000
1976
|
"cv-scrollbar-thin max-h-64 overflow-y-auto border-t border-blue-200 px-4 pb-4 pt-1 dark:border-blue-900",
|
|
2001
1977
|
classNames?.body
|
|
2002
1978
|
),
|
|
2003
|
-
children: entries.length === 0 ? /* @__PURE__ */
|
|
1979
|
+
children: entries.length === 0 ? /* @__PURE__ */ jsx12("p", { className: "pt-2 text-xs text-gray-500 dark:text-gray-400", children: labels.empty }) : (
|
|
2004
1980
|
/**
|
|
2005
1981
|
* Três colunas no desktop, como no financiamento — com duas, seis campos viravam uma
|
|
2006
1982
|
* coluna alta que empurrava a conversa.
|
|
@@ -2010,19 +1986,19 @@ function ConversationContextPanel({
|
|
|
2010
1986
|
* e "falta endereço" é justamente o que o atendente precisa ver ao assumir. Então o
|
|
2011
1987
|
* pendente aparece — tracejado e apagado, para ler como lacuna e não como dado.
|
|
2012
1988
|
*/
|
|
2013
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ jsx12("dl", { className: "mt-2 grid grid-cols-2 gap-2 lg:grid-cols-3", children: entries.map((entry) => {
|
|
2014
1990
|
const status = statusOf(entry);
|
|
2015
|
-
return /* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ jsxs10(
|
|
2016
1992
|
"div",
|
|
2017
1993
|
{
|
|
2018
1994
|
className: cn("min-w-0 rounded-lg p-2.5 transition-all", CARD_STYLE[status]),
|
|
2019
1995
|
children: [
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
entry.icon ? /* @__PURE__ */
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsxs10("dt", { className: "mb-1 flex items-center justify-center gap-1", children: [
|
|
1997
|
+
entry.icon ? /* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: "text-base leading-none", children: entry.icon }) : null,
|
|
1998
|
+
/* @__PURE__ */ jsx12("span", { className: "truncate text-[10px] font-medium uppercase leading-none tracking-wide text-gray-500 dark:text-gray-400", children: entry.label }),
|
|
1999
|
+
/* @__PURE__ */ jsx12("span", { className: cn("flex-shrink-0 leading-none", GLYPH_STYLE[status]), children: /* @__PURE__ */ jsx12(StatusGlyph, { status }) })
|
|
2024
2000
|
] }),
|
|
2025
|
-
/* @__PURE__ */
|
|
2001
|
+
/* @__PURE__ */ jsx12(
|
|
2026
2002
|
"dd",
|
|
2027
2003
|
{
|
|
2028
2004
|
className: cn(
|
|
@@ -2050,7 +2026,7 @@ function ConversationContextPanel({
|
|
|
2050
2026
|
|
|
2051
2027
|
// src/WindowExpiredNotice.tsx
|
|
2052
2028
|
import { AlarmClock as AlarmClock2, Send } from "lucide-react";
|
|
2053
|
-
import { jsx as
|
|
2029
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2054
2030
|
var DEFAULT_WINDOW_EXPIRED_LABELS = {
|
|
2055
2031
|
title: "Janela de 24h expirada \u2014 o WhatsApp n\xE3o aceita mensagens livres.",
|
|
2056
2032
|
description: "Envie uma mensagem de template para reabrir a conversa com o cliente.",
|
|
@@ -2063,14 +2039,14 @@ function WindowExpiredNotice({
|
|
|
2063
2039
|
className
|
|
2064
2040
|
}) {
|
|
2065
2041
|
const labels = { ...DEFAULT_WINDOW_EXPIRED_LABELS, ...labelsOverride };
|
|
2066
|
-
return /* @__PURE__ */
|
|
2067
|
-
/* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
2042
|
+
return /* @__PURE__ */ jsxs11("div", { role: "status", className: cn("border-t bg-yellow-50 px-4 py-3 text-sm dark:bg-yellow-950", className), children: [
|
|
2043
|
+
/* @__PURE__ */ jsxs11("p", { className: "flex items-center gap-2 font-medium text-yellow-900 dark:text-yellow-200", children: [
|
|
2044
|
+
/* @__PURE__ */ jsx13(AlarmClock2, { size: ICON_SIZE_INLINE, "aria-hidden": "true", className: "shrink-0" }),
|
|
2069
2045
|
labels.title
|
|
2070
2046
|
] }),
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
onSendTemplate ? /* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsx13("p", { className: "text-yellow-800 dark:text-yellow-300", children: labels.description }),
|
|
2048
|
+
onSendTemplate ? /* @__PURE__ */ jsxs11("button", { "data-cv-tooltip": labels.sendTemplate, "aria-label": labels.sendTemplate, type: "button", onClick: onSendTemplate, disabled, className: "cv-header-action mt-2", children: [
|
|
2049
|
+
/* @__PURE__ */ jsx13(Send, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
2074
2050
|
labels.sendTemplate
|
|
2075
2051
|
] }) : null
|
|
2076
2052
|
] });
|
|
@@ -2080,17 +2056,17 @@ function isWindowBlocking(window2) {
|
|
|
2080
2056
|
}
|
|
2081
2057
|
|
|
2082
2058
|
// src/documents/DocumentsWorkspace.tsx
|
|
2083
|
-
import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef5, useState as
|
|
2059
|
+
import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef5, useState as useState10 } from "react";
|
|
2084
2060
|
import { Download as Download2, Eye, MessageSquare, Trash2, Upload, X as X3 } from "lucide-react";
|
|
2085
2061
|
|
|
2086
2062
|
// src/listing/index.tsx
|
|
2087
|
-
import { useState as
|
|
2063
|
+
import { useState as useState8 } from "react";
|
|
2088
2064
|
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown as ChevronDown2, X as X2 } from "lucide-react";
|
|
2089
|
-
import { Fragment as Fragment4, jsx as
|
|
2065
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2090
2066
|
function SortableHead({ label, field, activeField, direction, onSort, className }) {
|
|
2091
2067
|
const isActive = activeField === field;
|
|
2092
2068
|
const Icon = !isActive ? ArrowUpDown : direction === "asc" ? ArrowUp : ArrowDown;
|
|
2093
|
-
return /* @__PURE__ */
|
|
2069
|
+
return /* @__PURE__ */ jsx14("th", { scope: "col", className: cn("px-3 py-2 text-left text-xs font-medium", className), children: /* @__PURE__ */ jsxs12(
|
|
2094
2070
|
"button",
|
|
2095
2071
|
{
|
|
2096
2072
|
"data-cv-tooltip": label,
|
|
@@ -2100,18 +2076,18 @@ function SortableHead({ label, field, activeField, direction, onSort, className
|
|
|
2100
2076
|
className: "inline-flex items-center gap-1 hover:text-gray-900 dark:hover:text-gray-100",
|
|
2101
2077
|
children: [
|
|
2102
2078
|
label,
|
|
2103
|
-
/* @__PURE__ */
|
|
2079
|
+
/* @__PURE__ */ jsx14(Icon, { size: 12, className: isActive ? "" : "opacity-40", "aria-hidden": "true" })
|
|
2104
2080
|
]
|
|
2105
2081
|
}
|
|
2106
2082
|
) });
|
|
2107
2083
|
}
|
|
2108
2084
|
function MultiSelectFilter({ label, options, selected, onChange, className }) {
|
|
2109
|
-
const [open, setOpen] =
|
|
2085
|
+
const [open, setOpen] = useState8(false);
|
|
2110
2086
|
function toggle(value) {
|
|
2111
2087
|
onChange(selected.includes(value) ? selected.filter((item) => item !== value) : [...selected, value]);
|
|
2112
2088
|
}
|
|
2113
|
-
return /* @__PURE__ */
|
|
2114
|
-
/* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("relative", className), children: [
|
|
2090
|
+
/* @__PURE__ */ jsxs12(
|
|
2115
2091
|
"button",
|
|
2116
2092
|
{
|
|
2117
2093
|
"data-cv-tooltip": label,
|
|
@@ -2121,15 +2097,15 @@ function MultiSelectFilter({ label, options, selected, onChange, className }) {
|
|
|
2121
2097
|
className: "cv-header-action inline-flex items-center gap-1",
|
|
2122
2098
|
children: [
|
|
2123
2099
|
label,
|
|
2124
|
-
selected.length > 0 ? /* @__PURE__ */
|
|
2125
|
-
/* @__PURE__ */
|
|
2100
|
+
selected.length > 0 ? /* @__PURE__ */ jsx14("span", { className: "cv-filter-count", children: selected.length }) : null,
|
|
2101
|
+
/* @__PURE__ */ jsx14(ChevronDown2, { size: 12, className: open ? "rotate-180 transition-transform" : "transition-transform", "aria-hidden": "true" })
|
|
2126
2102
|
]
|
|
2127
2103
|
}
|
|
2128
2104
|
),
|
|
2129
|
-
open ? /* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2105
|
+
open ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2106
|
+
/* @__PURE__ */ jsx14("div", { className: "fixed inset-0 z-10", onClick: () => setOpen(false) }),
|
|
2107
|
+
/* @__PURE__ */ jsx14("div", { className: "cv-filter-menu", children: options.map((option) => /* @__PURE__ */ jsxs12("label", { className: "cv-filter-option", children: [
|
|
2108
|
+
/* @__PURE__ */ jsx14(
|
|
2133
2109
|
"input",
|
|
2134
2110
|
{
|
|
2135
2111
|
type: "checkbox",
|
|
@@ -2145,11 +2121,11 @@ function MultiSelectFilter({ label, options, selected, onChange, className }) {
|
|
|
2145
2121
|
}
|
|
2146
2122
|
function BulkActionBar({ selectedCount, selectedLabel, clearLabel, onClear, children }) {
|
|
2147
2123
|
if (selectedCount === 0) return null;
|
|
2148
|
-
return /* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2124
|
+
return /* @__PURE__ */ jsxs12("div", { className: "cv-bulk-bar", role: "toolbar", "aria-label": selectedLabel(selectedCount), children: [
|
|
2125
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs font-medium", children: selectedLabel(selectedCount) }),
|
|
2150
2126
|
children,
|
|
2151
|
-
/* @__PURE__ */
|
|
2152
|
-
/* @__PURE__ */
|
|
2127
|
+
/* @__PURE__ */ jsxs12("button", { "data-cv-tooltip": clearLabel, "aria-label": clearLabel, type: "button", onClick: onClear, className: "cv-header-action ml-auto inline-flex items-center gap-1", children: [
|
|
2128
|
+
/* @__PURE__ */ jsx14(X2, { size: 12, "aria-hidden": "true" }),
|
|
2153
2129
|
clearLabel
|
|
2154
2130
|
] })
|
|
2155
2131
|
] });
|
|
@@ -2164,26 +2140,26 @@ function ListingPagination({
|
|
|
2164
2140
|
labels
|
|
2165
2141
|
}) {
|
|
2166
2142
|
const lastPage = Math.max(1, Math.ceil(total / perPage));
|
|
2167
|
-
return /* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
2169
|
-
onPerPageChange && perPageOptions ? /* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
2171
|
-
/* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsxs12("div", { className: "cv-listing-pagination", children: [
|
|
2144
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400", children: [
|
|
2145
|
+
onPerPageChange && perPageOptions ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2146
|
+
/* @__PURE__ */ jsx14("span", { children: labels.show }),
|
|
2147
|
+
/* @__PURE__ */ jsx14(
|
|
2172
2148
|
"select",
|
|
2173
2149
|
{
|
|
2174
2150
|
value: perPage,
|
|
2175
2151
|
onChange: (event) => onPerPageChange(Number(event.target.value)),
|
|
2176
2152
|
"aria-label": labels.perPage,
|
|
2177
2153
|
className: "cv-listing-perpage",
|
|
2178
|
-
children: perPageOptions.map((option) => /* @__PURE__ */
|
|
2154
|
+
children: perPageOptions.map((option) => /* @__PURE__ */ jsx14("option", { value: option, children: option }, option))
|
|
2179
2155
|
}
|
|
2180
2156
|
),
|
|
2181
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx14("span", { children: labels.perPage })
|
|
2182
2158
|
] }) : null,
|
|
2183
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ jsx14("span", { className: "ml-1", children: labels.total(total) })
|
|
2184
2160
|
] }),
|
|
2185
|
-
/* @__PURE__ */
|
|
2186
|
-
/* @__PURE__ */
|
|
2161
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2162
|
+
/* @__PURE__ */ jsx14(
|
|
2187
2163
|
"button",
|
|
2188
2164
|
{
|
|
2189
2165
|
"data-cv-tooltip": labels.previous,
|
|
@@ -2195,8 +2171,8 @@ function ListingPagination({
|
|
|
2195
2171
|
children: "\u2039"
|
|
2196
2172
|
}
|
|
2197
2173
|
),
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs text-gray-500", children: labels.page(page, lastPage) }),
|
|
2175
|
+
/* @__PURE__ */ jsx14(
|
|
2200
2176
|
"button",
|
|
2201
2177
|
{
|
|
2202
2178
|
"data-cv-tooltip": labels.next,
|
|
@@ -2213,7 +2189,7 @@ function ListingPagination({
|
|
|
2213
2189
|
}
|
|
2214
2190
|
|
|
2215
2191
|
// src/hooks/useUrlFilterState.ts
|
|
2216
|
-
import { useCallback as
|
|
2192
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useState as useState9 } from "react";
|
|
2217
2193
|
var LIST_SEPARATOR = ",";
|
|
2218
2194
|
function readParams() {
|
|
2219
2195
|
if (typeof window === "undefined") return new URLSearchParams();
|
|
@@ -2228,8 +2204,8 @@ function writeParam(key, value) {
|
|
|
2228
2204
|
window.history.replaceState(null, "", query ? `${window.location.pathname}?${query}` : window.location.pathname);
|
|
2229
2205
|
}
|
|
2230
2206
|
function useUrlStringState(key, initial, { enabled = true } = {}) {
|
|
2231
|
-
const [value, setValue] =
|
|
2232
|
-
const update =
|
|
2207
|
+
const [value, setValue] = useState9(() => enabled ? readParams().get(key) ?? initial : initial);
|
|
2208
|
+
const update = useCallback3(
|
|
2233
2209
|
(next) => {
|
|
2234
2210
|
setValue(next);
|
|
2235
2211
|
if (enabled) writeParam(key, next === initial ? void 0 : next);
|
|
@@ -2239,12 +2215,12 @@ function useUrlStringState(key, initial, { enabled = true } = {}) {
|
|
|
2239
2215
|
return [value, update];
|
|
2240
2216
|
}
|
|
2241
2217
|
function useUrlNumberState(key, initial, { enabled = true } = {}) {
|
|
2242
|
-
const [value, setValue] =
|
|
2218
|
+
const [value, setValue] = useState9(() => {
|
|
2243
2219
|
if (!enabled) return initial;
|
|
2244
2220
|
const raw = Number(readParams().get(key));
|
|
2245
2221
|
return Number.isFinite(raw) && raw > 0 ? raw : initial;
|
|
2246
2222
|
});
|
|
2247
|
-
const update =
|
|
2223
|
+
const update = useCallback3(
|
|
2248
2224
|
(next) => {
|
|
2249
2225
|
setValue(next);
|
|
2250
2226
|
if (enabled) writeParam(key, next === initial ? void 0 : String(next));
|
|
@@ -2254,12 +2230,12 @@ function useUrlNumberState(key, initial, { enabled = true } = {}) {
|
|
|
2254
2230
|
return [value, update];
|
|
2255
2231
|
}
|
|
2256
2232
|
function useUrlArrayState(key, { enabled = true } = {}) {
|
|
2257
|
-
const [value, setValue] =
|
|
2233
|
+
const [value, setValue] = useState9(() => {
|
|
2258
2234
|
if (!enabled) return [];
|
|
2259
2235
|
const raw = readParams().get(key);
|
|
2260
2236
|
return raw ? raw.split(LIST_SEPARATOR).filter(Boolean) : [];
|
|
2261
2237
|
});
|
|
2262
|
-
const update =
|
|
2238
|
+
const update = useCallback3(
|
|
2263
2239
|
(next) => {
|
|
2264
2240
|
setValue(next);
|
|
2265
2241
|
if (enabled) writeParam(key, next.length > 0 ? next.join(LIST_SEPARATOR) : void 0);
|
|
@@ -2269,7 +2245,7 @@ function useUrlArrayState(key, { enabled = true } = {}) {
|
|
|
2269
2245
|
return [value, update];
|
|
2270
2246
|
}
|
|
2271
2247
|
function useDebouncedValue(value, delayMs = 300) {
|
|
2272
|
-
const [debounced, setDebounced] =
|
|
2248
|
+
const [debounced, setDebounced] = useState9(value);
|
|
2273
2249
|
useEffect6(() => {
|
|
2274
2250
|
const timer = setTimeout(() => setDebounced(value), delayMs);
|
|
2275
2251
|
return () => clearTimeout(timer);
|
|
@@ -2323,7 +2299,7 @@ var DEFAULT_DOCUMENTS_WORKSPACE_LABELS = {
|
|
|
2323
2299
|
};
|
|
2324
2300
|
|
|
2325
2301
|
// src/documents/DocumentsWorkspace.tsx
|
|
2326
|
-
import { Fragment as Fragment5, jsx as
|
|
2302
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2327
2303
|
var DEFAULT_PER_PAGE = 20;
|
|
2328
2304
|
var DEFAULT_PER_PAGE_OPTIONS = [10, 20, 50, 100];
|
|
2329
2305
|
var DEFAULT_SORT_FIELD = "linkedAt";
|
|
@@ -2352,16 +2328,16 @@ function DocumentsWorkspace({
|
|
|
2352
2328
|
const [sortDirection, setSortDirection] = useUrlStringState("sortDirection", "desc", urlOptions);
|
|
2353
2329
|
const [page, setPage] = useUrlNumberState("page", 1, urlOptions);
|
|
2354
2330
|
const [perPage, setPerPage] = useUrlNumberState("limit", initialPerPage, urlOptions);
|
|
2355
|
-
const [extra, setExtra] =
|
|
2356
|
-
const [documents, setDocuments] =
|
|
2357
|
-
const [total, setTotal] =
|
|
2358
|
-
const [loading, setLoading] =
|
|
2359
|
-
const [failed, setFailed] =
|
|
2360
|
-
const [selectedIds, setSelectedIds] =
|
|
2361
|
-
const [reloadToken, setReloadToken] =
|
|
2362
|
-
const [busy, setBusy] =
|
|
2363
|
-
const [uploading, setUploading] =
|
|
2364
|
-
const [uploadFailed, setUploadFailed] =
|
|
2331
|
+
const [extra, setExtra] = useState10({});
|
|
2332
|
+
const [documents, setDocuments] = useState10([]);
|
|
2333
|
+
const [total, setTotal] = useState10(0);
|
|
2334
|
+
const [loading, setLoading] = useState10(false);
|
|
2335
|
+
const [failed, setFailed] = useState10(false);
|
|
2336
|
+
const [selectedIds, setSelectedIds] = useState10(/* @__PURE__ */ new Set());
|
|
2337
|
+
const [reloadToken, setReloadToken] = useState10(0);
|
|
2338
|
+
const [busy, setBusy] = useState10(false);
|
|
2339
|
+
const [uploading, setUploading] = useState10(false);
|
|
2340
|
+
const [uploadFailed, setUploadFailed] = useState10(false);
|
|
2365
2341
|
const fileInputRef = useRef5(null);
|
|
2366
2342
|
const debouncedSearch = useDebouncedValue(search);
|
|
2367
2343
|
const fetchAll = context?.api.getAllDocuments;
|
|
@@ -2483,14 +2459,14 @@ function DocumentsWorkspace({
|
|
|
2483
2459
|
if (!fetchAll) return null;
|
|
2484
2460
|
const direction = sortDirection === "asc" ? "asc" : "desc";
|
|
2485
2461
|
const canSelect = Boolean(removeDocument ?? downloadArchive);
|
|
2486
|
-
return /* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
/* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
2462
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn("space-y-4", classNames?.root, className), children: [
|
|
2463
|
+
/* @__PURE__ */ jsx15(TooltipLayer, {}),
|
|
2464
|
+
/* @__PURE__ */ jsxs13("header", { className: cn("space-y-0.5", classNames?.header), children: [
|
|
2465
|
+
/* @__PURE__ */ jsx15("h2", { className: "text-lg font-semibold", children: labels.title }),
|
|
2466
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: labels.subtitle(total) })
|
|
2491
2467
|
] }),
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2468
|
+
/* @__PURE__ */ jsxs13("div", { className: cn("flex flex-wrap items-center gap-2", classNames?.filters), children: [
|
|
2469
|
+
/* @__PURE__ */ jsx15(
|
|
2494
2470
|
"input",
|
|
2495
2471
|
{
|
|
2496
2472
|
type: "search",
|
|
@@ -2501,8 +2477,8 @@ function DocumentsWorkspace({
|
|
|
2501
2477
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-900 sm:w-64"
|
|
2502
2478
|
}
|
|
2503
2479
|
),
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
categoryOptions.length > 0 ? /* @__PURE__ */
|
|
2480
|
+
/* @__PURE__ */ jsx15(MultiSelectFilter, { label: labels.sourceFilter, options: sourceOptions, selected: source, onChange: setSource }),
|
|
2481
|
+
categoryOptions.length > 0 ? /* @__PURE__ */ jsx15(
|
|
2506
2482
|
MultiSelectFilter,
|
|
2507
2483
|
{
|
|
2508
2484
|
label: labels.categoryFilter,
|
|
@@ -2511,8 +2487,8 @@ function DocumentsWorkspace({
|
|
|
2511
2487
|
onChange: setCategory
|
|
2512
2488
|
}
|
|
2513
2489
|
) : null,
|
|
2514
|
-
dateFilter ? /* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2490
|
+
dateFilter ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
2491
|
+
/* @__PURE__ */ jsx15(
|
|
2516
2492
|
"input",
|
|
2517
2493
|
{
|
|
2518
2494
|
type: "date",
|
|
@@ -2522,7 +2498,7 @@ function DocumentsWorkspace({
|
|
|
2522
2498
|
className: "rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
|
|
2523
2499
|
}
|
|
2524
2500
|
),
|
|
2525
|
-
/* @__PURE__ */
|
|
2501
|
+
/* @__PURE__ */ jsx15(
|
|
2526
2502
|
"input",
|
|
2527
2503
|
{
|
|
2528
2504
|
type: "date",
|
|
@@ -2534,12 +2510,12 @@ function DocumentsWorkspace({
|
|
|
2534
2510
|
)
|
|
2535
2511
|
] }) : null,
|
|
2536
2512
|
renderFilters?.({ extra, setExtra }),
|
|
2537
|
-
hasFilters ? /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2513
|
+
hasFilters ? /* @__PURE__ */ jsxs13("button", { "data-cv-tooltip": labels.clearFilters, "aria-label": labels.clearFilters, type: "button", onClick: clearFilters, className: "cv-header-action inline-flex items-center gap-1", children: [
|
|
2514
|
+
/* @__PURE__ */ jsx15(X3, { size: 12, "aria-hidden": "true" }),
|
|
2539
2515
|
labels.clearFilters
|
|
2540
2516
|
] }) : null,
|
|
2541
|
-
uploadDocument ? /* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2517
|
+
uploadDocument ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
2518
|
+
/* @__PURE__ */ jsx15(
|
|
2543
2519
|
"input",
|
|
2544
2520
|
{
|
|
2545
2521
|
ref: fileInputRef,
|
|
@@ -2552,7 +2528,7 @@ function DocumentsWorkspace({
|
|
|
2552
2528
|
}
|
|
2553
2529
|
}
|
|
2554
2530
|
),
|
|
2555
|
-
/* @__PURE__ */
|
|
2531
|
+
/* @__PURE__ */ jsxs13(
|
|
2556
2532
|
"button",
|
|
2557
2533
|
{
|
|
2558
2534
|
"data-cv-tooltip": labels.upload,
|
|
@@ -2562,15 +2538,15 @@ function DocumentsWorkspace({
|
|
|
2562
2538
|
disabled: uploading,
|
|
2563
2539
|
className: "cv-header-action ml-auto inline-flex items-center gap-1 disabled:opacity-40",
|
|
2564
2540
|
children: [
|
|
2565
|
-
/* @__PURE__ */
|
|
2541
|
+
/* @__PURE__ */ jsx15(Upload, { size: 12, "aria-hidden": "true" }),
|
|
2566
2542
|
labels.upload
|
|
2567
2543
|
]
|
|
2568
2544
|
}
|
|
2569
2545
|
)
|
|
2570
2546
|
] }) : null
|
|
2571
2547
|
] }),
|
|
2572
|
-
uploadFailed ? /* @__PURE__ */
|
|
2573
|
-
canSelect ? /* @__PURE__ */
|
|
2548
|
+
uploadFailed ? /* @__PURE__ */ jsx15("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.uploadError }) : null,
|
|
2549
|
+
canSelect ? /* @__PURE__ */ jsxs13(
|
|
2574
2550
|
BulkActionBar,
|
|
2575
2551
|
{
|
|
2576
2552
|
selectedCount: selectedIds.size,
|
|
@@ -2578,7 +2554,7 @@ function DocumentsWorkspace({
|
|
|
2578
2554
|
clearLabel: labels.bulkClear,
|
|
2579
2555
|
onClear: () => setSelectedIds(/* @__PURE__ */ new Set()),
|
|
2580
2556
|
children: [
|
|
2581
|
-
downloadArchive ? /* @__PURE__ */
|
|
2557
|
+
downloadArchive ? /* @__PURE__ */ jsxs13(
|
|
2582
2558
|
"button",
|
|
2583
2559
|
{
|
|
2584
2560
|
"data-cv-tooltip": labels.bulkDownloadZip,
|
|
@@ -2588,12 +2564,12 @@ function DocumentsWorkspace({
|
|
|
2588
2564
|
disabled: busy,
|
|
2589
2565
|
className: "cv-header-action inline-flex items-center gap-1 disabled:opacity-40",
|
|
2590
2566
|
children: [
|
|
2591
|
-
/* @__PURE__ */
|
|
2567
|
+
/* @__PURE__ */ jsx15(Download2, { size: 12, "aria-hidden": "true" }),
|
|
2592
2568
|
labels.bulkDownloadZip
|
|
2593
2569
|
]
|
|
2594
2570
|
}
|
|
2595
2571
|
) : null,
|
|
2596
|
-
removeDocument ? /* @__PURE__ */
|
|
2572
|
+
removeDocument ? /* @__PURE__ */ jsxs13(
|
|
2597
2573
|
"button",
|
|
2598
2574
|
{
|
|
2599
2575
|
"data-cv-tooltip": labels.bulkRemove(selectedIds.size),
|
|
@@ -2605,7 +2581,7 @@ function DocumentsWorkspace({
|
|
|
2605
2581
|
disabled: busy,
|
|
2606
2582
|
className: "cv-header-action cv-header-action--danger inline-flex items-center gap-1 disabled:opacity-40",
|
|
2607
2583
|
children: [
|
|
2608
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsx15(Trash2, { size: 12, "aria-hidden": "true" }),
|
|
2609
2585
|
labels.bulkRemove(selectedIds.size)
|
|
2610
2586
|
]
|
|
2611
2587
|
}
|
|
@@ -2613,12 +2589,12 @@ function DocumentsWorkspace({
|
|
|
2613
2589
|
]
|
|
2614
2590
|
}
|
|
2615
2591
|
) : null,
|
|
2616
|
-
loading ? /* @__PURE__ */
|
|
2617
|
-
failed ? /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
canSelect ? /* @__PURE__ */
|
|
2592
|
+
loading ? /* @__PURE__ */ jsx15("p", { className: cn("text-sm text-gray-500", classNames?.status), children: labels.loading }) : null,
|
|
2593
|
+
failed ? /* @__PURE__ */ jsx15("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.failure }) : null,
|
|
2594
|
+
/* @__PURE__ */ jsxs13("div", { className: cn("cv-table-card", classNames?.table), children: [
|
|
2595
|
+
/* @__PURE__ */ jsxs13("table", { className: "cv-table", children: [
|
|
2596
|
+
/* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsxs13("tr", { children: [
|
|
2597
|
+
canSelect ? /* @__PURE__ */ jsx15("th", { scope: "col", className: "w-10 px-3 py-2", children: /* @__PURE__ */ jsx15(
|
|
2622
2598
|
"input",
|
|
2623
2599
|
{
|
|
2624
2600
|
type: "checkbox",
|
|
@@ -2628,16 +2604,16 @@ function DocumentsWorkspace({
|
|
|
2628
2604
|
className: "cursor-pointer rounded border-gray-300 text-blue-600 dark:border-gray-600"
|
|
2629
2605
|
}
|
|
2630
2606
|
) }) : null,
|
|
2631
|
-
/* @__PURE__ */
|
|
2632
|
-
/* @__PURE__ */
|
|
2633
|
-
/* @__PURE__ */
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ jsx15(SortableHead, { label: labels.columnFilename, field: "filename", activeField: sortField, direction, onSort: toggleSort }),
|
|
2608
|
+
/* @__PURE__ */ jsx15(SortableHead, { label: labels.columnContact, field: "conversationId", activeField: sortField, direction, onSort: toggleSort, className: "hidden sm:table-cell" }),
|
|
2609
|
+
/* @__PURE__ */ jsx15(SortableHead, { label: labels.columnType, field: "mimeType", activeField: sortField, direction, onSort: toggleSort, className: "hidden md:table-cell" }),
|
|
2610
|
+
/* @__PURE__ */ jsx15(SortableHead, { label: labels.columnSize, field: "sizeBytes", activeField: sortField, direction, onSort: toggleSort, className: "hidden lg:table-cell" }),
|
|
2611
|
+
/* @__PURE__ */ jsx15(SortableHead, { label: labels.columnSource, field: "source", activeField: sortField, direction, onSort: toggleSort, className: "hidden lg:table-cell" }),
|
|
2612
|
+
/* @__PURE__ */ jsx15(SortableHead, { label: labels.columnDate, field: "linkedAt", activeField: sortField, direction, onSort: toggleSort, className: "hidden xl:table-cell" }),
|
|
2613
|
+
/* @__PURE__ */ jsx15("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: labels.columnActions })
|
|
2638
2614
|
] }) }),
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
canSelect ? /* @__PURE__ */
|
|
2615
|
+
/* @__PURE__ */ jsx15("tbody", { children: documents.map((document2) => /* @__PURE__ */ jsxs13("tr", { className: classNames?.row, children: [
|
|
2616
|
+
canSelect ? /* @__PURE__ */ jsx15("td", { className: "w-10 px-3 py-2", children: /* @__PURE__ */ jsx15(
|
|
2641
2617
|
"input",
|
|
2642
2618
|
{
|
|
2643
2619
|
type: "checkbox",
|
|
@@ -2647,11 +2623,11 @@ function DocumentsWorkspace({
|
|
|
2647
2623
|
className: "cursor-pointer rounded border-gray-300 text-blue-600 dark:border-gray-600"
|
|
2648
2624
|
}
|
|
2649
2625
|
) }) : null,
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2626
|
+
/* @__PURE__ */ jsx15("td", { className: "max-w-xs px-3 py-2", children: /* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2627
|
+
/* @__PURE__ */ jsx15(FileIcon, { filename: document2.filename, mimeType: document2.mimeType }),
|
|
2628
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate font-medium", "data-cv-tooltip": document2.filename, children: document2.filename })
|
|
2653
2629
|
] }) }),
|
|
2654
|
-
/* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsx15("td", { className: "hidden px-3 py-2 sm:table-cell", children: onOpenConversation ? /* @__PURE__ */ jsxs13(
|
|
2655
2631
|
"button",
|
|
2656
2632
|
{
|
|
2657
2633
|
type: "button",
|
|
@@ -2660,17 +2636,17 @@ function DocumentsWorkspace({
|
|
|
2660
2636
|
"aria-label": labels.openConversation,
|
|
2661
2637
|
className: "cv-header-action inline-flex items-center gap-1",
|
|
2662
2638
|
children: [
|
|
2663
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx15(MessageSquare, { size: 12, "aria-hidden": "true" }),
|
|
2664
2640
|
document2.contactName ?? formatPhone(document2.conversationId)
|
|
2665
2641
|
]
|
|
2666
2642
|
}
|
|
2667
|
-
) : /* @__PURE__ */
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
/* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2643
|
+
) : /* @__PURE__ */ jsx15("span", { className: "text-xs text-gray-500", children: document2.contactName ?? formatPhone(document2.conversationId) }) }),
|
|
2644
|
+
/* @__PURE__ */ jsx15("td", { className: "hidden px-3 py-2 md:table-cell", "data-cv-tooltip": document2.mimeType, children: /* @__PURE__ */ jsx15("span", { className: "cv-type-tag", children: documentTypeLabel(document2.filename, document2.mimeType) }) }),
|
|
2645
|
+
/* @__PURE__ */ jsx15("td", { className: "hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell", children: formatFileSize(document2.sizeBytes) }),
|
|
2646
|
+
/* @__PURE__ */ jsx15("td", { className: "hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell", children: labels.sourceLabels[document2.source] ?? document2.source }),
|
|
2647
|
+
/* @__PURE__ */ jsx15("td", { className: "hidden whitespace-nowrap px-3 py-2 text-xs xl:table-cell", children: formatDateTime(document2.linkedAt) }),
|
|
2648
|
+
/* @__PURE__ */ jsx15("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
|
|
2649
|
+
/* @__PURE__ */ jsx15(
|
|
2674
2650
|
"button",
|
|
2675
2651
|
{
|
|
2676
2652
|
type: "button",
|
|
@@ -2678,10 +2654,10 @@ function DocumentsWorkspace({
|
|
|
2678
2654
|
"data-cv-tooltip": labels.view,
|
|
2679
2655
|
"aria-label": `${labels.view}: ${document2.filename}`,
|
|
2680
2656
|
className: "cv-header-icon",
|
|
2681
|
-
children: /* @__PURE__ */
|
|
2657
|
+
children: /* @__PURE__ */ jsx15(Eye, { size: 14 })
|
|
2682
2658
|
}
|
|
2683
2659
|
),
|
|
2684
|
-
/* @__PURE__ */
|
|
2660
|
+
/* @__PURE__ */ jsx15(
|
|
2685
2661
|
"button",
|
|
2686
2662
|
{
|
|
2687
2663
|
type: "button",
|
|
@@ -2689,10 +2665,10 @@ function DocumentsWorkspace({
|
|
|
2689
2665
|
"data-cv-tooltip": labels.download,
|
|
2690
2666
|
"aria-label": `${labels.download}: ${document2.filename}`,
|
|
2691
2667
|
className: "cv-header-icon",
|
|
2692
|
-
children: /* @__PURE__ */
|
|
2668
|
+
children: /* @__PURE__ */ jsx15(Download2, { size: 14 })
|
|
2693
2669
|
}
|
|
2694
2670
|
),
|
|
2695
|
-
removeDocument ? /* @__PURE__ */
|
|
2671
|
+
removeDocument ? /* @__PURE__ */ jsx15(
|
|
2696
2672
|
"button",
|
|
2697
2673
|
{
|
|
2698
2674
|
type: "button",
|
|
@@ -2703,15 +2679,15 @@ function DocumentsWorkspace({
|
|
|
2703
2679
|
"data-cv-tooltip": labels.remove,
|
|
2704
2680
|
"aria-label": `${labels.remove}: ${document2.filename}`,
|
|
2705
2681
|
className: "cv-header-icon disabled:opacity-40",
|
|
2706
|
-
children: /* @__PURE__ */
|
|
2682
|
+
children: /* @__PURE__ */ jsx15(Trash2, { size: 14, className: "text-red-500" })
|
|
2707
2683
|
}
|
|
2708
2684
|
) : null
|
|
2709
2685
|
] }) })
|
|
2710
2686
|
] }, `${document2.conversationId}:${document2.id}`)) })
|
|
2711
2687
|
] }),
|
|
2712
|
-
!loading && documents.length === 0 ? /* @__PURE__ */
|
|
2688
|
+
!loading && documents.length === 0 ? /* @__PURE__ */ jsx15("p", { className: cn("py-8 text-center text-sm text-gray-400", classNames?.status), children: hasFilters ? labels.noResults : labels.empty }) : null
|
|
2713
2689
|
] }),
|
|
2714
|
-
/* @__PURE__ */
|
|
2690
|
+
/* @__PURE__ */ jsx15(
|
|
2715
2691
|
ListingPagination,
|
|
2716
2692
|
{
|
|
2717
2693
|
page,
|
|
@@ -2778,7 +2754,7 @@ function downloadTextFile(filename, content) {
|
|
|
2778
2754
|
|
|
2779
2755
|
// src/DarkModeToggle.tsx
|
|
2780
2756
|
import { Moon, Sun } from "lucide-react";
|
|
2781
|
-
import { jsx as
|
|
2757
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2782
2758
|
var DEFAULT_DARK_MODE_TOGGLE_LABELS = {
|
|
2783
2759
|
toDark: "Tema escuro",
|
|
2784
2760
|
toLight: "Tema claro"
|
|
@@ -2793,7 +2769,7 @@ function DarkModeToggle({
|
|
|
2793
2769
|
}) {
|
|
2794
2770
|
const label = isDark ? labels?.toLight ?? DEFAULT_DARK_MODE_TOGGLE_LABELS.toLight : labels?.toDark ?? DEFAULT_DARK_MODE_TOGGLE_LABELS.toDark;
|
|
2795
2771
|
const Icon = isDark ? Sun : Moon;
|
|
2796
|
-
return /* @__PURE__ */
|
|
2772
|
+
return /* @__PURE__ */ jsxs14(
|
|
2797
2773
|
"button",
|
|
2798
2774
|
{
|
|
2799
2775
|
type: "button",
|
|
@@ -2808,7 +2784,7 @@ function DarkModeToggle({
|
|
|
2808
2784
|
className
|
|
2809
2785
|
),
|
|
2810
2786
|
children: [
|
|
2811
|
-
/* @__PURE__ */
|
|
2787
|
+
/* @__PURE__ */ jsx16(
|
|
2812
2788
|
Icon,
|
|
2813
2789
|
{
|
|
2814
2790
|
"aria-hidden": "true",
|
|
@@ -2816,14 +2792,14 @@ function DarkModeToggle({
|
|
|
2816
2792
|
size: classNames?.icon ? void 0 : ICON_SIZE_ACTION
|
|
2817
2793
|
}
|
|
2818
2794
|
),
|
|
2819
|
-
showLabel ? /* @__PURE__ */
|
|
2795
|
+
showLabel ? /* @__PURE__ */ jsx16("span", { className: classNames?.label, children: label }) : null
|
|
2820
2796
|
]
|
|
2821
2797
|
}
|
|
2822
2798
|
);
|
|
2823
2799
|
}
|
|
2824
2800
|
|
|
2825
2801
|
// src/useWaitingNotifications.ts
|
|
2826
|
-
import { useState as
|
|
2802
|
+
import { useState as useState11, useEffect as useEffect8, useRef as useRef6, useCallback as useCallback4 } from "react";
|
|
2827
2803
|
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
2828
2804
|
var DEFAULT_LIMIT = 50;
|
|
2829
2805
|
var DEFAULT_LABELS = {
|
|
@@ -2832,7 +2808,7 @@ var DEFAULT_LABELS = {
|
|
|
2832
2808
|
};
|
|
2833
2809
|
function useWaitingNotifications(params) {
|
|
2834
2810
|
const conversationsContext = useConversations();
|
|
2835
|
-
const [conversations, setConversations] =
|
|
2811
|
+
const [conversations, setConversations] = useState11([]);
|
|
2836
2812
|
const previousUnreadMap = useRef6(/* @__PURE__ */ new Map());
|
|
2837
2813
|
const notifiedIds = useRef6(/* @__PURE__ */ new Set());
|
|
2838
2814
|
const isPollingRef = useRef6(false);
|
|
@@ -2842,7 +2818,7 @@ function useWaitingNotifications(params) {
|
|
|
2842
2818
|
const listParams = params?.params;
|
|
2843
2819
|
const labelTitle = params?.labels?.title ?? DEFAULT_LABELS.title;
|
|
2844
2820
|
const labelBody = params?.labels?.body ?? DEFAULT_LABELS.body;
|
|
2845
|
-
const refresh =
|
|
2821
|
+
const refresh = useCallback4(async () => {
|
|
2846
2822
|
if (!conversationsContext || isPollingRef.current) return;
|
|
2847
2823
|
isPollingRef.current = true;
|
|
2848
2824
|
try {
|
|
@@ -2882,7 +2858,7 @@ function useWaitingNotifications(params) {
|
|
|
2882
2858
|
|
|
2883
2859
|
// src/settings/WhatsAppTemplateSettingsForm.tsx
|
|
2884
2860
|
import { Plus, RefreshCw, Save, Trash2 as Trash22 } from "lucide-react";
|
|
2885
|
-
import { jsx as
|
|
2861
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2886
2862
|
var DEFAULT_LABELS2 = {
|
|
2887
2863
|
sectionTitle: "WhatsApp",
|
|
2888
2864
|
sectionDescription: "Template usado para reabrir a janela de 24h com o cliente.",
|
|
@@ -2941,16 +2917,16 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2941
2917
|
}
|
|
2942
2918
|
onVariablesChange([...variables, token]);
|
|
2943
2919
|
}
|
|
2944
|
-
return /* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
2920
|
+
return /* @__PURE__ */ jsxs15("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
2921
|
+
/* @__PURE__ */ jsxs15("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
2922
|
+
/* @__PURE__ */ jsx17("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }),
|
|
2923
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
2948
2924
|
] }),
|
|
2949
|
-
/* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsxs15("form", { onSubmit: onSave, className: "p-6 space-y-4", children: [
|
|
2926
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
2927
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
2928
|
+
/* @__PURE__ */ jsx17("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.templateLabel }),
|
|
2929
|
+
/* @__PURE__ */ jsxs15(
|
|
2954
2930
|
"button",
|
|
2955
2931
|
{
|
|
2956
2932
|
"data-cv-tooltip": labels.refreshList,
|
|
@@ -2960,31 +2936,31 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2960
2936
|
disabled: loadingTemplates,
|
|
2961
2937
|
className: "flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",
|
|
2962
2938
|
children: [
|
|
2963
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ jsx17(RefreshCw, { size: 11, className: loadingTemplates ? "animate-spin" : "" }),
|
|
2964
2940
|
labels.refreshList
|
|
2965
2941
|
]
|
|
2966
2942
|
}
|
|
2967
2943
|
)
|
|
2968
2944
|
] }),
|
|
2969
|
-
templatesError && /* @__PURE__ */
|
|
2945
|
+
templatesError && /* @__PURE__ */ jsxs15("div", { className: "mb-2 rounded-lg bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 px-3 py-2 text-xs text-amber-700 dark:text-amber-400", children: [
|
|
2970
2946
|
labels.errorLoading,
|
|
2971
|
-
/* @__PURE__ */
|
|
2972
|
-
/* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ jsx17("br", {}),
|
|
2948
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-gray-500 dark:text-gray-400 mt-0.5 block", children: [
|
|
2973
2949
|
labels.currentNameSaved,
|
|
2974
2950
|
" ",
|
|
2975
|
-
/* @__PURE__ */
|
|
2951
|
+
/* @__PURE__ */ jsx17("strong", { children: selectedTemplateName || "\u2014" })
|
|
2976
2952
|
] })
|
|
2977
2953
|
] }),
|
|
2978
|
-
loadingTemplates && /* @__PURE__ */
|
|
2979
|
-
!loadingTemplates && !templatesError && /* @__PURE__ */
|
|
2954
|
+
loadingTemplates && /* @__PURE__ */ jsx17("div", { className: "h-10 rounded-xl bg-gray-100 dark:bg-gray-700 animate-pulse" }),
|
|
2955
|
+
!loadingTemplates && !templatesError && /* @__PURE__ */ jsxs15(
|
|
2980
2956
|
"select",
|
|
2981
2957
|
{
|
|
2982
2958
|
value: selectedTemplateName,
|
|
2983
2959
|
onChange: (e) => handleSelect(e.target.value),
|
|
2984
2960
|
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all",
|
|
2985
2961
|
children: [
|
|
2986
|
-
/* @__PURE__ */
|
|
2987
|
-
templates.map((template) => /* @__PURE__ */
|
|
2962
|
+
/* @__PURE__ */ jsx17("option", { value: "", children: labels.selectPlaceholder }),
|
|
2963
|
+
templates.map((template) => /* @__PURE__ */ jsxs15("option", { value: template.name, disabled: template.status !== "APPROVED", children: [
|
|
2988
2964
|
template.displayName,
|
|
2989
2965
|
" \xB7 ",
|
|
2990
2966
|
template.shortId,
|
|
@@ -2996,12 +2972,12 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2996
2972
|
]
|
|
2997
2973
|
}
|
|
2998
2974
|
),
|
|
2999
|
-
selected?.bodyText && /* @__PURE__ */
|
|
2975
|
+
selected?.bodyText && /* @__PURE__ */ jsx17("div", { className: "mt-2 rounded-lg bg-gray-50 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-600 px-3 py-2 text-xs text-gray-600 dark:text-gray-300 whitespace-pre-wrap", children: selected.bodyText })
|
|
3000
2976
|
] }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
/* @__PURE__ */
|
|
3004
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
2978
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
2979
|
+
/* @__PURE__ */ jsx17("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.variablesLabel }),
|
|
2980
|
+
/* @__PURE__ */ jsxs15(
|
|
3005
2981
|
"button",
|
|
3006
2982
|
{
|
|
3007
2983
|
"data-cv-tooltip": labels.addVariable,
|
|
@@ -3010,15 +2986,15 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3010
2986
|
onClick: () => onVariablesChange([...variables, ""]),
|
|
3011
2987
|
className: "flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline",
|
|
3012
2988
|
children: [
|
|
3013
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ jsx17(Plus, { size: 12 }),
|
|
3014
2990
|
labels.addVariable
|
|
3015
2991
|
]
|
|
3016
2992
|
}
|
|
3017
2993
|
)
|
|
3018
2994
|
] }),
|
|
3019
|
-
availableVariables.length > 0 && /* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
3021
|
-
/* @__PURE__ */
|
|
2995
|
+
availableVariables.length > 0 && /* @__PURE__ */ jsxs15("div", { className: "mb-3 rounded-lg border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/40 p-2.5", children: [
|
|
2996
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs font-medium text-gray-600 dark:text-gray-300 mb-1.5", children: labels.variablesAvailableTitle }),
|
|
2997
|
+
/* @__PURE__ */ jsx17("div", { className: "flex flex-wrap gap-1.5", children: availableVariables.map((available) => /* @__PURE__ */ jsxs15(
|
|
3022
2998
|
"button",
|
|
3023
2999
|
{
|
|
3024
3000
|
type: "button",
|
|
@@ -3027,8 +3003,8 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3027
3003
|
"aria-label": `Inserir ${available.token}`,
|
|
3028
3004
|
className: "inline-flex items-center gap-1 rounded-md border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 px-2 py-1 text-xs hover:border-blue-400 dark:hover:border-blue-500 transition-colors",
|
|
3029
3005
|
children: [
|
|
3030
|
-
/* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3006
|
+
/* @__PURE__ */ jsx17("code", { className: "text-blue-600 dark:text-blue-300", children: available.token }),
|
|
3007
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-gray-400 dark:text-gray-500", children: [
|
|
3032
3008
|
"\xB7 ",
|
|
3033
3009
|
available.label
|
|
3034
3010
|
] })
|
|
@@ -3036,13 +3012,13 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3036
3012
|
},
|
|
3037
3013
|
available.token
|
|
3038
3014
|
)) }),
|
|
3039
|
-
/* @__PURE__ */
|
|
3015
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-1.5 text-[11px] text-gray-400 dark:text-gray-500", children: labels.variablesAvailableHint })
|
|
3040
3016
|
] }),
|
|
3041
|
-
/* @__PURE__ */
|
|
3042
|
-
variables.length === 0 && /* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3045
|
-
/* @__PURE__ */
|
|
3017
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs text-gray-400 dark:text-gray-500 mb-2", children: labels.variablesMappingHint }),
|
|
3018
|
+
variables.length === 0 && /* @__PURE__ */ jsx17("p", { className: "text-xs text-gray-400 dark:text-gray-500 italic", children: labels.noVariables }),
|
|
3019
|
+
/* @__PURE__ */ jsx17("div", { className: "space-y-2", children: variables.map((variable, index) => /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
3020
|
+
/* @__PURE__ */ jsx17("span", { className: "text-xs text-gray-400 dark:text-gray-500 w-6 text-right flex-shrink-0", children: `{{${index + 1}}}` }),
|
|
3021
|
+
/* @__PURE__ */ jsx17(
|
|
3046
3022
|
"input",
|
|
3047
3023
|
{
|
|
3048
3024
|
type: "text",
|
|
@@ -3052,7 +3028,7 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3052
3028
|
className: "flex-1 border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all placeholder:text-gray-400 dark:placeholder:text-gray-500"
|
|
3053
3029
|
}
|
|
3054
3030
|
),
|
|
3055
|
-
/* @__PURE__ */
|
|
3031
|
+
/* @__PURE__ */ jsx17(
|
|
3056
3032
|
"button",
|
|
3057
3033
|
{
|
|
3058
3034
|
type: "button",
|
|
@@ -3060,13 +3036,13 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3060
3036
|
className: "text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors flex-shrink-0",
|
|
3061
3037
|
"data-cv-tooltip": labels.removeVariable,
|
|
3062
3038
|
"aria-label": labels.removeVariable,
|
|
3063
|
-
children: /* @__PURE__ */
|
|
3039
|
+
children: /* @__PURE__ */ jsx17(Trash22, { size: 14 })
|
|
3064
3040
|
}
|
|
3065
3041
|
)
|
|
3066
3042
|
] }, index)) })
|
|
3067
3043
|
] }),
|
|
3068
|
-
saveSuccess && /* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3044
|
+
saveSuccess && /* @__PURE__ */ jsx17("div", { className: "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 rounded-xl px-4 py-3 text-sm text-green-700 dark:text-green-400", children: labels.saveSuccess }),
|
|
3045
|
+
/* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs15(
|
|
3070
3046
|
"button",
|
|
3071
3047
|
{
|
|
3072
3048
|
"data-cv-tooltip": saving ? labels.saving : labels.save,
|
|
@@ -3075,7 +3051,7 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3075
3051
|
disabled: saving || !selectedTemplateName.trim(),
|
|
3076
3052
|
className: "flex items-center gap-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
3077
3053
|
children: [
|
|
3078
|
-
saving ? /* @__PURE__ */
|
|
3054
|
+
saving ? /* @__PURE__ */ jsx17("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx17(Save, { size: 14 }),
|
|
3079
3055
|
saving ? labels.saving : labels.save
|
|
3080
3056
|
]
|
|
3081
3057
|
}
|
|
@@ -3086,7 +3062,7 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3086
3062
|
|
|
3087
3063
|
// src/settings/WhatsAppCreateTemplateForm.tsx
|
|
3088
3064
|
import { SendHorizonal as SendHorizonal2 } from "lucide-react";
|
|
3089
|
-
import { jsx as
|
|
3065
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3090
3066
|
var DEFAULT_LABELS3 = {
|
|
3091
3067
|
sectionTitle: "Criar novo template",
|
|
3092
3068
|
sectionDescription: "Envia um template para aprova\xE7\xE3o da Meta.",
|
|
@@ -3143,16 +3119,16 @@ function WhatsAppCreateTemplateForm({
|
|
|
3143
3119
|
function set(key, next) {
|
|
3144
3120
|
onChange({ ...value, [key]: next });
|
|
3145
3121
|
}
|
|
3146
|
-
return /* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3122
|
+
return /* @__PURE__ */ jsxs16("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3123
|
+
/* @__PURE__ */ jsxs16("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
3124
|
+
/* @__PURE__ */ jsx18("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }),
|
|
3125
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
3150
3126
|
] }),
|
|
3151
|
-
/* @__PURE__ */
|
|
3152
|
-
/* @__PURE__ */
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3155
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ jsxs16("form", { onSubmit, className: "p-6 space-y-4", children: [
|
|
3128
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3129
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.nameLabel }),
|
|
3130
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.nameHint }),
|
|
3131
|
+
/* @__PURE__ */ jsx18(
|
|
3156
3132
|
"input",
|
|
3157
3133
|
{
|
|
3158
3134
|
type: "text",
|
|
@@ -3164,56 +3140,56 @@ function WhatsAppCreateTemplateForm({
|
|
|
3164
3140
|
}
|
|
3165
3141
|
)
|
|
3166
3142
|
] }),
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
/* @__PURE__ */
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3143
|
+
/* @__PURE__ */ jsxs16("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
3144
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3145
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.categoryLabel }),
|
|
3146
|
+
/* @__PURE__ */ jsxs16(
|
|
3171
3147
|
"select",
|
|
3172
3148
|
{
|
|
3173
3149
|
value: value.category,
|
|
3174
3150
|
onChange: (e) => set("category", e.target.value),
|
|
3175
3151
|
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all",
|
|
3176
3152
|
children: [
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3153
|
+
/* @__PURE__ */ jsx18("option", { value: "UTILITY", children: "UTILITY (Transacional)" }),
|
|
3154
|
+
/* @__PURE__ */ jsx18("option", { value: "MARKETING", children: "MARKETING (Promocional)" })
|
|
3179
3155
|
]
|
|
3180
3156
|
}
|
|
3181
3157
|
)
|
|
3182
3158
|
] }),
|
|
3183
|
-
/* @__PURE__ */
|
|
3184
|
-
/* @__PURE__ */
|
|
3185
|
-
/* @__PURE__ */
|
|
3159
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3160
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.languageLabel }),
|
|
3161
|
+
/* @__PURE__ */ jsxs16(
|
|
3186
3162
|
"select",
|
|
3187
3163
|
{
|
|
3188
3164
|
value: value.language,
|
|
3189
3165
|
onChange: (e) => set("language", e.target.value),
|
|
3190
3166
|
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all",
|
|
3191
3167
|
children: [
|
|
3192
|
-
/* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3168
|
+
/* @__PURE__ */ jsx18("option", { value: "pt_BR", children: "Portugu\xEAs (Brasil)" }),
|
|
3169
|
+
/* @__PURE__ */ jsx18("option", { value: "en_US", children: "Ingl\xEAs (EUA)" }),
|
|
3170
|
+
/* @__PURE__ */ jsx18("option", { value: "es_ES", children: "Espanhol" })
|
|
3195
3171
|
]
|
|
3196
3172
|
}
|
|
3197
3173
|
)
|
|
3198
3174
|
] })
|
|
3199
3175
|
] }),
|
|
3200
|
-
/* @__PURE__ */
|
|
3201
|
-
/* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3203
|
-
/* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3177
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.headerLabel }),
|
|
3178
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.headerHint }),
|
|
3179
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-2", children: [
|
|
3180
|
+
/* @__PURE__ */ jsxs16(
|
|
3205
3181
|
"select",
|
|
3206
3182
|
{
|
|
3207
3183
|
value: value.headerType,
|
|
3208
3184
|
onChange: (e) => set("headerType", e.target.value),
|
|
3209
3185
|
className: "border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 transition-all",
|
|
3210
3186
|
children: [
|
|
3211
|
-
/* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ jsx18("option", { value: "NONE", children: labels.headerNone }),
|
|
3188
|
+
/* @__PURE__ */ jsx18("option", { value: "TEXT", children: labels.headerText })
|
|
3213
3189
|
]
|
|
3214
3190
|
}
|
|
3215
3191
|
),
|
|
3216
|
-
value.headerType === "TEXT" && /* @__PURE__ */
|
|
3192
|
+
value.headerType === "TEXT" && /* @__PURE__ */ jsx18(
|
|
3217
3193
|
"input",
|
|
3218
3194
|
{
|
|
3219
3195
|
type: "text",
|
|
@@ -3226,10 +3202,10 @@ function WhatsAppCreateTemplateForm({
|
|
|
3226
3202
|
)
|
|
3227
3203
|
] })
|
|
3228
3204
|
] }),
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3206
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.bodyLabel }),
|
|
3207
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.bodyHint }),
|
|
3208
|
+
/* @__PURE__ */ jsx18(
|
|
3233
3209
|
"textarea",
|
|
3234
3210
|
{
|
|
3235
3211
|
value: value.bodyText,
|
|
@@ -3240,26 +3216,26 @@ function WhatsAppCreateTemplateForm({
|
|
|
3240
3216
|
required: true
|
|
3241
3217
|
}
|
|
3242
3218
|
),
|
|
3243
|
-
detectedVariables.length > 0 && /* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
/* @__PURE__ */
|
|
3219
|
+
detectedVariables.length > 0 && /* @__PURE__ */ jsxs16("div", { className: "mt-2 rounded-lg bg-gray-50 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-600 px-3 py-2", children: [
|
|
3220
|
+
/* @__PURE__ */ jsx18("p", { className: "font-medium text-gray-500 dark:text-gray-400 mb-1.5 uppercase tracking-wide text-xs", children: labels.detectedVariables }),
|
|
3221
|
+
/* @__PURE__ */ jsx18("div", { className: "flex flex-wrap gap-2", children: detectedVariables.map((num) => /* @__PURE__ */ jsxs16("span", { className: "inline-flex items-center gap-1 text-xs", children: [
|
|
3222
|
+
/* @__PURE__ */ jsx18("code", { className: "bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-1.5 py-0.5 rounded font-mono", children: `{{${num}}}` }),
|
|
3223
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-gray-400 dark:text-gray-500", children: [
|
|
3248
3224
|
"= ",
|
|
3249
3225
|
variableExamples[Number(num) - 1] ?? labels.variableLabel(Number(num))
|
|
3250
3226
|
] })
|
|
3251
3227
|
] }, num)) }),
|
|
3252
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ jsxs16("p", { className: "text-gray-400 dark:text-gray-500 mt-1.5 text-xs", children: [
|
|
3253
3229
|
labels.configureHintPrefix,
|
|
3254
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ jsx18("strong", { children: labels.configureHintLink }),
|
|
3255
3231
|
labels.configureHintSuffix
|
|
3256
3232
|
] })
|
|
3257
3233
|
] })
|
|
3258
3234
|
] }),
|
|
3259
|
-
/* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3262
|
-
/* @__PURE__ */
|
|
3235
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3236
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.footerLabel }),
|
|
3237
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.footerHint }),
|
|
3238
|
+
/* @__PURE__ */ jsx18(
|
|
3263
3239
|
"input",
|
|
3264
3240
|
{
|
|
3265
3241
|
type: "text",
|
|
@@ -3271,41 +3247,41 @@ function WhatsAppCreateTemplateForm({
|
|
|
3271
3247
|
}
|
|
3272
3248
|
)
|
|
3273
3249
|
] }),
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__PURE__ */
|
|
3276
|
-
/* @__PURE__ */
|
|
3277
|
-
/* @__PURE__ */
|
|
3278
|
-
/* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */
|
|
3280
|
-
/* @__PURE__ */
|
|
3281
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3251
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 block", children: labels.previewLabel }),
|
|
3252
|
+
/* @__PURE__ */ jsxs16("div", { className: "rounded-2xl bg-[#e5ddd5] dark:bg-[#1a1a2e] border border-gray-300 dark:border-gray-600 overflow-hidden shadow-inner", children: [
|
|
3253
|
+
/* @__PURE__ */ jsxs16("div", { className: "bg-[#075e54] px-4 py-2.5 flex items-center gap-2", children: [
|
|
3254
|
+
/* @__PURE__ */ jsx18("div", { className: "w-8 h-8 rounded-full bg-white/20 flex items-center justify-center text-white text-xs font-bold", children: previewCompanyName.slice(0, 2).toUpperCase() }),
|
|
3255
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3256
|
+
/* @__PURE__ */ jsx18("p", { className: "text-white text-xs font-semibold leading-tight", children: previewCompanyName }),
|
|
3257
|
+
/* @__PURE__ */ jsx18("p", { className: "text-white/60 text-xs", children: labels.previewOnline })
|
|
3282
3258
|
] })
|
|
3283
3259
|
] }),
|
|
3284
|
-
/* @__PURE__ */
|
|
3285
|
-
/* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsxs16("div", { className: "px-3 py-4 space-y-3", style: { minHeight: "120px" }, children: [
|
|
3261
|
+
/* @__PURE__ */ jsx18("div", { className: "flex justify-start", style: { maxWidth: "85%" }, children: /* @__PURE__ */ jsxs16("div", { className: "bg-white dark:bg-gray-700 rounded-lg rounded-tl-none px-3 py-2 shadow-sm", children: [
|
|
3262
|
+
/* @__PURE__ */ jsx18("p", { className: "text-gray-500 dark:text-gray-400 leading-tight text-sm", children: labels.previewDescription }),
|
|
3263
|
+
/* @__PURE__ */ jsx18("p", { className: "text-gray-400 dark:text-gray-500 mt-1 text-right text-[9px]", children: "12:00" })
|
|
3288
3264
|
] }) }),
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
value.headerType === "TEXT" && value.headerText && /* @__PURE__ */
|
|
3291
|
-
/* @__PURE__ */
|
|
3292
|
-
value.footerText && /* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3265
|
+
/* @__PURE__ */ jsx18("div", { className: "flex justify-end ml-auto", style: { maxWidth: "85%" }, children: /* @__PURE__ */ jsxs16("div", { className: "bg-[#dcf8c6] dark:bg-[#1b5e20] rounded-lg rounded-tr-none px-3 py-2 shadow-sm", children: [
|
|
3266
|
+
value.headerType === "TEXT" && value.headerText && /* @__PURE__ */ jsx18("p", { className: "text-xs font-bold text-gray-700 dark:text-gray-200 mb-1", children: fillPreviewTokens(value.headerText) || labels.previewHeaderFallback }),
|
|
3267
|
+
/* @__PURE__ */ jsx18("p", { className: "text-sm text-gray-800 dark:text-gray-100 leading-relaxed", children: value.bodyText ? fillPreviewTokens(value.bodyText) : /* @__PURE__ */ jsx18("span", { className: "text-gray-400 italic", children: labels.previewBodyPlaceholder }) }),
|
|
3268
|
+
value.footerText && /* @__PURE__ */ jsx18("p", { className: "text-gray-400 dark:text-gray-400 mt-1 text-xs", children: value.footerText }),
|
|
3269
|
+
/* @__PURE__ */ jsx18("p", { className: "text-gray-400 dark:text-gray-400 mt-1 text-right text-[9px]", children: "12:01 \u2713" })
|
|
3294
3270
|
] }) })
|
|
3295
3271
|
] })
|
|
3296
3272
|
] })
|
|
3297
3273
|
] }),
|
|
3298
|
-
result && /* @__PURE__ */
|
|
3274
|
+
result && /* @__PURE__ */ jsxs16(
|
|
3299
3275
|
"div",
|
|
3300
3276
|
{
|
|
3301
3277
|
className: `rounded-xl px-4 py-3 text-sm ${result.ok ? "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 text-green-700 dark:text-green-400" : "bg-red-50 dark:bg-red-950/40 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-400"}`,
|
|
3302
3278
|
children: [
|
|
3303
3279
|
result.message,
|
|
3304
|
-
result.ok && result.status && /* @__PURE__ */
|
|
3280
|
+
result.ok && result.status && /* @__PURE__ */ jsx18("p", { className: "text-xs mt-1 opacity-75", children: labels.successStatus(result.status) })
|
|
3305
3281
|
]
|
|
3306
3282
|
}
|
|
3307
3283
|
),
|
|
3308
|
-
/* @__PURE__ */
|
|
3284
|
+
/* @__PURE__ */ jsx18("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs16(
|
|
3309
3285
|
"button",
|
|
3310
3286
|
{
|
|
3311
3287
|
"data-cv-tooltip": submitting ? labels.sending : labels.sendForApproval,
|
|
@@ -3314,7 +3290,7 @@ function WhatsAppCreateTemplateForm({
|
|
|
3314
3290
|
disabled: submitting || !value.name || !value.bodyText,
|
|
3315
3291
|
className: "flex items-center gap-2 bg-emerald-600 hover:bg-emerald-700 disabled:bg-emerald-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
3316
3292
|
children: [
|
|
3317
|
-
submitting ? /* @__PURE__ */
|
|
3293
|
+
submitting ? /* @__PURE__ */ jsx18("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx18(SendHorizonal2, { size: 14 }),
|
|
3318
3294
|
submitting ? labels.sending : labels.sendForApproval
|
|
3319
3295
|
]
|
|
3320
3296
|
}
|
|
@@ -3325,7 +3301,7 @@ function WhatsAppCreateTemplateForm({
|
|
|
3325
3301
|
|
|
3326
3302
|
// src/settings/WelcomeFarewellForm.tsx
|
|
3327
3303
|
import { LogOut, Mail, Save as Save2 } from "lucide-react";
|
|
3328
|
-
import { jsx as
|
|
3304
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3329
3305
|
var DEFAULT_LABELS4 = {
|
|
3330
3306
|
sectionTitle: "Boas-vindas e encerramento",
|
|
3331
3307
|
welcomeMessage: "Mensagem de boas-vindas",
|
|
@@ -3353,15 +3329,15 @@ function WelcomeFarewellForm({
|
|
|
3353
3329
|
labels: labelsOverride
|
|
3354
3330
|
}) {
|
|
3355
3331
|
const labels = { ...DEFAULT_LABELS4, ...labelsOverride };
|
|
3356
|
-
return /* @__PURE__ */
|
|
3357
|
-
/* @__PURE__ */
|
|
3358
|
-
/* @__PURE__ */
|
|
3359
|
-
/* @__PURE__ */
|
|
3360
|
-
/* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3332
|
+
return /* @__PURE__ */ jsxs17("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3333
|
+
/* @__PURE__ */ jsx19("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: /* @__PURE__ */ jsx19("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }) }),
|
|
3334
|
+
/* @__PURE__ */ jsxs17("form", { onSubmit: onSave, className: "p-6 space-y-5", children: [
|
|
3335
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3336
|
+
/* @__PURE__ */ jsxs17("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 flex items-center gap-1.5", children: [
|
|
3337
|
+
/* @__PURE__ */ jsx19(Mail, { size: 13, className: "text-blue-600 dark:text-blue-400" }),
|
|
3362
3338
|
labels.welcomeMessage
|
|
3363
3339
|
] }),
|
|
3364
|
-
/* @__PURE__ */
|
|
3340
|
+
/* @__PURE__ */ jsx19(
|
|
3365
3341
|
WhatsAppMessageEditor,
|
|
3366
3342
|
{
|
|
3367
3343
|
value: welcomeMessage,
|
|
@@ -3370,14 +3346,14 @@ function WelcomeFarewellForm({
|
|
|
3370
3346
|
placeholders: welcomePlaceholders
|
|
3371
3347
|
}
|
|
3372
3348
|
),
|
|
3373
|
-
/* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ jsx19("p", { className: "mt-1.5 text-xs text-gray-500 dark:text-gray-400", children: labels.welcomeMessageHint })
|
|
3374
3350
|
] }),
|
|
3375
|
-
/* @__PURE__ */
|
|
3376
|
-
/* @__PURE__ */
|
|
3377
|
-
/* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3352
|
+
/* @__PURE__ */ jsxs17("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 flex items-center gap-1.5", children: [
|
|
3353
|
+
/* @__PURE__ */ jsx19(LogOut, { size: 13, className: "text-blue-600 dark:text-blue-400" }),
|
|
3378
3354
|
labels.farewellMessage
|
|
3379
3355
|
] }),
|
|
3380
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsx19(
|
|
3381
3357
|
WhatsAppMessageEditor,
|
|
3382
3358
|
{
|
|
3383
3359
|
value: farewellMessage,
|
|
@@ -3386,10 +3362,10 @@ function WelcomeFarewellForm({
|
|
|
3386
3362
|
placeholders: farewellPlaceholders
|
|
3387
3363
|
}
|
|
3388
3364
|
),
|
|
3389
|
-
/* @__PURE__ */
|
|
3365
|
+
/* @__PURE__ */ jsx19("p", { className: "mt-1.5 text-xs text-gray-500 dark:text-gray-400", children: labels.farewellMessageHint })
|
|
3390
3366
|
] }),
|
|
3391
|
-
saveSuccess && /* @__PURE__ */
|
|
3392
|
-
/* @__PURE__ */
|
|
3367
|
+
saveSuccess && /* @__PURE__ */ jsx19("div", { className: "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 rounded-xl px-4 py-3 text-sm text-green-700 dark:text-green-400", children: labels.saveSuccess }),
|
|
3368
|
+
/* @__PURE__ */ jsx19("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs17(
|
|
3393
3369
|
"button",
|
|
3394
3370
|
{
|
|
3395
3371
|
"data-cv-tooltip": saving ? labels.saving : labels.save,
|
|
@@ -3398,7 +3374,7 @@ function WelcomeFarewellForm({
|
|
|
3398
3374
|
disabled: saving,
|
|
3399
3375
|
className: "flex items-center gap-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
3400
3376
|
children: [
|
|
3401
|
-
saving ? /* @__PURE__ */
|
|
3377
|
+
saving ? /* @__PURE__ */ jsx19("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx19(Save2, { size: 14 }),
|
|
3402
3378
|
saving ? labels.saving : labels.save
|
|
3403
3379
|
]
|
|
3404
3380
|
}
|
|
@@ -3409,7 +3385,7 @@ function WelcomeFarewellForm({
|
|
|
3409
3385
|
|
|
3410
3386
|
// src/settings/TranscriptionSettingsForm.tsx
|
|
3411
3387
|
import { AudioLines, Save as Save3 } from "lucide-react";
|
|
3412
|
-
import { jsx as
|
|
3388
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3413
3389
|
var DEFAULT_LABELS5 = {
|
|
3414
3390
|
sectionTitle: "Transcri\xE7\xE3o de \xE1udio",
|
|
3415
3391
|
enabled: "Transcrever notas de voz",
|
|
@@ -3436,15 +3412,15 @@ function TranscriptionSettingsForm({
|
|
|
3436
3412
|
labels: labelsOverride
|
|
3437
3413
|
}) {
|
|
3438
3414
|
const labels = { ...DEFAULT_LABELS5, ...labelsOverride };
|
|
3439
|
-
return /* @__PURE__ */
|
|
3440
|
-
/* @__PURE__ */
|
|
3441
|
-
/* @__PURE__ */
|
|
3415
|
+
return /* @__PURE__ */ jsxs18("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3416
|
+
/* @__PURE__ */ jsx20("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: /* @__PURE__ */ jsxs18("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-1.5", children: [
|
|
3417
|
+
/* @__PURE__ */ jsx20(AudioLines, { size: 14, className: "text-blue-600 dark:text-blue-400" }),
|
|
3442
3418
|
labels.sectionTitle
|
|
3443
3419
|
] }) }),
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
!isAvailable && /* @__PURE__ */
|
|
3446
|
-
/* @__PURE__ */
|
|
3447
|
-
/* @__PURE__ */
|
|
3420
|
+
/* @__PURE__ */ jsxs18("form", { onSubmit: onSave, className: "p-6 space-y-5", children: [
|
|
3421
|
+
!isAvailable && /* @__PURE__ */ jsx20("div", { className: "bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded-xl px-4 py-3 text-sm text-amber-800 dark:text-amber-300", children: labels.unavailable }),
|
|
3422
|
+
/* @__PURE__ */ jsxs18("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
3423
|
+
/* @__PURE__ */ jsx20(
|
|
3448
3424
|
"input",
|
|
3449
3425
|
{
|
|
3450
3426
|
type: "checkbox",
|
|
@@ -3454,14 +3430,14 @@ function TranscriptionSettingsForm({
|
|
|
3454
3430
|
className: "mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:opacity-50"
|
|
3455
3431
|
}
|
|
3456
3432
|
),
|
|
3457
|
-
/* @__PURE__ */
|
|
3458
|
-
/* @__PURE__ */
|
|
3459
|
-
/* @__PURE__ */
|
|
3433
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3434
|
+
/* @__PURE__ */ jsx20("span", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.enabled }),
|
|
3435
|
+
/* @__PURE__ */ jsx20("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: labels.enabledHint })
|
|
3460
3436
|
] })
|
|
3461
3437
|
] }),
|
|
3462
|
-
enabled && /* @__PURE__ */
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
/* @__PURE__ */
|
|
3438
|
+
enabled && /* @__PURE__ */ jsxs18("fieldset", { disabled: !isAvailable, className: "space-y-2.5", children: [
|
|
3439
|
+
/* @__PURE__ */ jsx20("legend", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: labels.modeTitle }),
|
|
3440
|
+
/* @__PURE__ */ jsx20(
|
|
3465
3441
|
ModeOption,
|
|
3466
3442
|
{
|
|
3467
3443
|
value: "onDemand",
|
|
@@ -3471,7 +3447,7 @@ function TranscriptionSettingsForm({
|
|
|
3471
3447
|
hint: labels.modeOnDemandHint
|
|
3472
3448
|
}
|
|
3473
3449
|
),
|
|
3474
|
-
/* @__PURE__ */
|
|
3450
|
+
/* @__PURE__ */ jsx20(
|
|
3475
3451
|
ModeOption,
|
|
3476
3452
|
{
|
|
3477
3453
|
value: "auto",
|
|
@@ -3482,8 +3458,8 @@ function TranscriptionSettingsForm({
|
|
|
3482
3458
|
}
|
|
3483
3459
|
)
|
|
3484
3460
|
] }),
|
|
3485
|
-
saveSuccess && /* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3461
|
+
saveSuccess && /* @__PURE__ */ jsx20("div", { className: "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 rounded-xl px-4 py-3 text-sm text-green-700 dark:text-green-400", children: labels.saveSuccess }),
|
|
3462
|
+
/* @__PURE__ */ jsx20("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs18(
|
|
3487
3463
|
"button",
|
|
3488
3464
|
{
|
|
3489
3465
|
"data-cv-tooltip": saving ? labels.saving : labels.save,
|
|
@@ -3492,7 +3468,7 @@ function TranscriptionSettingsForm({
|
|
|
3492
3468
|
disabled: saving || !isAvailable,
|
|
3493
3469
|
className: "flex items-center gap-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
3494
3470
|
children: [
|
|
3495
|
-
saving ? /* @__PURE__ */
|
|
3471
|
+
saving ? /* @__PURE__ */ jsx20("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx20(Save3, { size: 14 }),
|
|
3496
3472
|
saving ? labels.saving : labels.save
|
|
3497
3473
|
]
|
|
3498
3474
|
}
|
|
@@ -3508,12 +3484,12 @@ function ModeOption({
|
|
|
3508
3484
|
hint
|
|
3509
3485
|
}) {
|
|
3510
3486
|
const isSelected = current === value;
|
|
3511
|
-
return /* @__PURE__ */
|
|
3487
|
+
return /* @__PURE__ */ jsxs18(
|
|
3512
3488
|
"label",
|
|
3513
3489
|
{
|
|
3514
3490
|
className: `flex items-start gap-3 cursor-pointer rounded-xl border px-4 py-3 transition-colors ${isSelected ? "border-blue-500 bg-blue-50 dark:border-blue-500 dark:bg-blue-950/30" : "border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600"}`,
|
|
3515
3491
|
children: [
|
|
3516
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsx20(
|
|
3517
3493
|
"input",
|
|
3518
3494
|
{
|
|
3519
3495
|
type: "radio",
|
|
@@ -3524,9 +3500,9 @@ function ModeOption({
|
|
|
3524
3500
|
className: "mt-0.5 h-4 w-4 border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
3525
3501
|
}
|
|
3526
3502
|
),
|
|
3527
|
-
/* @__PURE__ */
|
|
3528
|
-
/* @__PURE__ */
|
|
3529
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
3504
|
+
/* @__PURE__ */ jsx20("span", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: title }),
|
|
3505
|
+
/* @__PURE__ */ jsx20("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: hint })
|
|
3530
3506
|
] })
|
|
3531
3507
|
]
|
|
3532
3508
|
}
|
|
@@ -3534,8 +3510,8 @@ function ModeOption({
|
|
|
3534
3510
|
}
|
|
3535
3511
|
|
|
3536
3512
|
// src/settings/WhatsAppTemplatesSettings.tsx
|
|
3537
|
-
import { useState as
|
|
3538
|
-
import { jsx as
|
|
3513
|
+
import { useState as useState12 } from "react";
|
|
3514
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3539
3515
|
var TEMPLATE_SETTINGS_TAB = {
|
|
3540
3516
|
SELECT: "select",
|
|
3541
3517
|
CREATE: "create"
|
|
@@ -3552,10 +3528,10 @@ function WhatsAppTemplatesSettings({
|
|
|
3552
3528
|
...settingsProps
|
|
3553
3529
|
}) {
|
|
3554
3530
|
const labels = { ...DEFAULT_TEMPLATES_SETTINGS_LABELS, ...labelsOverride };
|
|
3555
|
-
const [tab, setTab] =
|
|
3556
|
-
return /* @__PURE__ */
|
|
3557
|
-
/* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3531
|
+
const [tab, setTab] = useState12(TEMPLATE_SETTINGS_TAB.SELECT);
|
|
3532
|
+
return /* @__PURE__ */ jsxs19("div", { className: "space-y-4", children: [
|
|
3533
|
+
/* @__PURE__ */ jsxs19("nav", { className: "flex gap-1 border-b", role: "tablist", children: [
|
|
3534
|
+
/* @__PURE__ */ jsx21(
|
|
3559
3535
|
"button",
|
|
3560
3536
|
{
|
|
3561
3537
|
"data-cv-tooltip": labels.selectTab,
|
|
@@ -3568,7 +3544,7 @@ function WhatsAppTemplatesSettings({
|
|
|
3568
3544
|
children: labels.selectTab
|
|
3569
3545
|
}
|
|
3570
3546
|
),
|
|
3571
|
-
create ? /* @__PURE__ */
|
|
3547
|
+
create ? /* @__PURE__ */ jsx21(
|
|
3572
3548
|
"button",
|
|
3573
3549
|
{
|
|
3574
3550
|
"data-cv-tooltip": labels.createTab,
|
|
@@ -3582,16 +3558,16 @@ function WhatsAppTemplatesSettings({
|
|
|
3582
3558
|
}
|
|
3583
3559
|
) : null
|
|
3584
3560
|
] }),
|
|
3585
|
-
tab === TEMPLATE_SETTINGS_TAB.SELECT ? /* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */
|
|
3561
|
+
tab === TEMPLATE_SETTINGS_TAB.SELECT ? /* @__PURE__ */ jsxs19("div", { className: "space-y-6", children: [
|
|
3562
|
+
/* @__PURE__ */ jsx21(WhatsAppTemplateSettingsForm, { ...settingsProps, ...settingsLabels ? { labels: settingsLabels } : {} }),
|
|
3587
3563
|
extraRoleForms
|
|
3588
|
-
] }) : create ? /* @__PURE__ */
|
|
3564
|
+
] }) : create ? /* @__PURE__ */ jsx21(WhatsAppCreateTemplateForm, { ...create }) : null
|
|
3589
3565
|
] });
|
|
3590
3566
|
}
|
|
3591
3567
|
|
|
3592
3568
|
// src/settings/TopicsForm.tsx
|
|
3593
3569
|
import { Megaphone, Save as Save4 } from "lucide-react";
|
|
3594
|
-
import { jsx as
|
|
3570
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3595
3571
|
var DEFAULT_LABELS6 = {
|
|
3596
3572
|
sectionTitle: "T\xF3picos intermedi\xE1rios",
|
|
3597
3573
|
sectionDescription: "Mensagens autom\xE1ticas para assuntos espec\xEDficos, disparadas quando o cliente demonstra interesse.",
|
|
@@ -3609,19 +3585,19 @@ function TopicsForm({
|
|
|
3609
3585
|
labels: labelsOverride
|
|
3610
3586
|
}) {
|
|
3611
3587
|
const labels = { ...DEFAULT_LABELS6, ...labelsOverride };
|
|
3612
|
-
return /* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
/* @__PURE__ */
|
|
3615
|
-
/* @__PURE__ */
|
|
3588
|
+
return /* @__PURE__ */ jsxs20("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3589
|
+
/* @__PURE__ */ jsxs20("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
3590
|
+
/* @__PURE__ */ jsxs20("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2", children: [
|
|
3591
|
+
/* @__PURE__ */ jsx22(Megaphone, { size: 16, className: "text-orange-600 dark:text-orange-400" }),
|
|
3616
3592
|
labels.sectionTitle
|
|
3617
3593
|
] }),
|
|
3618
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx22("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
3619
3595
|
] }),
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
topics.map((topic) => /* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
3624
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsxs20("form", { onSubmit: onSave, className: "p-6 space-y-6", children: [
|
|
3597
|
+
topics.map((topic) => /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
3598
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-4", children: [
|
|
3599
|
+
/* @__PURE__ */ jsx22("div", { className: "flex-1", children: /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: topic.label }) }),
|
|
3600
|
+
/* @__PURE__ */ jsx22(
|
|
3625
3601
|
"button",
|
|
3626
3602
|
{
|
|
3627
3603
|
"data-cv-tooltip": topic.label,
|
|
@@ -3631,7 +3607,7 @@ function TopicsForm({
|
|
|
3631
3607
|
className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${topic.enabled ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-200 dark:bg-gray-700"}`,
|
|
3632
3608
|
role: "switch",
|
|
3633
3609
|
"aria-checked": topic.enabled,
|
|
3634
|
-
children: /* @__PURE__ */
|
|
3610
|
+
children: /* @__PURE__ */ jsx22(
|
|
3635
3611
|
"span",
|
|
3636
3612
|
{
|
|
3637
3613
|
className: `pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${topic.enabled ? "translate-x-5" : "translate-x-0"}`
|
|
@@ -3640,7 +3616,7 @@ function TopicsForm({
|
|
|
3640
3616
|
}
|
|
3641
3617
|
)
|
|
3642
3618
|
] }),
|
|
3643
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsx22(
|
|
3644
3620
|
"textarea",
|
|
3645
3621
|
{
|
|
3646
3622
|
value: topic.message,
|
|
@@ -3652,8 +3628,8 @@ function TopicsForm({
|
|
|
3652
3628
|
}
|
|
3653
3629
|
)
|
|
3654
3630
|
] }, topic.key)),
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3631
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3", children: [
|
|
3632
|
+
/* @__PURE__ */ jsxs20(
|
|
3657
3633
|
"button",
|
|
3658
3634
|
{
|
|
3659
3635
|
"data-cv-tooltip": labels.saveButton,
|
|
@@ -3662,20 +3638,20 @@ function TopicsForm({
|
|
|
3662
3638
|
disabled: saving,
|
|
3663
3639
|
className: "inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50",
|
|
3664
3640
|
children: [
|
|
3665
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ jsx22(Save4, { size: 14 }),
|
|
3666
3642
|
labels.saveButton
|
|
3667
3643
|
]
|
|
3668
3644
|
}
|
|
3669
3645
|
),
|
|
3670
|
-
saveSuccess && /* @__PURE__ */
|
|
3646
|
+
saveSuccess && /* @__PURE__ */ jsx22("span", { className: "text-sm text-green-600 dark:text-green-400", children: labels.saveSuccess })
|
|
3671
3647
|
] })
|
|
3672
3648
|
] })
|
|
3673
3649
|
] });
|
|
3674
3650
|
}
|
|
3675
3651
|
|
|
3676
3652
|
// src/settings/MessagesWorkspace.tsx
|
|
3677
|
-
import { useCallback as
|
|
3678
|
-
import { Fragment as Fragment6, jsx as
|
|
3653
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useState as useState13 } from "react";
|
|
3654
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3679
3655
|
var DEFAULT_LABELS7 = {
|
|
3680
3656
|
title: "Mensagens",
|
|
3681
3657
|
subtitle: "Mensagens do bot e templates do WhatsApp.",
|
|
@@ -3733,30 +3709,30 @@ function MessagesWorkspace({
|
|
|
3733
3709
|
const hasTopics = Boolean(api.getTopics && api.saveTopics);
|
|
3734
3710
|
const hasTemplates = Boolean(api.getTemplateSettings && api.saveTemplateSettings);
|
|
3735
3711
|
const hasTranscription = Boolean(api.getTranscription && api.saveTranscription);
|
|
3736
|
-
const [tab, setTab] =
|
|
3737
|
-
const [loadState, setLoadState] =
|
|
3738
|
-
const [messages, setMessages] =
|
|
3739
|
-
const [savingMessages, setSavingMessages] =
|
|
3740
|
-
const [messagesSaved, setMessagesSaved] =
|
|
3741
|
-
const [topics, setTopics] =
|
|
3742
|
-
const [savingTopics, setSavingTopics] =
|
|
3743
|
-
const [topicsSaved, setTopicsSaved] =
|
|
3744
|
-
const [templateSettings, setTemplateSettings] =
|
|
3745
|
-
const [templates, setTemplates] =
|
|
3746
|
-
const [loadingTemplates, setLoadingTemplates] =
|
|
3747
|
-
const [templatesError, setTemplatesError] =
|
|
3748
|
-
const [savingTemplate, setSavingTemplate] =
|
|
3749
|
-
const [templateSaved, setTemplateSaved] =
|
|
3750
|
-
const [roleSettings, setRoleSettings] =
|
|
3751
|
-
const [savingRole, setSavingRole] =
|
|
3752
|
-
const [roleSaved, setRoleSaved] =
|
|
3753
|
-
const [createTemplate, setCreateTemplate] =
|
|
3754
|
-
const [creatingTemplate, setCreatingTemplate] =
|
|
3755
|
-
const [createResult, setCreateResult] =
|
|
3756
|
-
const [transcription, setTranscription] =
|
|
3757
|
-
const [savingTranscription, setSavingTranscription] =
|
|
3758
|
-
const [transcriptionSaved, setTranscriptionSaved] =
|
|
3759
|
-
const reloadTemplates =
|
|
3712
|
+
const [tab, setTab] = useState13(MESSAGES_TAB.BOT);
|
|
3713
|
+
const [loadState, setLoadState] = useState13("loading");
|
|
3714
|
+
const [messages, setMessages] = useState13(EMPTY_MESSAGES);
|
|
3715
|
+
const [savingMessages, setSavingMessages] = useState13(false);
|
|
3716
|
+
const [messagesSaved, setMessagesSaved] = useState13(false);
|
|
3717
|
+
const [topics, setTopics] = useState13([]);
|
|
3718
|
+
const [savingTopics, setSavingTopics] = useState13(false);
|
|
3719
|
+
const [topicsSaved, setTopicsSaved] = useState13(false);
|
|
3720
|
+
const [templateSettings, setTemplateSettings] = useState13(EMPTY_TEMPLATE_SETTINGS);
|
|
3721
|
+
const [templates, setTemplates] = useState13([]);
|
|
3722
|
+
const [loadingTemplates, setLoadingTemplates] = useState13(false);
|
|
3723
|
+
const [templatesError, setTemplatesError] = useState13(false);
|
|
3724
|
+
const [savingTemplate, setSavingTemplate] = useState13(false);
|
|
3725
|
+
const [templateSaved, setTemplateSaved] = useState13(false);
|
|
3726
|
+
const [roleSettings, setRoleSettings] = useState13({});
|
|
3727
|
+
const [savingRole, setSavingRole] = useState13({});
|
|
3728
|
+
const [roleSaved, setRoleSaved] = useState13({});
|
|
3729
|
+
const [createTemplate, setCreateTemplate] = useState13(EMPTY_CREATE_TEMPLATE);
|
|
3730
|
+
const [creatingTemplate, setCreatingTemplate] = useState13(false);
|
|
3731
|
+
const [createResult, setCreateResult] = useState13(null);
|
|
3732
|
+
const [transcription, setTranscription] = useState13(UNDECIDED_TRANSCRIPTION);
|
|
3733
|
+
const [savingTranscription, setSavingTranscription] = useState13(false);
|
|
3734
|
+
const [transcriptionSaved, setTranscriptionSaved] = useState13(false);
|
|
3735
|
+
const reloadTemplates = useCallback5(async () => {
|
|
3760
3736
|
if (!api.listTemplates) return;
|
|
3761
3737
|
setLoadingTemplates(true);
|
|
3762
3738
|
setTemplatesError(false);
|
|
@@ -3906,23 +3882,23 @@ function MessagesWorkspace({
|
|
|
3906
3882
|
});
|
|
3907
3883
|
}
|
|
3908
3884
|
if (loadState === "loading") {
|
|
3909
|
-
return /* @__PURE__ */
|
|
3885
|
+
return /* @__PURE__ */ jsx23("p", { className: "p-6 text-sm text-gray-500 dark:text-gray-400", children: labels.loading });
|
|
3910
3886
|
}
|
|
3911
3887
|
if (loadState === "error") {
|
|
3912
|
-
return /* @__PURE__ */
|
|
3888
|
+
return /* @__PURE__ */ jsx23("p", { role: "alert", className: "p-6 text-sm text-red-600 dark:text-red-400", children: labels.loadError });
|
|
3913
3889
|
}
|
|
3914
3890
|
const tabs = [
|
|
3915
3891
|
{ id: MESSAGES_TAB.BOT, label: labels.tabBot },
|
|
3916
3892
|
...hasTemplates ? [{ id: MESSAGES_TAB.TEMPLATES, label: labels.tabTemplates }] : [],
|
|
3917
3893
|
...hasTranscription ? [{ id: MESSAGES_TAB.TRANSCRIPTION, label: labels.tabTranscription }] : []
|
|
3918
3894
|
];
|
|
3919
|
-
return /* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
3922
|
-
/* @__PURE__ */
|
|
3923
|
-
/* @__PURE__ */
|
|
3895
|
+
return /* @__PURE__ */ jsxs21("div", { className: `space-y-6 p-4 lg:p-0 ${className ?? ""}`, children: [
|
|
3896
|
+
/* @__PURE__ */ jsx23(TooltipLayer, {}),
|
|
3897
|
+
/* @__PURE__ */ jsxs21("header", { children: [
|
|
3898
|
+
/* @__PURE__ */ jsx23("h1", { className: "text-xl font-semibold text-gray-900 dark:text-gray-100", children: labels.title }),
|
|
3899
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: labels.subtitle })
|
|
3924
3900
|
] }),
|
|
3925
|
-
tabs.length > 1 ? /* @__PURE__ */
|
|
3901
|
+
tabs.length > 1 ? /* @__PURE__ */ jsx23("nav", { className: "flex gap-1 border-b border-gray-200 dark:border-gray-700", role: "tablist", children: tabs.map((item) => /* @__PURE__ */ jsx23(
|
|
3926
3902
|
"button",
|
|
3927
3903
|
{
|
|
3928
3904
|
"data-cv-tooltip": item.label,
|
|
@@ -3936,8 +3912,8 @@ function MessagesWorkspace({
|
|
|
3936
3912
|
},
|
|
3937
3913
|
item.id
|
|
3938
3914
|
)) }) : null,
|
|
3939
|
-
tab === MESSAGES_TAB.BOT ? /* @__PURE__ */
|
|
3940
|
-
/* @__PURE__ */
|
|
3915
|
+
tab === MESSAGES_TAB.BOT ? /* @__PURE__ */ jsxs21("div", { className: "space-y-8", children: [
|
|
3916
|
+
/* @__PURE__ */ jsx23(
|
|
3941
3917
|
WelcomeFarewellForm,
|
|
3942
3918
|
{
|
|
3943
3919
|
welcomeMessage: messages.welcomeMessage,
|
|
@@ -3952,7 +3928,7 @@ function MessagesWorkspace({
|
|
|
3952
3928
|
...farewellPlaceholders ? { farewellPlaceholders } : {}
|
|
3953
3929
|
}
|
|
3954
3930
|
),
|
|
3955
|
-
hasTopics ? /* @__PURE__ */
|
|
3931
|
+
hasTopics ? /* @__PURE__ */ jsx23(
|
|
3956
3932
|
TopicsForm,
|
|
3957
3933
|
{
|
|
3958
3934
|
topics,
|
|
@@ -3969,9 +3945,9 @@ function MessagesWorkspace({
|
|
|
3969
3945
|
}
|
|
3970
3946
|
) : null
|
|
3971
3947
|
] }) : null,
|
|
3972
|
-
tab === MESSAGES_TAB.TEMPLATES ? /* @__PURE__ */
|
|
3948
|
+
tab === MESSAGES_TAB.TEMPLATES ? /* @__PURE__ */ jsxs21("div", { className: "space-y-4", children: [
|
|
3973
3949
|
renderTemplatesNotice?.(),
|
|
3974
|
-
/* @__PURE__ */
|
|
3950
|
+
/* @__PURE__ */ jsx23(
|
|
3975
3951
|
WhatsAppTemplatesSettings,
|
|
3976
3952
|
{
|
|
3977
3953
|
templates,
|
|
@@ -4001,9 +3977,9 @@ function MessagesWorkspace({
|
|
|
4001
3977
|
}
|
|
4002
3978
|
} : {},
|
|
4003
3979
|
...templateRoles.length > 0 ? {
|
|
4004
|
-
extraRoleForms: /* @__PURE__ */
|
|
3980
|
+
extraRoleForms: /* @__PURE__ */ jsx23(Fragment6, { children: templateRoles.map((role) => {
|
|
4005
3981
|
const settings = roleSettings[role.key] ?? EMPTY_TEMPLATE_SETTINGS;
|
|
4006
|
-
return /* @__PURE__ */
|
|
3982
|
+
return /* @__PURE__ */ jsx23(
|
|
4007
3983
|
WhatsAppTemplateSettingsForm,
|
|
4008
3984
|
{
|
|
4009
3985
|
templates,
|
|
@@ -4030,7 +4006,7 @@ function MessagesWorkspace({
|
|
|
4030
4006
|
}
|
|
4031
4007
|
)
|
|
4032
4008
|
] }) : null,
|
|
4033
|
-
tab === MESSAGES_TAB.TRANSCRIPTION ? /* @__PURE__ */
|
|
4009
|
+
tab === MESSAGES_TAB.TRANSCRIPTION ? /* @__PURE__ */ jsx23(
|
|
4034
4010
|
TranscriptionSettingsForm,
|
|
4035
4011
|
{
|
|
4036
4012
|
enabled: transcription.enabled,
|
|
@@ -4048,7 +4024,7 @@ function MessagesWorkspace({
|
|
|
4048
4024
|
}
|
|
4049
4025
|
|
|
4050
4026
|
// src/hooks/useConversationMessages.ts
|
|
4051
|
-
import { useCallback as
|
|
4027
|
+
import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef7, useState as useState14 } from "react";
|
|
4052
4028
|
var OLDER_MESSAGES_PAGE_LIMIT = 50;
|
|
4053
4029
|
function dedupeMessagesById(messages) {
|
|
4054
4030
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -4082,16 +4058,16 @@ function useConversationMessages(conversationId, params) {
|
|
|
4082
4058
|
() => api.fetchMessages(conversationId, params),
|
|
4083
4059
|
[conversationId, params?.limit, params?.before]
|
|
4084
4060
|
);
|
|
4085
|
-
const [olderMessages, setOlderMessages] =
|
|
4086
|
-
const [hasMoreOlderMessages, setHasMoreOlderMessages] =
|
|
4087
|
-
const [loadingOlderMessages, setLoadingOlderMessages] =
|
|
4061
|
+
const [olderMessages, setOlderMessages] = useState14([]);
|
|
4062
|
+
const [hasMoreOlderMessages, setHasMoreOlderMessages] = useState14(true);
|
|
4063
|
+
const [loadingOlderMessages, setLoadingOlderMessages] = useState14(false);
|
|
4088
4064
|
const loadingOlderMessagesRef = useRef7(false);
|
|
4089
4065
|
useEffect10(() => {
|
|
4090
4066
|
setOlderMessages([]);
|
|
4091
4067
|
setHasMoreOlderMessages(true);
|
|
4092
4068
|
}, [conversationId]);
|
|
4093
4069
|
const messages = useMemo3(() => dedupeMessagesById([...olderMessages, ...data ?? []]), [olderMessages, data]);
|
|
4094
|
-
const loadOlderMessages =
|
|
4070
|
+
const loadOlderMessages = useCallback6(async () => {
|
|
4095
4071
|
const oldestMessage = messages[0];
|
|
4096
4072
|
if (!shouldFetchOlderMessages({
|
|
4097
4073
|
isLoading: loadingOlderMessagesRef.current,
|
|
@@ -4114,7 +4090,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
4114
4090
|
setLoadingOlderMessages(false);
|
|
4115
4091
|
}
|
|
4116
4092
|
}, [api, conversationId, hasMoreOlderMessages, messages]);
|
|
4117
|
-
const sendMessage =
|
|
4093
|
+
const sendMessage = useCallback6(
|
|
4118
4094
|
async (text) => {
|
|
4119
4095
|
const message = await api.sendMessage(conversationId, text);
|
|
4120
4096
|
await refetch();
|
|
@@ -4122,7 +4098,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
4122
4098
|
},
|
|
4123
4099
|
[api, conversationId, refetch]
|
|
4124
4100
|
);
|
|
4125
|
-
const sendMedia =
|
|
4101
|
+
const sendMedia = useCallback6(
|
|
4126
4102
|
async (mediaData) => {
|
|
4127
4103
|
const message = await api.sendMedia(conversationId, mediaData);
|
|
4128
4104
|
await refetch();
|
|
@@ -4130,14 +4106,14 @@ function useConversationMessages(conversationId, params) {
|
|
|
4130
4106
|
},
|
|
4131
4107
|
[api, conversationId, refetch]
|
|
4132
4108
|
);
|
|
4133
|
-
const sendTemplate =
|
|
4109
|
+
const sendTemplate = useCallback6(
|
|
4134
4110
|
async (templateData) => {
|
|
4135
4111
|
await api.sendTemplate(conversationId, templateData);
|
|
4136
4112
|
await refetch();
|
|
4137
4113
|
},
|
|
4138
4114
|
[api, conversationId, refetch]
|
|
4139
4115
|
);
|
|
4140
|
-
const markRead =
|
|
4116
|
+
const markRead = useCallback6(() => api.markRead(conversationId), [api, conversationId]);
|
|
4141
4117
|
return {
|
|
4142
4118
|
messages,
|
|
4143
4119
|
loading,
|
|
@@ -4154,7 +4130,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
4154
4130
|
}
|
|
4155
4131
|
|
|
4156
4132
|
// src/hooks/useScrollToLatestMessage.ts
|
|
4157
|
-
import { useCallback as
|
|
4133
|
+
import { useCallback as useCallback7, useLayoutEffect, useRef as useRef8, useState as useState15 } from "react";
|
|
4158
4134
|
var NEAR_BOTTOM_THRESHOLD_PX = 120;
|
|
4159
4135
|
var SCROLL_BEHAVIOR = "auto";
|
|
4160
4136
|
function useScrollToLatestMessage({
|
|
@@ -4162,14 +4138,14 @@ function useScrollToLatestMessage({
|
|
|
4162
4138
|
messageCount
|
|
4163
4139
|
}) {
|
|
4164
4140
|
const containerRef = useRef8(null);
|
|
4165
|
-
const [isAwayFromBottom, setIsAwayFromBottom] =
|
|
4141
|
+
const [isAwayFromBottom, setIsAwayFromBottom] = useState15(false);
|
|
4166
4142
|
const isAwayFromBottomRef = useRef8(false);
|
|
4167
|
-
const scrollToBottom =
|
|
4143
|
+
const scrollToBottom = useCallback7((behavior = SCROLL_BEHAVIOR) => {
|
|
4168
4144
|
const container = containerRef.current;
|
|
4169
4145
|
if (!container) return;
|
|
4170
4146
|
container.scrollTo({ top: container.scrollHeight, behavior });
|
|
4171
4147
|
}, []);
|
|
4172
|
-
const handleScroll =
|
|
4148
|
+
const handleScroll = useCallback7((event) => {
|
|
4173
4149
|
const target = event.currentTarget;
|
|
4174
4150
|
const distanceFromBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
4175
4151
|
const away = distanceFromBottom > NEAR_BOTTOM_THRESHOLD_PX;
|
|
@@ -4422,11 +4398,11 @@ async function sendQueuedMessage(params) {
|
|
|
4422
4398
|
}
|
|
4423
4399
|
|
|
4424
4400
|
// src/quickReplies/QuickRepliesWorkspace.tsx
|
|
4425
|
-
import { useEffect as useEffect14, useId as useId2, useRef as useRef12, useState as
|
|
4401
|
+
import { useEffect as useEffect14, useId as useId2, useRef as useRef12, useState as useState18 } from "react";
|
|
4426
4402
|
import { Pencil as Pencil2, Plus as Plus2, Trash2 as Trash23 } from "lucide-react";
|
|
4427
4403
|
|
|
4428
4404
|
// src/quickReplies/useQuickRepliesWorkspace.ts
|
|
4429
|
-
import { useCallback as
|
|
4405
|
+
import { useCallback as useCallback9, useEffect as useEffect13, useState as useState17 } from "react";
|
|
4430
4406
|
|
|
4431
4407
|
// src/quickReplies/quickReplyAttachmentUpload.ts
|
|
4432
4408
|
function validateAttachmentFiles(files, currentCount, limits) {
|
|
@@ -4458,7 +4434,7 @@ function moveAttachment(list, index, direction) {
|
|
|
4458
4434
|
}
|
|
4459
4435
|
|
|
4460
4436
|
// src/quickReplies/useQuickReplyAttachmentUploads.ts
|
|
4461
|
-
import { useCallback as
|
|
4437
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef10, useState as useState16 } from "react";
|
|
4462
4438
|
|
|
4463
4439
|
// src/quickReplies/createUploadQueue.ts
|
|
4464
4440
|
function createUploadQueue(maxConcurrent) {
|
|
@@ -4514,8 +4490,8 @@ function useQuickReplyAttachmentUploads({
|
|
|
4514
4490
|
attachmentsCount,
|
|
4515
4491
|
onUploaded
|
|
4516
4492
|
}) {
|
|
4517
|
-
const [pendingUploads, setPendingUploads] =
|
|
4518
|
-
const [attachmentRejections, setAttachmentRejections] =
|
|
4493
|
+
const [pendingUploads, setPendingUploads] = useState16([]);
|
|
4494
|
+
const [attachmentRejections, setAttachmentRejections] = useState16([]);
|
|
4519
4495
|
const uploadQueueRef = useRef10(createUploadQueue(3));
|
|
4520
4496
|
const isMountedRef = useRef10(true);
|
|
4521
4497
|
useEffect12(
|
|
@@ -4525,19 +4501,19 @@ function useQuickReplyAttachmentUploads({
|
|
|
4525
4501
|
},
|
|
4526
4502
|
[]
|
|
4527
4503
|
);
|
|
4528
|
-
const abortAllUploads =
|
|
4504
|
+
const abortAllUploads = useCallback8(() => {
|
|
4529
4505
|
uploadQueueRef.current.abortAll();
|
|
4530
4506
|
setPendingUploads([]);
|
|
4531
4507
|
}, []);
|
|
4532
|
-
const dismissAttachmentRejections =
|
|
4533
|
-
const cancelAttachmentUpload =
|
|
4508
|
+
const dismissAttachmentRejections = useCallback8(() => setAttachmentRejections([]), []);
|
|
4509
|
+
const cancelAttachmentUpload = useCallback8((localId) => {
|
|
4534
4510
|
uploadQueueRef.current.abort(localId);
|
|
4535
4511
|
setPendingUploads((current) => current.filter((item) => item.localId !== localId));
|
|
4536
4512
|
}, []);
|
|
4537
|
-
const updatePendingUpload =
|
|
4513
|
+
const updatePendingUpload = useCallback8((localId, patch) => {
|
|
4538
4514
|
setPendingUploads((current) => current.map((item) => item.localId === localId ? { ...item, ...patch } : item));
|
|
4539
4515
|
}, []);
|
|
4540
|
-
const uploadOneFile =
|
|
4516
|
+
const uploadOneFile = useCallback8(
|
|
4541
4517
|
(localId, file) => {
|
|
4542
4518
|
if (!upload) return;
|
|
4543
4519
|
uploadQueueRef.current.enqueue(localId, async (signal) => {
|
|
@@ -4562,7 +4538,7 @@ function useQuickReplyAttachmentUploads({
|
|
|
4562
4538
|
},
|
|
4563
4539
|
[upload, updatePendingUpload, onUploaded, labels.saveError]
|
|
4564
4540
|
);
|
|
4565
|
-
const retryAttachmentUpload =
|
|
4541
|
+
const retryAttachmentUpload = useCallback8(
|
|
4566
4542
|
(localId) => {
|
|
4567
4543
|
const item = pendingUploads.find((pending) => pending.localId === localId);
|
|
4568
4544
|
if (!item) return;
|
|
@@ -4571,7 +4547,7 @@ function useQuickReplyAttachmentUploads({
|
|
|
4571
4547
|
},
|
|
4572
4548
|
[pendingUploads, updatePendingUpload, uploadOneFile]
|
|
4573
4549
|
);
|
|
4574
|
-
const addAttachmentFiles =
|
|
4550
|
+
const addAttachmentFiles = useCallback8(
|
|
4575
4551
|
(files) => {
|
|
4576
4552
|
if (!upload) return;
|
|
4577
4553
|
const currentCount = attachmentsCount + pendingUploads.length;
|
|
@@ -4696,16 +4672,16 @@ function useQuickRepliesWorkspace({
|
|
|
4696
4672
|
labels,
|
|
4697
4673
|
attachmentSizeLimits
|
|
4698
4674
|
}) {
|
|
4699
|
-
const [quickReplies, setQuickReplies] =
|
|
4700
|
-
const [isLoading, setIsLoading] =
|
|
4701
|
-
const [loadError, setLoadError] =
|
|
4702
|
-
const [search, setSearch] =
|
|
4703
|
-
const [editing, setEditing] =
|
|
4704
|
-
const [fieldErrors, setFieldErrors] =
|
|
4705
|
-
const [isSaving, setIsSaving] =
|
|
4706
|
-
const [saveError, setSaveError] =
|
|
4707
|
-
const [deletingId, setDeletingId] =
|
|
4708
|
-
const uploadAttachment =
|
|
4675
|
+
const [quickReplies, setQuickReplies] = useState17([]);
|
|
4676
|
+
const [isLoading, setIsLoading] = useState17(false);
|
|
4677
|
+
const [loadError, setLoadError] = useState17(void 0);
|
|
4678
|
+
const [search, setSearch] = useState17("");
|
|
4679
|
+
const [editing, setEditing] = useState17(void 0);
|
|
4680
|
+
const [fieldErrors, setFieldErrors] = useState17({});
|
|
4681
|
+
const [isSaving, setIsSaving] = useState17(false);
|
|
4682
|
+
const [saveError, setSaveError] = useState17(void 0);
|
|
4683
|
+
const [deletingId, setDeletingId] = useState17(void 0);
|
|
4684
|
+
const uploadAttachment = useCallback9((attachment) => {
|
|
4709
4685
|
setEditing((current) => current ? { ...current, attachments: [...current.attachments, attachment] } : current);
|
|
4710
4686
|
}, []);
|
|
4711
4687
|
const {
|
|
@@ -4740,14 +4716,14 @@ function useQuickRepliesWorkspace({
|
|
|
4740
4716
|
};
|
|
4741
4717
|
}, [api.listQuickReplies]);
|
|
4742
4718
|
const filtered = filterQuickReplies({ quickReplies, search });
|
|
4743
|
-
const startCreate =
|
|
4719
|
+
const startCreate = useCallback9(() => {
|
|
4744
4720
|
abortAllUploads();
|
|
4745
4721
|
dismissAttachmentRejections();
|
|
4746
4722
|
setEditing({ id: null, title: "", shortcut: "", body: "", attachments: [] });
|
|
4747
4723
|
setFieldErrors({});
|
|
4748
4724
|
setSaveError(void 0);
|
|
4749
4725
|
}, [abortAllUploads, dismissAttachmentRejections]);
|
|
4750
|
-
const startEdit =
|
|
4726
|
+
const startEdit = useCallback9(
|
|
4751
4727
|
(quickReply) => {
|
|
4752
4728
|
abortAllUploads();
|
|
4753
4729
|
dismissAttachmentRejections();
|
|
@@ -4763,14 +4739,14 @@ function useQuickRepliesWorkspace({
|
|
|
4763
4739
|
},
|
|
4764
4740
|
[abortAllUploads, dismissAttachmentRejections]
|
|
4765
4741
|
);
|
|
4766
|
-
const cancelEdit =
|
|
4742
|
+
const cancelEdit = useCallback9(() => {
|
|
4767
4743
|
abortAllUploads();
|
|
4768
4744
|
dismissAttachmentRejections();
|
|
4769
4745
|
setEditing(void 0);
|
|
4770
4746
|
setFieldErrors({});
|
|
4771
4747
|
setSaveError(void 0);
|
|
4772
4748
|
}, [abortAllUploads, dismissAttachmentRejections]);
|
|
4773
|
-
const updateField =
|
|
4749
|
+
const updateField = useCallback9((field, value) => {
|
|
4774
4750
|
setEditing((current) => current ? { ...current, [field]: value } : current);
|
|
4775
4751
|
setFieldErrors((current) => {
|
|
4776
4752
|
if (!(field in current)) return current;
|
|
@@ -4779,7 +4755,7 @@ function useQuickRepliesWorkspace({
|
|
|
4779
4755
|
return next;
|
|
4780
4756
|
});
|
|
4781
4757
|
}, []);
|
|
4782
|
-
const submit =
|
|
4758
|
+
const submit = useCallback9(async () => {
|
|
4783
4759
|
if (!editing || pendingUploads.length > 0) return;
|
|
4784
4760
|
setIsSaving(true);
|
|
4785
4761
|
setSaveError(void 0);
|
|
@@ -4796,7 +4772,7 @@ function useQuickRepliesWorkspace({
|
|
|
4796
4772
|
setFieldErrors(result.fieldErrors);
|
|
4797
4773
|
if (result.outcome === "rejected") setSaveError(result.formError);
|
|
4798
4774
|
}, [editing, api, labels, pendingUploads.length]);
|
|
4799
|
-
const remove =
|
|
4775
|
+
const remove = useCallback9(
|
|
4800
4776
|
async (id) => {
|
|
4801
4777
|
if (!api.deleteQuickReply) return;
|
|
4802
4778
|
setDeletingId(id);
|
|
@@ -4809,12 +4785,12 @@ function useQuickRepliesWorkspace({
|
|
|
4809
4785
|
},
|
|
4810
4786
|
[api]
|
|
4811
4787
|
);
|
|
4812
|
-
const removeAttachment =
|
|
4788
|
+
const removeAttachment = useCallback9((uploadId) => {
|
|
4813
4789
|
setEditing(
|
|
4814
4790
|
(current) => current ? { ...current, attachments: current.attachments.filter((attachment) => attachment.uploadId !== uploadId) } : current
|
|
4815
4791
|
);
|
|
4816
4792
|
}, []);
|
|
4817
|
-
const moveAttachmentAt =
|
|
4793
|
+
const moveAttachmentAt = useCallback9((index, direction) => {
|
|
4818
4794
|
setEditing(
|
|
4819
4795
|
(current) => current ? { ...current, attachments: moveAttachment(current.attachments, index, direction) } : current
|
|
4820
4796
|
);
|
|
@@ -4992,7 +4968,7 @@ function changedRange(previous, next) {
|
|
|
4992
4968
|
|
|
4993
4969
|
// src/quickReplies/QuickReplyFormattingToolbar.tsx
|
|
4994
4970
|
import { Bold as Bold3, Code as Code2, Italic as Italic3, List, ListOrdered, Quote, SquareCode, Strikethrough as Strikethrough3 } from "lucide-react";
|
|
4995
|
-
import { jsx as
|
|
4971
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
4996
4972
|
function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
4997
4973
|
const buttons = [
|
|
4998
4974
|
{ action: QUICK_REPLY_FORMATTING_ACTION.BOLD, label: labels.formatBold, Icon: Bold3 },
|
|
@@ -5004,7 +4980,7 @@ function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
|
5004
4980
|
{ action: QUICK_REPLY_FORMATTING_ACTION.NUMBERED_LIST, label: labels.formatNumberedList, Icon: ListOrdered },
|
|
5005
4981
|
{ action: QUICK_REPLY_FORMATTING_ACTION.QUOTE, label: labels.formatQuote, Icon: Quote }
|
|
5006
4982
|
];
|
|
5007
|
-
return /* @__PURE__ */
|
|
4983
|
+
return /* @__PURE__ */ jsx24("div", { role: "toolbar", "aria-label": labels.formattingToolbar, className: "flex flex-wrap gap-1", children: buttons.map(({ action, label, Icon }) => /* @__PURE__ */ jsx24(
|
|
5008
4984
|
"button",
|
|
5009
4985
|
{
|
|
5010
4986
|
type: "button",
|
|
@@ -5013,7 +4989,7 @@ function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
|
5013
4989
|
onMouseDown: (event) => event.preventDefault(),
|
|
5014
4990
|
onClick: () => onFormat(action),
|
|
5015
4991
|
className: cn(COMPOSER_TOOL_BUTTON_CLASS, COMPOSER_TOOL_BUTTON_IDLE_CLASS),
|
|
5016
|
-
children: /* @__PURE__ */
|
|
4992
|
+
children: /* @__PURE__ */ jsx24(Icon, { size: 16, "aria-hidden": "true" })
|
|
5017
4993
|
},
|
|
5018
4994
|
action
|
|
5019
4995
|
)) });
|
|
@@ -5021,7 +4997,7 @@ function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
|
5021
4997
|
|
|
5022
4998
|
// src/quickReplies/QuickReplyWhatsAppPreview.tsx
|
|
5023
4999
|
import { Paperclip as Paperclip2 } from "lucide-react";
|
|
5024
|
-
import { jsx as
|
|
5000
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5025
5001
|
function resolvePreviewVariables(body, variables = []) {
|
|
5026
5002
|
return variables.reduce(
|
|
5027
5003
|
(resolved, variable) => variable.marker ? resolved.split(variable.marker).join(variable.value || variable.label) : resolved,
|
|
@@ -5031,21 +5007,21 @@ function resolvePreviewVariables(body, variables = []) {
|
|
|
5031
5007
|
function QuickReplyWhatsAppPreview({ body, variables, attachments, labels }) {
|
|
5032
5008
|
const resolvedBody = resolvePreviewVariables(body, variables);
|
|
5033
5009
|
const hasAttachments = (attachments?.length ?? 0) > 0;
|
|
5034
|
-
return /* @__PURE__ */
|
|
5035
|
-
/* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5037
|
-
hasAttachments ? /* @__PURE__ */
|
|
5010
|
+
return /* @__PURE__ */ jsxs22("section", { "aria-label": labels.previewTitle, className: "space-y-1", children: [
|
|
5011
|
+
/* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium", children: labels.previewTitle }),
|
|
5012
|
+
/* @__PURE__ */ jsxs22(WhatsAppMessagePreview, { children: [
|
|
5013
|
+
hasAttachments ? /* @__PURE__ */ jsx25("ul", { className: "mb-1.5 flex flex-wrap gap-1 whitespace-normal", children: attachments?.map((attachment) => /* @__PURE__ */ jsxs22(
|
|
5038
5014
|
"li",
|
|
5039
5015
|
{
|
|
5040
5016
|
className: "inline-flex max-w-full items-center gap-1 rounded-md bg-black/5 px-1.5 py-0.5 text-xs dark:bg-white/10",
|
|
5041
5017
|
children: [
|
|
5042
|
-
/* @__PURE__ */
|
|
5043
|
-
/* @__PURE__ */
|
|
5018
|
+
/* @__PURE__ */ jsx25(Paperclip2, { size: 12, "aria-hidden": "true", className: "shrink-0" }),
|
|
5019
|
+
/* @__PURE__ */ jsx25("span", { className: "truncate", children: attachment.filename })
|
|
5044
5020
|
]
|
|
5045
5021
|
},
|
|
5046
5022
|
attachment.uploadId
|
|
5047
5023
|
)) }) : null,
|
|
5048
|
-
resolvedBody ? parseWhatsAppFormatting(resolvedBody) : /* @__PURE__ */
|
|
5024
|
+
resolvedBody ? parseWhatsAppFormatting(resolvedBody) : /* @__PURE__ */ jsx25("span", { className: "italic text-gray-400", children: labels.previewEmptyBody })
|
|
5049
5025
|
] })
|
|
5050
5026
|
] });
|
|
5051
5027
|
}
|
|
@@ -5053,7 +5029,7 @@ function QuickReplyWhatsAppPreview({ body, variables, attachments, labels }) {
|
|
|
5053
5029
|
// src/quickReplies/AttachmentsFormSection.tsx
|
|
5054
5030
|
import { useRef as useRef11 } from "react";
|
|
5055
5031
|
import { Paperclip as Paperclip3, X as X4 } from "lucide-react";
|
|
5056
|
-
import { Fragment as Fragment7, jsx as
|
|
5032
|
+
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5057
5033
|
function AttachmentsFormSection({
|
|
5058
5034
|
labels: text,
|
|
5059
5035
|
attachments,
|
|
@@ -5067,18 +5043,18 @@ function AttachmentsFormSection({
|
|
|
5067
5043
|
onDismissRejections
|
|
5068
5044
|
}) {
|
|
5069
5045
|
const attachmentFileInputRef = useRef11(null);
|
|
5070
|
-
return /* @__PURE__ */
|
|
5071
|
-
/* @__PURE__ */
|
|
5072
|
-
attachments.length === 0 && pendingUploads.length === 0 ? /* @__PURE__ */
|
|
5073
|
-
attachments.map((attachment, index) => /* @__PURE__ */
|
|
5046
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-2", children: [
|
|
5047
|
+
/* @__PURE__ */ jsx26("span", { className: "block text-sm font-medium", children: text.attachmentsTitle }),
|
|
5048
|
+
attachments.length === 0 && pendingUploads.length === 0 ? /* @__PURE__ */ jsx26("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: text.attachmentsEmpty }) : /* @__PURE__ */ jsxs23("ul", { className: "space-y-1", children: [
|
|
5049
|
+
attachments.map((attachment, index) => /* @__PURE__ */ jsxs23(
|
|
5074
5050
|
"li",
|
|
5075
5051
|
{
|
|
5076
5052
|
className: "flex items-center gap-2 rounded-md border border-gray-200 px-2 py-1.5 text-xs dark:border-gray-700",
|
|
5077
5053
|
children: [
|
|
5078
|
-
/* @__PURE__ */
|
|
5079
|
-
/* @__PURE__ */
|
|
5080
|
-
/* @__PURE__ */
|
|
5081
|
-
/* @__PURE__ */
|
|
5054
|
+
/* @__PURE__ */ jsx26(Paperclip3, { "aria-hidden": "true", className: "h-3.5 w-3.5 flex-none text-gray-400" }),
|
|
5055
|
+
/* @__PURE__ */ jsx26("span", { className: "min-w-0 flex-1 truncate", children: attachment.filename }),
|
|
5056
|
+
/* @__PURE__ */ jsx26("span", { className: "flex-none text-gray-400", children: formatFileSize(attachment.sizeBytes) }),
|
|
5057
|
+
/* @__PURE__ */ jsx26(
|
|
5082
5058
|
"button",
|
|
5083
5059
|
{
|
|
5084
5060
|
type: "button",
|
|
@@ -5089,7 +5065,7 @@ function AttachmentsFormSection({
|
|
|
5089
5065
|
children: "\u2191"
|
|
5090
5066
|
}
|
|
5091
5067
|
),
|
|
5092
|
-
/* @__PURE__ */
|
|
5068
|
+
/* @__PURE__ */ jsx26(
|
|
5093
5069
|
"button",
|
|
5094
5070
|
{
|
|
5095
5071
|
type: "button",
|
|
@@ -5100,32 +5076,32 @@ function AttachmentsFormSection({
|
|
|
5100
5076
|
children: "\u2193"
|
|
5101
5077
|
}
|
|
5102
5078
|
),
|
|
5103
|
-
/* @__PURE__ */
|
|
5079
|
+
/* @__PURE__ */ jsx26(
|
|
5104
5080
|
"button",
|
|
5105
5081
|
{
|
|
5106
5082
|
type: "button",
|
|
5107
5083
|
"aria-label": text.attachmentRemove,
|
|
5108
5084
|
onClick: () => onRemoveAttachment(attachment.uploadId),
|
|
5109
5085
|
className: "flex-none text-red-600 dark:text-red-400",
|
|
5110
|
-
children: /* @__PURE__ */
|
|
5086
|
+
children: /* @__PURE__ */ jsx26(X4, { "aria-hidden": "true", className: "h-3.5 w-3.5" })
|
|
5111
5087
|
}
|
|
5112
5088
|
)
|
|
5113
5089
|
]
|
|
5114
5090
|
},
|
|
5115
5091
|
attachment.uploadId
|
|
5116
5092
|
)),
|
|
5117
|
-
pendingUploads.map((pending) => /* @__PURE__ */
|
|
5093
|
+
pendingUploads.map((pending) => /* @__PURE__ */ jsxs23(
|
|
5118
5094
|
"li",
|
|
5119
5095
|
{
|
|
5120
5096
|
className: "flex items-center gap-2 rounded-md border border-gray-200 px-2 py-1.5 text-xs dark:border-gray-700",
|
|
5121
5097
|
"aria-busy": pending.status === "uploading",
|
|
5122
5098
|
"aria-live": "polite",
|
|
5123
5099
|
children: [
|
|
5124
|
-
/* @__PURE__ */
|
|
5125
|
-
/* @__PURE__ */
|
|
5126
|
-
pending.status === "uploading" ? /* @__PURE__ */
|
|
5127
|
-
/* @__PURE__ */
|
|
5128
|
-
/* @__PURE__ */
|
|
5100
|
+
/* @__PURE__ */ jsx26(Paperclip3, { "aria-hidden": "true", className: "h-3.5 w-3.5 flex-none text-gray-400" }),
|
|
5101
|
+
/* @__PURE__ */ jsx26("span", { className: "min-w-0 flex-1 truncate", children: pending.file.name }),
|
|
5102
|
+
pending.status === "uploading" ? /* @__PURE__ */ jsx26("span", { className: "flex-none text-gray-500 dark:text-gray-400", children: text.attachmentUploading(Math.round(pending.progress * 100)) }) : /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
5103
|
+
/* @__PURE__ */ jsx26("span", { role: "alert", className: "flex-none text-red-600 dark:text-red-400", children: pending.error }),
|
|
5104
|
+
/* @__PURE__ */ jsx26(
|
|
5129
5105
|
"button",
|
|
5130
5106
|
{
|
|
5131
5107
|
type: "button",
|
|
@@ -5135,14 +5111,14 @@ function AttachmentsFormSection({
|
|
|
5135
5111
|
}
|
|
5136
5112
|
)
|
|
5137
5113
|
] }),
|
|
5138
|
-
/* @__PURE__ */
|
|
5114
|
+
/* @__PURE__ */ jsx26(
|
|
5139
5115
|
"button",
|
|
5140
5116
|
{
|
|
5141
5117
|
type: "button",
|
|
5142
5118
|
"aria-label": text.attachmentCancel,
|
|
5143
5119
|
onClick: () => onCancelUpload(pending.localId),
|
|
5144
5120
|
className: "flex-none text-gray-400",
|
|
5145
|
-
children: /* @__PURE__ */
|
|
5121
|
+
children: /* @__PURE__ */ jsx26(X4, { "aria-hidden": "true", className: "h-3.5 w-3.5" })
|
|
5146
5122
|
}
|
|
5147
5123
|
)
|
|
5148
5124
|
]
|
|
@@ -5150,11 +5126,11 @@ function AttachmentsFormSection({
|
|
|
5150
5126
|
pending.localId
|
|
5151
5127
|
))
|
|
5152
5128
|
] }),
|
|
5153
|
-
attachmentRejections.length > 0 ? /* @__PURE__ */
|
|
5154
|
-
attachmentRejections.map((rejection, index) => /* @__PURE__ */
|
|
5155
|
-
/* @__PURE__ */
|
|
5129
|
+
attachmentRejections.length > 0 ? /* @__PURE__ */ jsxs23("div", { role: "alert", className: "space-y-0.5 text-xs text-red-600 dark:text-red-400", children: [
|
|
5130
|
+
attachmentRejections.map((rejection, index) => /* @__PURE__ */ jsx26("p", { children: rejection.reason === "limit" ? text.attachmentLimitReached : text.attachmentTooLarge(rejection.file.name) }, index)),
|
|
5131
|
+
/* @__PURE__ */ jsx26("button", { type: "button", onClick: onDismissRejections, className: "hover:underline", children: text.cancel })
|
|
5156
5132
|
] }) : null,
|
|
5157
|
-
/* @__PURE__ */
|
|
5133
|
+
/* @__PURE__ */ jsx26(
|
|
5158
5134
|
"input",
|
|
5159
5135
|
{
|
|
5160
5136
|
ref: attachmentFileInputRef,
|
|
@@ -5167,7 +5143,7 @@ function AttachmentsFormSection({
|
|
|
5167
5143
|
}
|
|
5168
5144
|
}
|
|
5169
5145
|
),
|
|
5170
|
-
/* @__PURE__ */
|
|
5146
|
+
/* @__PURE__ */ jsx26(
|
|
5171
5147
|
"button",
|
|
5172
5148
|
{
|
|
5173
5149
|
type: "button",
|
|
@@ -5180,7 +5156,7 @@ function AttachmentsFormSection({
|
|
|
5180
5156
|
}
|
|
5181
5157
|
|
|
5182
5158
|
// src/quickReplies/QuickRepliesWorkspace.tsx
|
|
5183
|
-
import { jsx as
|
|
5159
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5184
5160
|
var TABLE_SKELETON_ROWS = 3;
|
|
5185
5161
|
function replaceWithNativeUndo(field, previous, next) {
|
|
5186
5162
|
if (!canExecuteFormattingCommand()) return false;
|
|
@@ -5206,7 +5182,7 @@ function QuickRepliesWorkspace({
|
|
|
5206
5182
|
const titleFieldId = `${formId}-title`;
|
|
5207
5183
|
const shortcutFieldId = `${formId}-shortcut`;
|
|
5208
5184
|
const bodyFieldId = `${formId}-body`;
|
|
5209
|
-
const [confirmingDeleteId, setConfirmingDeleteId] =
|
|
5185
|
+
const [confirmingDeleteId, setConfirmingDeleteId] = useState18(null);
|
|
5210
5186
|
const deleteButtonRefs = useRef12({});
|
|
5211
5187
|
const confirmButtonRef = useRef12(null);
|
|
5212
5188
|
useEffect14(() => {
|
|
@@ -5296,14 +5272,14 @@ function QuickRepliesWorkspace({
|
|
|
5296
5272
|
event.preventDefault();
|
|
5297
5273
|
applyFormatting(action);
|
|
5298
5274
|
};
|
|
5299
|
-
return /* @__PURE__ */
|
|
5300
|
-
/* @__PURE__ */
|
|
5301
|
-
/* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
5275
|
+
return /* @__PURE__ */ jsxs24("div", { className: cn("space-y-4", className), children: [
|
|
5276
|
+
/* @__PURE__ */ jsxs24("header", { className: "space-y-0.5", children: [
|
|
5277
|
+
/* @__PURE__ */ jsx27("h2", { className: "text-lg font-semibold", children: text.title }),
|
|
5278
|
+
/* @__PURE__ */ jsx27("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: text.subtitle(quickReplies.length) })
|
|
5303
5279
|
] }),
|
|
5304
|
-
readOnly ? /* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5306
|
-
/* @__PURE__ */
|
|
5280
|
+
readOnly ? /* @__PURE__ */ jsx27("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: text.readOnlyNotice }) : null,
|
|
5281
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5282
|
+
/* @__PURE__ */ jsx27(
|
|
5307
5283
|
"input",
|
|
5308
5284
|
{
|
|
5309
5285
|
type: "search",
|
|
@@ -5314,22 +5290,22 @@ function QuickRepliesWorkspace({
|
|
|
5314
5290
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-900 sm:w-64"
|
|
5315
5291
|
}
|
|
5316
5292
|
),
|
|
5317
|
-
!readOnly ? /* @__PURE__ */
|
|
5293
|
+
!readOnly ? /* @__PURE__ */ jsxs24(
|
|
5318
5294
|
"button",
|
|
5319
5295
|
{
|
|
5320
5296
|
type: "button",
|
|
5321
5297
|
onClick: startCreate,
|
|
5322
5298
|
className: "cv-header-action cv-header-action--primary ml-auto inline-flex items-center gap-1",
|
|
5323
5299
|
children: [
|
|
5324
|
-
/* @__PURE__ */
|
|
5300
|
+
/* @__PURE__ */ jsx27(Plus2, { size: 14, "aria-hidden": "true" }),
|
|
5325
5301
|
text.create
|
|
5326
5302
|
]
|
|
5327
5303
|
}
|
|
5328
5304
|
) : null
|
|
5329
5305
|
] }),
|
|
5330
|
-
isLoading ? /* @__PURE__ */
|
|
5331
|
-
loadError ? /* @__PURE__ */
|
|
5332
|
-
editing ? /* @__PURE__ */
|
|
5306
|
+
isLoading ? /* @__PURE__ */ jsx27("span", { className: "sr-only", "aria-live": "polite", children: text.loading }) : null,
|
|
5307
|
+
loadError ? /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-sm text-red-600 dark:text-red-400", children: loadError || text.failure }) : null,
|
|
5308
|
+
editing ? /* @__PURE__ */ jsxs24(
|
|
5333
5309
|
"form",
|
|
5334
5310
|
{
|
|
5335
5311
|
className: "grid gap-4 rounded-lg border border-gray-200 p-4 dark:border-gray-700 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)]",
|
|
@@ -5338,10 +5314,10 @@ function QuickRepliesWorkspace({
|
|
|
5338
5314
|
void submit();
|
|
5339
5315
|
},
|
|
5340
5316
|
children: [
|
|
5341
|
-
/* @__PURE__ */
|
|
5342
|
-
/* @__PURE__ */
|
|
5343
|
-
/* @__PURE__ */
|
|
5344
|
-
/* @__PURE__ */
|
|
5317
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-3", children: [
|
|
5318
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
5319
|
+
/* @__PURE__ */ jsx27("label", { className: "block text-sm font-medium", htmlFor: titleFieldId, children: text.fieldTitle }),
|
|
5320
|
+
/* @__PURE__ */ jsx27(
|
|
5345
5321
|
"input",
|
|
5346
5322
|
{
|
|
5347
5323
|
id: titleFieldId,
|
|
@@ -5354,11 +5330,11 @@ function QuickRepliesWorkspace({
|
|
|
5354
5330
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-900"
|
|
5355
5331
|
}
|
|
5356
5332
|
),
|
|
5357
|
-
fieldErrors.title ? /* @__PURE__ */
|
|
5333
|
+
fieldErrors.title ? /* @__PURE__ */ jsx27("p", { id: `${titleFieldId}-error`, role: "alert", className: "text-xs text-red-600 dark:text-red-400", children: fieldErrors.title }) : null
|
|
5358
5334
|
] }),
|
|
5359
|
-
/* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5361
|
-
/* @__PURE__ */
|
|
5335
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
5336
|
+
/* @__PURE__ */ jsx27("label", { className: "block text-sm font-medium", htmlFor: shortcutFieldId, children: text.fieldShortcut }),
|
|
5337
|
+
/* @__PURE__ */ jsx27(
|
|
5362
5338
|
"input",
|
|
5363
5339
|
{
|
|
5364
5340
|
id: shortcutFieldId,
|
|
@@ -5371,12 +5347,12 @@ function QuickRepliesWorkspace({
|
|
|
5371
5347
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm font-mono dark:border-gray-700 dark:bg-gray-900"
|
|
5372
5348
|
}
|
|
5373
5349
|
),
|
|
5374
|
-
fieldErrors.shortcut ? /* @__PURE__ */
|
|
5350
|
+
fieldErrors.shortcut ? /* @__PURE__ */ jsx27("p", { id: `${shortcutFieldId}-error`, role: "alert", className: "text-xs text-red-600 dark:text-red-400", children: fieldErrors.shortcut }) : /* @__PURE__ */ jsx27("p", { id: `${shortcutFieldId}-hint`, className: "text-xs text-gray-400", children: text.fieldShortcutHint })
|
|
5375
5351
|
] }),
|
|
5376
|
-
/* @__PURE__ */
|
|
5377
|
-
/* @__PURE__ */
|
|
5378
|
-
/* @__PURE__ */
|
|
5379
|
-
/* @__PURE__ */
|
|
5352
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
5353
|
+
/* @__PURE__ */ jsx27("label", { className: "block text-sm font-medium", htmlFor: bodyFieldId, children: text.fieldBody }),
|
|
5354
|
+
/* @__PURE__ */ jsx27(QuickReplyFormattingToolbar, { labels: text, onFormat: applyFormatting }),
|
|
5355
|
+
/* @__PURE__ */ jsx27(
|
|
5380
5356
|
"textarea",
|
|
5381
5357
|
{
|
|
5382
5358
|
id: bodyFieldId,
|
|
@@ -5391,8 +5367,8 @@ function QuickRepliesWorkspace({
|
|
|
5391
5367
|
className: "w-full resize-none rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-900"
|
|
5392
5368
|
}
|
|
5393
5369
|
),
|
|
5394
|
-
fieldErrors.body ? /* @__PURE__ */
|
|
5395
|
-
variables && variables.length > 0 ? /* @__PURE__ */
|
|
5370
|
+
fieldErrors.body ? /* @__PURE__ */ jsx27("p", { id: `${bodyFieldId}-error`, role: "alert", className: "text-xs text-red-600 dark:text-red-400", children: fieldErrors.body }) : null,
|
|
5371
|
+
variables && variables.length > 0 ? /* @__PURE__ */ jsx27("div", { className: "flex flex-wrap gap-1 pt-1", children: variables.map((variable) => /* @__PURE__ */ jsx27(
|
|
5396
5372
|
"button",
|
|
5397
5373
|
{
|
|
5398
5374
|
type: "button",
|
|
@@ -5404,7 +5380,7 @@ function QuickRepliesWorkspace({
|
|
|
5404
5380
|
variable.id
|
|
5405
5381
|
)) }) : null
|
|
5406
5382
|
] }),
|
|
5407
|
-
hasAttachmentsCapability ? /* @__PURE__ */
|
|
5383
|
+
hasAttachmentsCapability ? /* @__PURE__ */ jsx27(
|
|
5408
5384
|
AttachmentsFormSection,
|
|
5409
5385
|
{
|
|
5410
5386
|
labels: text,
|
|
@@ -5419,9 +5395,9 @@ function QuickRepliesWorkspace({
|
|
|
5419
5395
|
onDismissRejections: dismissAttachmentRejections
|
|
5420
5396
|
}
|
|
5421
5397
|
) : null,
|
|
5422
|
-
saveError ? /* @__PURE__ */
|
|
5423
|
-
/* @__PURE__ */
|
|
5424
|
-
/* @__PURE__ */
|
|
5398
|
+
saveError ? /* @__PURE__ */ jsx27("p", { role: "alert", className: "text-sm text-red-600 dark:text-red-400", children: saveError }) : null,
|
|
5399
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
5400
|
+
/* @__PURE__ */ jsx27(
|
|
5425
5401
|
"button",
|
|
5426
5402
|
{
|
|
5427
5403
|
type: "submit",
|
|
@@ -5432,10 +5408,10 @@ function QuickRepliesWorkspace({
|
|
|
5432
5408
|
children: isSaving ? text.saving : hasPendingUploads ? text.saveBlockedUploading : text.save
|
|
5433
5409
|
}
|
|
5434
5410
|
),
|
|
5435
|
-
/* @__PURE__ */
|
|
5411
|
+
/* @__PURE__ */ jsx27("button", { type: "button", onClick: cancelEdit, className: "text-sm text-gray-500 hover:underline", children: text.cancel })
|
|
5436
5412
|
] })
|
|
5437
5413
|
] }),
|
|
5438
|
-
/* @__PURE__ */
|
|
5414
|
+
/* @__PURE__ */ jsx27(
|
|
5439
5415
|
QuickReplyWhatsAppPreview,
|
|
5440
5416
|
{
|
|
5441
5417
|
body: editing.body,
|
|
@@ -5447,29 +5423,29 @@ function QuickRepliesWorkspace({
|
|
|
5447
5423
|
]
|
|
5448
5424
|
}
|
|
5449
5425
|
) : null,
|
|
5450
|
-
/* @__PURE__ */
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
/* @__PURE__ */
|
|
5455
|
-
!readOnly ? /* @__PURE__ */
|
|
5426
|
+
/* @__PURE__ */ jsx27("div", { className: "cv-table-card", children: /* @__PURE__ */ jsxs24("table", { className: "cv-table", children: [
|
|
5427
|
+
/* @__PURE__ */ jsx27("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
|
|
5428
|
+
/* @__PURE__ */ jsx27("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: text.columnTitle }),
|
|
5429
|
+
/* @__PURE__ */ jsx27("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: text.columnShortcut }),
|
|
5430
|
+
/* @__PURE__ */ jsx27("th", { scope: "col", className: "hidden px-3 py-2 text-left text-xs font-medium sm:table-cell", children: text.columnBody }),
|
|
5431
|
+
!readOnly ? /* @__PURE__ */ jsx27("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: text.columnActions }) : null
|
|
5456
5432
|
] }) }),
|
|
5457
|
-
/* @__PURE__ */
|
|
5458
|
-
isLoading ? Array.from({ length: TABLE_SKELETON_ROWS }).map((_, index) => /* @__PURE__ */
|
|
5459
|
-
/* @__PURE__ */
|
|
5460
|
-
/* @__PURE__ */
|
|
5461
|
-
/* @__PURE__ */
|
|
5462
|
-
!readOnly ? /* @__PURE__ */
|
|
5463
|
-
] }, index)) : filtered.length === 0 ? /* @__PURE__ */
|
|
5464
|
-
!isLoading && filtered.map((quickReply) => /* @__PURE__ */
|
|
5465
|
-
/* @__PURE__ */
|
|
5466
|
-
/* @__PURE__ */
|
|
5433
|
+
/* @__PURE__ */ jsxs24("tbody", { children: [
|
|
5434
|
+
isLoading ? Array.from({ length: TABLE_SKELETON_ROWS }).map((_, index) => /* @__PURE__ */ jsxs24("tr", { "aria-hidden": "true", children: [
|
|
5435
|
+
/* @__PURE__ */ jsx27("td", { className: "px-3 py-3", children: /* @__PURE__ */ jsx27("span", { className: "cv-skeleton-line cv-skeleton-line--title block" }) }),
|
|
5436
|
+
/* @__PURE__ */ jsx27("td", { className: "px-3 py-3", children: /* @__PURE__ */ jsx27("span", { className: "cv-skeleton-line cv-skeleton-line--shortcut block" }) }),
|
|
5437
|
+
/* @__PURE__ */ jsx27("td", { className: "hidden px-3 py-3 sm:table-cell", children: /* @__PURE__ */ jsx27("span", { className: "cv-skeleton-line cv-skeleton-line--body block" }) }),
|
|
5438
|
+
!readOnly ? /* @__PURE__ */ jsx27("td", { className: "px-3 py-3" }) : null
|
|
5439
|
+
] }, index)) : filtered.length === 0 ? /* @__PURE__ */ jsx27("tr", { children: /* @__PURE__ */ jsx27("td", { colSpan: 4, className: "px-3 py-4 text-center text-sm text-gray-500 dark:text-gray-400", children: search.trim() ? text.noResults : text.empty }) }) : null,
|
|
5440
|
+
!isLoading && filtered.map((quickReply) => /* @__PURE__ */ jsxs24("tr", { className: cn(deletingId === quickReply.id ? "cv-row-departing" : void 0), children: [
|
|
5441
|
+
/* @__PURE__ */ jsx27("td", { className: "px-3 py-2 font-medium", children: quickReply.title }),
|
|
5442
|
+
/* @__PURE__ */ jsxs24("td", { className: "px-3 py-2 font-mono text-xs text-gray-500", children: [
|
|
5467
5443
|
"/",
|
|
5468
5444
|
quickReply.shortcut
|
|
5469
5445
|
] }),
|
|
5470
|
-
/* @__PURE__ */
|
|
5471
|
-
!readOnly ? /* @__PURE__ */
|
|
5472
|
-
canEdit ? /* @__PURE__ */
|
|
5446
|
+
/* @__PURE__ */ jsx27("td", { className: "hidden max-w-sm truncate px-3 py-2 text-gray-500 sm:table-cell", children: quickReply.body }),
|
|
5447
|
+
!readOnly ? /* @__PURE__ */ jsx27("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1", children: [
|
|
5448
|
+
canEdit ? /* @__PURE__ */ jsx27(
|
|
5473
5449
|
"button",
|
|
5474
5450
|
{
|
|
5475
5451
|
type: "button",
|
|
@@ -5477,13 +5453,13 @@ function QuickRepliesWorkspace({
|
|
|
5477
5453
|
"data-cv-tooltip": text.edit,
|
|
5478
5454
|
"aria-label": `${text.edit}: ${quickReply.title}`,
|
|
5479
5455
|
className: "cv-header-icon",
|
|
5480
|
-
children: /* @__PURE__ */
|
|
5456
|
+
children: /* @__PURE__ */ jsx27(Pencil2, { size: 14, "aria-hidden": "true" })
|
|
5481
5457
|
}
|
|
5482
5458
|
) : null,
|
|
5483
5459
|
canDelete ? confirmingDeleteId === quickReply.id ? (
|
|
5484
5460
|
// Linha de confirmação inline em vez de `window.confirm`: trava a aba
|
|
5485
5461
|
// inteira e não segue os tokens visuais do pacote (`web.md` §14).
|
|
5486
|
-
/* @__PURE__ */
|
|
5462
|
+
/* @__PURE__ */ jsxs24(
|
|
5487
5463
|
"span",
|
|
5488
5464
|
{
|
|
5489
5465
|
role: "group",
|
|
@@ -5492,7 +5468,7 @@ function QuickRepliesWorkspace({
|
|
|
5492
5468
|
className: "flex items-center gap-2 text-xs",
|
|
5493
5469
|
children: [
|
|
5494
5470
|
text.removeConfirm(quickReply.title),
|
|
5495
|
-
/* @__PURE__ */
|
|
5471
|
+
/* @__PURE__ */ jsxs24(
|
|
5496
5472
|
"button",
|
|
5497
5473
|
{
|
|
5498
5474
|
ref: confirmButtonRef,
|
|
@@ -5503,12 +5479,12 @@ function QuickRepliesWorkspace({
|
|
|
5503
5479
|
},
|
|
5504
5480
|
className: "cv-header-action cv-header-action--danger inline-flex items-center gap-1",
|
|
5505
5481
|
children: [
|
|
5506
|
-
/* @__PURE__ */
|
|
5482
|
+
/* @__PURE__ */ jsx27(Trash23, { size: 12, "aria-hidden": "true" }),
|
|
5507
5483
|
text.remove
|
|
5508
5484
|
]
|
|
5509
5485
|
}
|
|
5510
5486
|
),
|
|
5511
|
-
/* @__PURE__ */
|
|
5487
|
+
/* @__PURE__ */ jsx27(
|
|
5512
5488
|
"button",
|
|
5513
5489
|
{
|
|
5514
5490
|
type: "button",
|
|
@@ -5520,7 +5496,7 @@ function QuickRepliesWorkspace({
|
|
|
5520
5496
|
]
|
|
5521
5497
|
}
|
|
5522
5498
|
)
|
|
5523
|
-
) : /* @__PURE__ */
|
|
5499
|
+
) : /* @__PURE__ */ jsx27(
|
|
5524
5500
|
"button",
|
|
5525
5501
|
{
|
|
5526
5502
|
ref: (node) => {
|
|
@@ -5533,7 +5509,7 @@ function QuickRepliesWorkspace({
|
|
|
5533
5509
|
"data-cv-tooltip": deletingId === quickReply.id ? text.deleting : text.remove,
|
|
5534
5510
|
"aria-label": `${deletingId === quickReply.id ? text.deleting : text.remove}: ${quickReply.title}`,
|
|
5535
5511
|
className: "cv-header-icon disabled:opacity-40",
|
|
5536
|
-
children: /* @__PURE__ */
|
|
5512
|
+
children: /* @__PURE__ */ jsx27(Trash23, { size: 14, "aria-hidden": "true", className: "text-red-500" })
|
|
5537
5513
|
}
|
|
5538
5514
|
) : null
|
|
5539
5515
|
] }) }) : null
|
|
@@ -5544,12 +5520,12 @@ function QuickRepliesWorkspace({
|
|
|
5544
5520
|
}
|
|
5545
5521
|
|
|
5546
5522
|
// src/workspace/ConversationsWorkspace.tsx
|
|
5547
|
-
import { useEffect as useEffect20, useMemo as useMemo7, useState as
|
|
5523
|
+
import { useEffect as useEffect20, useMemo as useMemo7, useState as useState25 } from "react";
|
|
5548
5524
|
import { Check as Check2, CheckCheck, FlaskConical, Hourglass as Hourglass2, Mail as Mail2, MessagesSquare } from "lucide-react";
|
|
5549
5525
|
|
|
5550
5526
|
// src/workspace/BulkTemplateModal.tsx
|
|
5551
|
-
import { useEffect as useEffect15, useMemo as useMemo5, useState as
|
|
5552
|
-
import { jsx as
|
|
5527
|
+
import { useEffect as useEffect15, useMemo as useMemo5, useState as useState19 } from "react";
|
|
5528
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5553
5529
|
function BulkTemplateModal({
|
|
5554
5530
|
labels,
|
|
5555
5531
|
expiredCount,
|
|
@@ -5562,9 +5538,9 @@ function BulkTemplateModal({
|
|
|
5562
5538
|
throw new Error("BulkTemplateModal requires an ancestor <ConversationsProvider>");
|
|
5563
5539
|
}
|
|
5564
5540
|
const { api } = context;
|
|
5565
|
-
const [templates, setTemplates] =
|
|
5566
|
-
const [search, setSearch] =
|
|
5567
|
-
const [selected, setSelected] =
|
|
5541
|
+
const [templates, setTemplates] = useState19([]);
|
|
5542
|
+
const [search, setSearch] = useState19("");
|
|
5543
|
+
const [selected, setSelected] = useState19("");
|
|
5568
5544
|
useEffect15(() => {
|
|
5569
5545
|
let active = true;
|
|
5570
5546
|
void api.listTemplates?.().then((loaded) => {
|
|
@@ -5580,15 +5556,15 @@ function BulkTemplateModal({
|
|
|
5580
5556
|
if (!term) return templates;
|
|
5581
5557
|
return templates.filter((template) => template.name.toLowerCase().includes(term));
|
|
5582
5558
|
}, [templates, search]);
|
|
5583
|
-
return /* @__PURE__ */
|
|
5584
|
-
/* @__PURE__ */
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
/* @__PURE__ */
|
|
5559
|
+
return /* @__PURE__ */ jsx28("div", { className: "cv-workspace-modal", role: "dialog", "aria-modal": "true", "aria-label": labels.templateModalTitle, children: /* @__PURE__ */ jsxs25("div", { className: "cv-workspace-modal__box", children: [
|
|
5560
|
+
/* @__PURE__ */ jsxs25("header", { className: "cv-workspace-modal__header", children: [
|
|
5561
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
5562
|
+
/* @__PURE__ */ jsx28("h3", { children: labels.templateModalTitle }),
|
|
5563
|
+
/* @__PURE__ */ jsx28("p", { children: labels.templateModalAvailable(templates.length) })
|
|
5588
5564
|
] }),
|
|
5589
|
-
/* @__PURE__ */
|
|
5565
|
+
/* @__PURE__ */ jsx28("button", { "data-cv-tooltip": labels.templateModalCancel, type: "button", onClick: onClose, "aria-label": labels.templateModalCancel, children: "\u2715" })
|
|
5590
5566
|
] }),
|
|
5591
|
-
/* @__PURE__ */
|
|
5567
|
+
/* @__PURE__ */ jsx28("div", { className: "cv-workspace-modal__search", children: /* @__PURE__ */ jsx28(
|
|
5592
5568
|
"input",
|
|
5593
5569
|
{
|
|
5594
5570
|
type: "search",
|
|
@@ -5598,9 +5574,9 @@ function BulkTemplateModal({
|
|
|
5598
5574
|
autoFocus: true
|
|
5599
5575
|
}
|
|
5600
5576
|
) }),
|
|
5601
|
-
/* @__PURE__ */
|
|
5602
|
-
filtered.length === 0 ? /* @__PURE__ */
|
|
5603
|
-
filtered.map((template) => /* @__PURE__ */
|
|
5577
|
+
/* @__PURE__ */ jsxs25("div", { className: "cv-workspace-modal__list", children: [
|
|
5578
|
+
filtered.length === 0 ? /* @__PURE__ */ jsx28("p", { className: "cv-workspace-empty", children: labels.templateModalEmpty }) : null,
|
|
5579
|
+
filtered.map((template) => /* @__PURE__ */ jsxs25(
|
|
5604
5580
|
"button",
|
|
5605
5581
|
{
|
|
5606
5582
|
"data-cv-tooltip": template.name,
|
|
@@ -5610,8 +5586,8 @@ function BulkTemplateModal({
|
|
|
5610
5586
|
"aria-pressed": template.name === selected,
|
|
5611
5587
|
className: `cv-workspace-modal__item${template.name === selected ? " cv-workspace-modal__item--on" : ""}`,
|
|
5612
5588
|
children: [
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
5589
|
+
/* @__PURE__ */ jsx28("span", { className: "cv-workspace-modal__item-name", children: template.name }),
|
|
5590
|
+
/* @__PURE__ */ jsxs25("span", { className: "cv-workspace-modal__item-meta", children: [
|
|
5615
5591
|
template.language,
|
|
5616
5592
|
template.category ? ` \xB7 ${template.category.toLowerCase()}` : ""
|
|
5617
5593
|
] })
|
|
@@ -5620,10 +5596,10 @@ function BulkTemplateModal({
|
|
|
5620
5596
|
template.name
|
|
5621
5597
|
))
|
|
5622
5598
|
] }),
|
|
5623
|
-
expiredCount === 0 ? /* @__PURE__ */
|
|
5624
|
-
/* @__PURE__ */
|
|
5625
|
-
/* @__PURE__ */
|
|
5626
|
-
/* @__PURE__ */
|
|
5599
|
+
expiredCount === 0 ? /* @__PURE__ */ jsx28("p", { className: "cv-workspace-modal__warning", children: labels.templateModalNoneExpired }) : null,
|
|
5600
|
+
/* @__PURE__ */ jsxs25("footer", { className: "cv-workspace-modal__footer", children: [
|
|
5601
|
+
/* @__PURE__ */ jsx28("button", { "data-cv-tooltip": labels.templateModalCancel, "aria-label": labels.templateModalCancel, type: "button", onClick: onClose, children: labels.templateModalCancel }),
|
|
5602
|
+
/* @__PURE__ */ jsx28(
|
|
5627
5603
|
"button",
|
|
5628
5604
|
{
|
|
5629
5605
|
"data-cv-tooltip": sending ? labels.templateModalSending : labels.templateModalSend(expiredCount),
|
|
@@ -5639,10 +5615,10 @@ function BulkTemplateModal({
|
|
|
5639
5615
|
}
|
|
5640
5616
|
|
|
5641
5617
|
// src/workspace/ConversationPane.tsx
|
|
5642
|
-
import { useCallback as
|
|
5618
|
+
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef17, useState as useState23 } from "react";
|
|
5643
5619
|
|
|
5644
5620
|
// src/hooks/useLoadOlderMessagesScroll.ts
|
|
5645
|
-
import { useCallback as
|
|
5621
|
+
import { useCallback as useCallback10, useLayoutEffect as useLayoutEffect2, useRef as useRef13 } from "react";
|
|
5646
5622
|
var NEAR_TOP_THRESHOLD_PX = 200;
|
|
5647
5623
|
function computeScrollTopAfterPrepend(before, scrollHeightAfter) {
|
|
5648
5624
|
return before.scrollTop + (scrollHeightAfter - before.scrollHeight);
|
|
@@ -5656,14 +5632,14 @@ function useLoadOlderMessagesScroll({
|
|
|
5656
5632
|
}) {
|
|
5657
5633
|
const pendingSnapshotRef = useRef13(null);
|
|
5658
5634
|
const previousOldestMessageIdRef = useRef13(oldestMessageId);
|
|
5659
|
-
const triggerLoadOlder =
|
|
5635
|
+
const triggerLoadOlder = useCallback10(() => {
|
|
5660
5636
|
if (loading || !hasMore) return;
|
|
5661
5637
|
const container = containerRef.current;
|
|
5662
5638
|
if (!container) return;
|
|
5663
5639
|
pendingSnapshotRef.current = { scrollHeight: container.scrollHeight, scrollTop: container.scrollTop };
|
|
5664
5640
|
onLoadOlder();
|
|
5665
5641
|
}, [containerRef, hasMore, loading, onLoadOlder]);
|
|
5666
|
-
const handleScroll =
|
|
5642
|
+
const handleScroll = useCallback10(
|
|
5667
5643
|
(event) => {
|
|
5668
5644
|
if (event.currentTarget.scrollTop > NEAR_TOP_THRESHOLD_PX) return;
|
|
5669
5645
|
triggerLoadOlder();
|
|
@@ -5701,8 +5677,8 @@ function resolveConversationVariables({
|
|
|
5701
5677
|
}
|
|
5702
5678
|
|
|
5703
5679
|
// src/workspace/QueuedAttachmentsList.tsx
|
|
5704
|
-
import { useEffect as useEffect16, useRef as useRef14, useState as
|
|
5705
|
-
import { jsx as
|
|
5680
|
+
import { useEffect as useEffect16, useRef as useRef14, useState as useState20 } from "react";
|
|
5681
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5706
5682
|
function nameOf(item) {
|
|
5707
5683
|
return item.kind === "local" ? item.file.name : item.filename;
|
|
5708
5684
|
}
|
|
@@ -5717,7 +5693,7 @@ function AttachmentThumbnail({
|
|
|
5717
5693
|
getThumbnailUrl
|
|
5718
5694
|
}) {
|
|
5719
5695
|
const isImage = mimeTypeOf(item).startsWith("image/");
|
|
5720
|
-
const [url, setUrl] =
|
|
5696
|
+
const [url, setUrl] = useState20(item.kind === "local" ? void 0 : item.previewUrl);
|
|
5721
5697
|
const localFile = item.kind === "local" ? item.file : void 0;
|
|
5722
5698
|
const uploadId = item.kind === "stored" ? item.uploadId : void 0;
|
|
5723
5699
|
useEffect16(() => {
|
|
@@ -5737,15 +5713,15 @@ function AttachmentThumbnail({
|
|
|
5737
5713
|
};
|
|
5738
5714
|
}, [isImage, uploadId, getThumbnailUrl]);
|
|
5739
5715
|
if (!isImage) return null;
|
|
5740
|
-
return /* @__PURE__ */
|
|
5716
|
+
return /* @__PURE__ */ jsx29("span", { className: "cv-attachment-item__thumbnail", "aria-hidden": "true", children: url ? /* @__PURE__ */ jsx29("img", { src: url, alt: "" }) : null });
|
|
5741
5717
|
}
|
|
5742
5718
|
function departedItemsOf(previouslyRendered, items) {
|
|
5743
5719
|
const currentKeys = new Set(items.map(attachmentKey));
|
|
5744
5720
|
return previouslyRendered.filter((item) => !currentKeys.has(attachmentKey(item)));
|
|
5745
5721
|
}
|
|
5746
5722
|
function useDepartingItems(items) {
|
|
5747
|
-
const [rendered, setRendered] =
|
|
5748
|
-
const [departingKeys, setDepartingKeys] =
|
|
5723
|
+
const [rendered, setRendered] = useState20(items);
|
|
5724
|
+
const [departingKeys, setDepartingKeys] = useState20(/* @__PURE__ */ new Set());
|
|
5749
5725
|
const renderedRef = useRef14(rendered);
|
|
5750
5726
|
renderedRef.current = rendered;
|
|
5751
5727
|
useEffect16(() => {
|
|
@@ -5784,25 +5760,25 @@ function QueuedAttachmentsList({
|
|
|
5784
5760
|
if (status === "skipped") return labels.skipped;
|
|
5785
5761
|
return labels.waiting;
|
|
5786
5762
|
};
|
|
5787
|
-
return /* @__PURE__ */
|
|
5763
|
+
return /* @__PURE__ */ jsx29("ul", { className: "cv-workspace-attachments", "aria-busy": busy, "aria-live": "polite", children: rendered.map((item) => {
|
|
5788
5764
|
const key = attachmentKey(item);
|
|
5789
5765
|
const status = statusOf2(key);
|
|
5790
5766
|
const isDeparting = departingKeys.has(key);
|
|
5791
|
-
return /* @__PURE__ */
|
|
5767
|
+
return /* @__PURE__ */ jsxs26(
|
|
5792
5768
|
"li",
|
|
5793
5769
|
{
|
|
5794
5770
|
className: `cv-attachment-item cv-attachment-item--${status}${isDeparting ? " cv-attachment-item--departing" : ""}`,
|
|
5795
5771
|
children: [
|
|
5796
|
-
/* @__PURE__ */
|
|
5797
|
-
/* @__PURE__ */
|
|
5798
|
-
/* @__PURE__ */
|
|
5799
|
-
/* @__PURE__ */
|
|
5772
|
+
/* @__PURE__ */ jsx29(AttachmentThumbnail, { item, getThumbnailUrl }),
|
|
5773
|
+
/* @__PURE__ */ jsxs26("span", { className: "cv-attachment-item__info", children: [
|
|
5774
|
+
/* @__PURE__ */ jsx29("span", { className: "cv-attachment-item__name", children: nameOf(item) }),
|
|
5775
|
+
/* @__PURE__ */ jsxs26("span", { className: "cv-attachment-item__meta", children: [
|
|
5800
5776
|
formatFileSize(sizeOf(item)),
|
|
5801
5777
|
" \xB7 ",
|
|
5802
5778
|
statusLabelOf(status)
|
|
5803
5779
|
] })
|
|
5804
5780
|
] }),
|
|
5805
|
-
(status === "failed" || status === "skipped") && onRetry ? /* @__PURE__ */
|
|
5781
|
+
(status === "failed" || status === "skipped") && onRetry ? /* @__PURE__ */ jsx29(
|
|
5806
5782
|
"button",
|
|
5807
5783
|
{
|
|
5808
5784
|
type: "button",
|
|
@@ -5813,7 +5789,7 @@ function QueuedAttachmentsList({
|
|
|
5813
5789
|
children: labels.retry
|
|
5814
5790
|
}
|
|
5815
5791
|
) : null,
|
|
5816
|
-
/* @__PURE__ */
|
|
5792
|
+
/* @__PURE__ */ jsx29(
|
|
5817
5793
|
"button",
|
|
5818
5794
|
{
|
|
5819
5795
|
"data-cv-tooltip": labels.remove,
|
|
@@ -5832,10 +5808,10 @@ function QueuedAttachmentsList({
|
|
|
5832
5808
|
}
|
|
5833
5809
|
|
|
5834
5810
|
// src/workspace/useComposerQueue.ts
|
|
5835
|
-
import { useCallback as
|
|
5811
|
+
import { useCallback as useCallback12, useEffect as useEffect17, useRef as useRef16, useState as useState22 } from "react";
|
|
5836
5812
|
|
|
5837
5813
|
// src/workspace/useComposerAttachmentRetry.ts
|
|
5838
|
-
import { useCallback as
|
|
5814
|
+
import { useCallback as useCallback11, useRef as useRef15, useState as useState21 } from "react";
|
|
5839
5815
|
function useComposerAttachmentRetry(params) {
|
|
5840
5816
|
const {
|
|
5841
5817
|
conversationId,
|
|
@@ -5851,7 +5827,7 @@ function useComposerAttachmentRetry(params) {
|
|
|
5851
5827
|
} = params;
|
|
5852
5828
|
const retryIdempotencyKeyRef = useRef15(void 0);
|
|
5853
5829
|
const retryingKeysRef = useRef15(/* @__PURE__ */ new Set());
|
|
5854
|
-
const [retryingKeys, setRetryingKeys] =
|
|
5830
|
+
const [retryingKeys, setRetryingKeys] = useState21(/* @__PURE__ */ new Set());
|
|
5855
5831
|
function markRetrying(key) {
|
|
5856
5832
|
retryingKeysRef.current.add(key);
|
|
5857
5833
|
setRetryingKeys(new Set(retryingKeysRef.current));
|
|
@@ -5927,7 +5903,7 @@ function useComposerAttachmentRetry(params) {
|
|
|
5927
5903
|
}
|
|
5928
5904
|
void retryStoredAttachment(item).finally(release);
|
|
5929
5905
|
}
|
|
5930
|
-
const resetRetryState =
|
|
5906
|
+
const resetRetryState = useCallback11(() => {
|
|
5931
5907
|
retryIdempotencyKeyRef.current = void 0;
|
|
5932
5908
|
retryingKeysRef.current.clear();
|
|
5933
5909
|
setRetryingKeys(/* @__PURE__ */ new Set());
|
|
@@ -5938,9 +5914,9 @@ function useComposerAttachmentRetry(params) {
|
|
|
5938
5914
|
// src/workspace/useComposerQueue.ts
|
|
5939
5915
|
function useComposerQueue(params) {
|
|
5940
5916
|
const { conversationId, draft, setDraft, api, labels, onSendAttachments, refetch, setSendFailure } = params;
|
|
5941
|
-
const [queue, setQueue] =
|
|
5942
|
-
const [attachmentStatus, setAttachmentStatus] =
|
|
5943
|
-
const [isSendingDraft, setIsSendingDraft] =
|
|
5917
|
+
const [queue, setQueue] = useState22([]);
|
|
5918
|
+
const [attachmentStatus, setAttachmentStatus] = useState22({});
|
|
5919
|
+
const [isSendingDraft, setIsSendingDraft] = useState22(false);
|
|
5944
5920
|
const sendInFlightRef = useRef16(false);
|
|
5945
5921
|
const idempotencyKeyRef = useRef16(void 0);
|
|
5946
5922
|
const currentConversationIdRef = useRef16(conversationId);
|
|
@@ -5965,11 +5941,11 @@ function useComposerQueue(params) {
|
|
|
5965
5941
|
setIsSendingDraft(false);
|
|
5966
5942
|
resetRetryState();
|
|
5967
5943
|
}, [conversationId, resetRetryState]);
|
|
5968
|
-
const enqueueAttachments =
|
|
5944
|
+
const enqueueAttachments = useCallback12((items) => {
|
|
5969
5945
|
if (items.length === 0) return;
|
|
5970
5946
|
setQueue((current) => [...current, ...items]);
|
|
5971
5947
|
}, []);
|
|
5972
|
-
const removeQueuedAttachment =
|
|
5948
|
+
const removeQueuedAttachment = useCallback12((item) => {
|
|
5973
5949
|
setQueue((current) => current.filter((queued) => attachmentKey(queued) !== attachmentKey(item)));
|
|
5974
5950
|
}, []);
|
|
5975
5951
|
async function runSend(action, fallback) {
|
|
@@ -6075,7 +6051,7 @@ function useComposerQueue(params) {
|
|
|
6075
6051
|
}
|
|
6076
6052
|
|
|
6077
6053
|
// src/workspace/ConversationPane.tsx
|
|
6078
|
-
import { jsx as
|
|
6054
|
+
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6079
6055
|
function ConversationPane({
|
|
6080
6056
|
conversation,
|
|
6081
6057
|
now,
|
|
@@ -6111,10 +6087,10 @@ function ConversationPane({
|
|
|
6111
6087
|
conversation.id
|
|
6112
6088
|
);
|
|
6113
6089
|
const { context: conversationContext } = useConversationContext(conversation.id);
|
|
6114
|
-
const [documentsOpen, setDocumentsOpen] =
|
|
6115
|
-
const [sendFailure, setSendFailure] =
|
|
6116
|
-
const [selectedMessageIds, setSelectedMessageIds] =
|
|
6117
|
-
const [draft, setDraft] =
|
|
6090
|
+
const [documentsOpen, setDocumentsOpen] = useState23(false);
|
|
6091
|
+
const [sendFailure, setSendFailure] = useState23(void 0);
|
|
6092
|
+
const [selectedMessageIds, setSelectedMessageIds] = useState23(/* @__PURE__ */ new Set());
|
|
6093
|
+
const [draft, setDraft] = useState23(initialComposerText ?? "");
|
|
6118
6094
|
const {
|
|
6119
6095
|
queue,
|
|
6120
6096
|
enqueueAttachments,
|
|
@@ -6135,7 +6111,7 @@ function ConversationPane({
|
|
|
6135
6111
|
setSendFailure
|
|
6136
6112
|
});
|
|
6137
6113
|
const thumbnailUrlCacheRef = useRef17(/* @__PURE__ */ new Map());
|
|
6138
|
-
const getQueuedAttachmentThumbnailUrl =
|
|
6114
|
+
const getQueuedAttachmentThumbnailUrl = useCallback13(
|
|
6139
6115
|
(uploadId) => {
|
|
6140
6116
|
const cached = thumbnailUrlCacheRef.current.get(uploadId);
|
|
6141
6117
|
if (cached) return cached;
|
|
@@ -6237,8 +6213,8 @@ function ConversationPane({
|
|
|
6237
6213
|
}
|
|
6238
6214
|
} : void 0;
|
|
6239
6215
|
const botOwnsConversation = Boolean(requireTakeoverToReply) && conversation.mode !== "human";
|
|
6240
|
-
return /* @__PURE__ */
|
|
6241
|
-
/* @__PURE__ */
|
|
6216
|
+
return /* @__PURE__ */ jsxs27("div", { className: "cv-workspace-pane", children: [
|
|
6217
|
+
/* @__PURE__ */ jsx30(
|
|
6242
6218
|
ConversationHeader,
|
|
6243
6219
|
{
|
|
6244
6220
|
conversation,
|
|
@@ -6253,10 +6229,10 @@ function ConversationPane({
|
|
|
6253
6229
|
...extraUtilities ? { extraUtilities } : {}
|
|
6254
6230
|
}
|
|
6255
6231
|
),
|
|
6256
|
-
contextEntries && contextEntries.length > 0 || flowLabel ? /* @__PURE__ */
|
|
6257
|
-
/* @__PURE__ */
|
|
6232
|
+
contextEntries && contextEntries.length > 0 || flowLabel ? /* @__PURE__ */ jsx30(ConversationContextPanel, { entries: contextEntries ?? [], ...flowLabel ? { flowLabel } : {} }) : null,
|
|
6233
|
+
/* @__PURE__ */ jsx30(ConversationDocumentsPanel, { conversationId: conversation.id, open: documentsOpen }),
|
|
6258
6234
|
renderAboveTranscript?.(conversation, conversationContext),
|
|
6259
|
-
/* @__PURE__ */
|
|
6235
|
+
/* @__PURE__ */ jsxs27(
|
|
6260
6236
|
ConversationWallpaper,
|
|
6261
6237
|
{
|
|
6262
6238
|
ref: scroll.containerRef,
|
|
@@ -6266,13 +6242,13 @@ function ConversationPane({
|
|
|
6266
6242
|
},
|
|
6267
6243
|
className: "cv-workspace-transcript",
|
|
6268
6244
|
children: [
|
|
6269
|
-
hasMoreOlderMessages ? /* @__PURE__ */
|
|
6245
|
+
hasMoreOlderMessages ? /* @__PURE__ */ jsx30("div", { className: "cv-workspace-load-older", children: /* @__PURE__ */ jsx30("button", { type: "button", onClick: loadOlder.triggerLoadOlder, disabled: loadingOlderMessages, children: loadingOlderMessages ? labels.loadingOlderMessages : labels.loadOlderMessages }) }) : null,
|
|
6270
6246
|
messages.map((message, index) => {
|
|
6271
6247
|
const previous = index > 0 ? messages[index - 1] : void 0;
|
|
6272
6248
|
const startsNewDay = !previous || new Date(message.timestamp).toDateString() !== new Date(previous.timestamp).toDateString();
|
|
6273
|
-
return /* @__PURE__ */
|
|
6274
|
-
startsNewDay ? /* @__PURE__ */
|
|
6275
|
-
/* @__PURE__ */
|
|
6249
|
+
return /* @__PURE__ */ jsxs27("div", { children: [
|
|
6250
|
+
startsNewDay ? /* @__PURE__ */ jsx30(DateDivider, { iso: message.timestamp }) : null,
|
|
6251
|
+
/* @__PURE__ */ jsx30(
|
|
6276
6252
|
MessageBubble,
|
|
6277
6253
|
{
|
|
6278
6254
|
message,
|
|
@@ -6291,10 +6267,10 @@ function ConversationPane({
|
|
|
6291
6267
|
]
|
|
6292
6268
|
}
|
|
6293
6269
|
),
|
|
6294
|
-
messageSelection && selectedMessageIds.size > 0 ? /* @__PURE__ */
|
|
6295
|
-
/* @__PURE__ */
|
|
6296
|
-
/* @__PURE__ */
|
|
6297
|
-
/* @__PURE__ */
|
|
6270
|
+
messageSelection && selectedMessageIds.size > 0 ? /* @__PURE__ */ jsxs27("div", { className: "cv-workspace-selection", children: [
|
|
6271
|
+
/* @__PURE__ */ jsx30("span", { children: labels.messagesSelected(selectedMessageIds.size) }),
|
|
6272
|
+
/* @__PURE__ */ jsxs27("div", { className: "cv-workspace-selection__actions", children: [
|
|
6273
|
+
/* @__PURE__ */ jsx30(
|
|
6298
6274
|
"button",
|
|
6299
6275
|
{
|
|
6300
6276
|
"data-cv-tooltip": labels.bulkClear,
|
|
@@ -6304,7 +6280,7 @@ function ConversationPane({
|
|
|
6304
6280
|
children: labels.bulkClear
|
|
6305
6281
|
}
|
|
6306
6282
|
),
|
|
6307
|
-
/* @__PURE__ */
|
|
6283
|
+
/* @__PURE__ */ jsx30(
|
|
6308
6284
|
"button",
|
|
6309
6285
|
{
|
|
6310
6286
|
"data-cv-tooltip": labels.copySelected,
|
|
@@ -6316,11 +6292,11 @@ function ConversationPane({
|
|
|
6316
6292
|
)
|
|
6317
6293
|
] })
|
|
6318
6294
|
] }) : null,
|
|
6319
|
-
sendFailure ? /* @__PURE__ */
|
|
6320
|
-
blocked ? /* @__PURE__ */
|
|
6295
|
+
sendFailure ? /* @__PURE__ */ jsx30("p", { role: "alert", className: "cv-workspace-alert", children: sendFailure }) : null,
|
|
6296
|
+
blocked ? /* @__PURE__ */ jsx30(WindowExpiredNotice, { disabled: busy, onSendTemplate: () => void handleSendTemplate() }) : botOwnsConversation ? (
|
|
6321
6297
|
// Responder com a conversa no bot atropelaria o fluxo automático no meio de uma pergunta.
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
) : composer === "rich" ? /* @__PURE__ */
|
|
6298
|
+
/* @__PURE__ */ jsx30("p", { className: "cv-workspace-notice", children: labels.takeoverToReply })
|
|
6299
|
+
) : composer === "rich" ? /* @__PURE__ */ jsx30(
|
|
6324
6300
|
RichMessageComposer,
|
|
6325
6301
|
{
|
|
6326
6302
|
value: draft,
|
|
@@ -6343,7 +6319,7 @@ function ConversationPane({
|
|
|
6343
6319
|
isSending: busy || isSendingDraft,
|
|
6344
6320
|
hasQueuedAttachments: queue.length > 0,
|
|
6345
6321
|
...onRecordAudio ? {
|
|
6346
|
-
idleAction: /* @__PURE__ */
|
|
6322
|
+
idleAction: /* @__PURE__ */ jsx30(
|
|
6347
6323
|
AudioRecorderButton,
|
|
6348
6324
|
{
|
|
6349
6325
|
onRecorded: (file) => void runSend(() => onRecordAudio(file), labels.recordFailure),
|
|
@@ -6352,7 +6328,7 @@ function ConversationPane({
|
|
|
6352
6328
|
)
|
|
6353
6329
|
} : {},
|
|
6354
6330
|
...queue.length > 0 ? {
|
|
6355
|
-
attachmentsPreview: /* @__PURE__ */
|
|
6331
|
+
attachmentsPreview: /* @__PURE__ */ jsx30(
|
|
6356
6332
|
QueuedAttachmentsList,
|
|
6357
6333
|
{
|
|
6358
6334
|
items: queue,
|
|
@@ -6378,7 +6354,7 @@ function ConversationPane({
|
|
|
6378
6354
|
...composerVariables ? { variables: [...composerVariables] } : {},
|
|
6379
6355
|
...savedQuickReplies ? { savedQuickReplies } : {}
|
|
6380
6356
|
}
|
|
6381
|
-
) : /* @__PURE__ */
|
|
6357
|
+
) : /* @__PURE__ */ jsx30(
|
|
6382
6358
|
MessageComposer,
|
|
6383
6359
|
{
|
|
6384
6360
|
value: draft,
|
|
@@ -6396,7 +6372,7 @@ function ConversationPane({
|
|
|
6396
6372
|
}
|
|
6397
6373
|
|
|
6398
6374
|
// src/workspace/ConversationsInboxList.tsx
|
|
6399
|
-
import { jsx as
|
|
6375
|
+
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6400
6376
|
function ConversationsInboxList({
|
|
6401
6377
|
inbox,
|
|
6402
6378
|
labels,
|
|
@@ -6407,13 +6383,13 @@ function ConversationsInboxList({
|
|
|
6407
6383
|
onSendTemplateToSelected
|
|
6408
6384
|
}) {
|
|
6409
6385
|
const hasSelection = inbox.selectedIds.size > 0;
|
|
6410
|
-
return /* @__PURE__ */
|
|
6411
|
-
hasSelection ? /* @__PURE__ */
|
|
6412
|
-
/* @__PURE__ */
|
|
6413
|
-
/* @__PURE__ */
|
|
6414
|
-
/* @__PURE__ */
|
|
6415
|
-
onSendTemplateToSelected ? /* @__PURE__ */
|
|
6416
|
-
inbox.canFinalize ? /* @__PURE__ */
|
|
6386
|
+
return /* @__PURE__ */ jsxs28("aside", { className, children: [
|
|
6387
|
+
hasSelection ? /* @__PURE__ */ jsxs28("div", { className: "cv-workspace-bulk", children: [
|
|
6388
|
+
/* @__PURE__ */ jsx31("span", { className: "cv-workspace-bulk__count", children: labels.bulkSelected(inbox.selectedIds.size) }),
|
|
6389
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-bulk__actions", children: [
|
|
6390
|
+
/* @__PURE__ */ jsx31("button", { "data-cv-tooltip": labels.bulkClear, "aria-label": labels.bulkClear, type: "button", onClick: inbox.clearBulkSelection, children: labels.bulkClear }),
|
|
6391
|
+
onSendTemplateToSelected ? /* @__PURE__ */ jsx31("button", { "data-cv-tooltip": labels.bulkTemplate, "aria-label": labels.bulkTemplate, type: "button", onClick: onSendTemplateToSelected, disabled: inbox.busy, children: labels.bulkTemplate }) : null,
|
|
6392
|
+
inbox.canFinalize ? /* @__PURE__ */ jsx31(
|
|
6417
6393
|
"button",
|
|
6418
6394
|
{
|
|
6419
6395
|
"data-cv-tooltip": labels.bulkFinalize,
|
|
@@ -6431,8 +6407,8 @@ function ConversationsInboxList({
|
|
|
6431
6407
|
renderBulkActions?.(inbox)
|
|
6432
6408
|
] })
|
|
6433
6409
|
] }) : null,
|
|
6434
|
-
/* @__PURE__ */
|
|
6435
|
-
/* @__PURE__ */
|
|
6410
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-filters", children: [
|
|
6411
|
+
/* @__PURE__ */ jsx31(
|
|
6436
6412
|
"input",
|
|
6437
6413
|
{
|
|
6438
6414
|
type: "search",
|
|
@@ -6442,9 +6418,9 @@ function ConversationsInboxList({
|
|
|
6442
6418
|
className: "cv-workspace-search"
|
|
6443
6419
|
}
|
|
6444
6420
|
),
|
|
6445
|
-
/* @__PURE__ */
|
|
6446
|
-
/* @__PURE__ */
|
|
6447
|
-
WINDOW_FILTERS.map((filter) => /* @__PURE__ */
|
|
6421
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-chips", children: [
|
|
6422
|
+
/* @__PURE__ */ jsx31("span", { className: "cv-workspace-chips__legend", children: labels.windowLegend }),
|
|
6423
|
+
WINDOW_FILTERS.map((filter) => /* @__PURE__ */ jsx31(
|
|
6448
6424
|
"button",
|
|
6449
6425
|
{
|
|
6450
6426
|
type: "button",
|
|
@@ -6462,9 +6438,9 @@ function ConversationsInboxList({
|
|
|
6462
6438
|
filter.value
|
|
6463
6439
|
))
|
|
6464
6440
|
] }),
|
|
6465
|
-
inbox.channelFilters.length > 0 ? /* @__PURE__ */
|
|
6466
|
-
/* @__PURE__ */
|
|
6467
|
-
inbox.channelFilters.map((filter) => /* @__PURE__ */
|
|
6441
|
+
inbox.channelFilters.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "cv-workspace-chips", children: [
|
|
6442
|
+
/* @__PURE__ */ jsx31("span", { className: "cv-workspace-chips__legend", children: labels.channelLegend }),
|
|
6443
|
+
inbox.channelFilters.map((filter) => /* @__PURE__ */ jsxs28(
|
|
6468
6444
|
"button",
|
|
6469
6445
|
{
|
|
6470
6446
|
"data-cv-tooltip": filter.label,
|
|
@@ -6474,7 +6450,7 @@ function ConversationsInboxList({
|
|
|
6474
6450
|
"aria-pressed": inbox.channelFilter === filter.value,
|
|
6475
6451
|
className: `cv-workspace-chip${inbox.channelFilter === filter.value ? " cv-workspace-chip--on" : ""}`,
|
|
6476
6452
|
children: [
|
|
6477
|
-
filter.value === CHANNEL_FILTER_ALL ? null : /* @__PURE__ */
|
|
6453
|
+
filter.value === CHANNEL_FILTER_ALL ? null : /* @__PURE__ */ jsx31(ChannelIcon, { channel: filter.value }),
|
|
6478
6454
|
filter.label
|
|
6479
6455
|
]
|
|
6480
6456
|
},
|
|
@@ -6482,14 +6458,14 @@ function ConversationsInboxList({
|
|
|
6482
6458
|
))
|
|
6483
6459
|
] }) : null,
|
|
6484
6460
|
renderFilters?.(inbox),
|
|
6485
|
-
/* @__PURE__ */
|
|
6486
|
-
/* @__PURE__ */
|
|
6461
|
+
/* @__PURE__ */ jsxs28("label", { className: "cv-workspace-selectall", children: [
|
|
6462
|
+
/* @__PURE__ */ jsx31("input", { type: "checkbox", checked: inbox.allOnPageSelected, onChange: inbox.toggleSelectAllOnPage }),
|
|
6487
6463
|
labels.selectAll
|
|
6488
6464
|
] })
|
|
6489
6465
|
] }),
|
|
6490
|
-
/* @__PURE__ */
|
|
6466
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-rows", children: [
|
|
6491
6467
|
inbox.pageConversations.map(
|
|
6492
|
-
(conversation) => renderRow ? /* @__PURE__ */
|
|
6468
|
+
(conversation) => renderRow ? /* @__PURE__ */ jsx31("div", { children: renderRow(conversation) }, conversation.id) : /* @__PURE__ */ jsx31(
|
|
6493
6469
|
ConversationRow,
|
|
6494
6470
|
{
|
|
6495
6471
|
conversation,
|
|
@@ -6504,13 +6480,13 @@ function ConversationsInboxList({
|
|
|
6504
6480
|
conversation.id
|
|
6505
6481
|
)
|
|
6506
6482
|
),
|
|
6507
|
-
!inbox.loading && inbox.filteredCount === 0 ? /* @__PURE__ */
|
|
6483
|
+
!inbox.loading && inbox.filteredCount === 0 ? /* @__PURE__ */ jsx31("p", { className: "cv-workspace-empty", children: labels.emptyList }) : null
|
|
6508
6484
|
] }),
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
6511
|
-
/* @__PURE__ */
|
|
6512
|
-
/* @__PURE__ */
|
|
6513
|
-
/* @__PURE__ */
|
|
6485
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-pager", children: [
|
|
6486
|
+
/* @__PURE__ */ jsx31("span", { children: labels.rangeOf(inbox.firstOnPage, inbox.lastOnPage, inbox.filteredCount) }),
|
|
6487
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-pager__buttons", children: [
|
|
6488
|
+
/* @__PURE__ */ jsx31("button", { type: "button", onClick: () => inbox.goToPage(1), disabled: inbox.page === 1, "aria-label": PAGINATION_LABELS.first, "data-cv-tooltip": PAGINATION_LABELS.first, children: "\xAB" }),
|
|
6489
|
+
/* @__PURE__ */ jsx31(
|
|
6514
6490
|
"button",
|
|
6515
6491
|
{
|
|
6516
6492
|
type: "button",
|
|
@@ -6521,8 +6497,8 @@ function ConversationsInboxList({
|
|
|
6521
6497
|
children: "\u2039"
|
|
6522
6498
|
}
|
|
6523
6499
|
),
|
|
6524
|
-
/* @__PURE__ */
|
|
6525
|
-
/* @__PURE__ */
|
|
6500
|
+
/* @__PURE__ */ jsx31("span", { children: labels.pageOf(inbox.page, inbox.pageCount) }),
|
|
6501
|
+
/* @__PURE__ */ jsx31(
|
|
6526
6502
|
"button",
|
|
6527
6503
|
{
|
|
6528
6504
|
type: "button",
|
|
@@ -6533,7 +6509,7 @@ function ConversationsInboxList({
|
|
|
6533
6509
|
children: "\u203A"
|
|
6534
6510
|
}
|
|
6535
6511
|
),
|
|
6536
|
-
/* @__PURE__ */
|
|
6512
|
+
/* @__PURE__ */ jsx31(
|
|
6537
6513
|
"button",
|
|
6538
6514
|
{
|
|
6539
6515
|
type: "button",
|
|
@@ -6599,7 +6575,7 @@ var DEFAULT_CONVERSATIONS_WORKSPACE_LABELS = {
|
|
|
6599
6575
|
};
|
|
6600
6576
|
|
|
6601
6577
|
// src/workspace/useConversationsInbox.ts
|
|
6602
|
-
import { useCallback as
|
|
6578
|
+
import { useCallback as useCallback14, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef18, useState as useState24 } from "react";
|
|
6603
6579
|
var CONVERSATIONS_PER_PAGE = 50;
|
|
6604
6580
|
function defaultDescribeFailure(error) {
|
|
6605
6581
|
const status = error.status;
|
|
@@ -6617,14 +6593,14 @@ function useConversationsInbox(params = {}) {
|
|
|
6617
6593
|
const perPage = params.perPage ?? CONVERSATIONS_PER_PAGE;
|
|
6618
6594
|
const markReadOnOpen = params.markReadOnOpen ?? true;
|
|
6619
6595
|
const describeFailure = params.describeFailure ?? defaultDescribeFailure;
|
|
6620
|
-
const [waitingOnly, setWaitingOnly] =
|
|
6621
|
-
const [windowFilter, setWindowFilter] =
|
|
6622
|
-
const [channelFilter, setChannelFilter] =
|
|
6623
|
-
const [search, setSearch] =
|
|
6624
|
-
const [page, setPage] =
|
|
6625
|
-
const [selectedId, setSelectedId] =
|
|
6626
|
-
const [selectedIds, setSelectedIds] =
|
|
6627
|
-
const [busy, setBusy] =
|
|
6596
|
+
const [waitingOnly, setWaitingOnly] = useState24(false);
|
|
6597
|
+
const [windowFilter, setWindowFilter] = useState24(CONVERSATION_WINDOW.ALL);
|
|
6598
|
+
const [channelFilter, setChannelFilter] = useState24(CHANNEL_FILTER_ALL);
|
|
6599
|
+
const [search, setSearch] = useState24("");
|
|
6600
|
+
const [page, setPage] = useState24(1);
|
|
6601
|
+
const [selectedId, setSelectedId] = useState24(void 0);
|
|
6602
|
+
const [selectedIds, setSelectedIds] = useState24(/* @__PURE__ */ new Set());
|
|
6603
|
+
const [busy, setBusy] = useState24(false);
|
|
6628
6604
|
const { conversations, total, loading, error, refetch } = useConversationList({
|
|
6629
6605
|
...waitingOnly ? { waitingHuman: true } : {},
|
|
6630
6606
|
...search ? { search } : {},
|
|
@@ -6632,7 +6608,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6632
6608
|
...params.serverPaginated ? { page, limit: perPage } : {}
|
|
6633
6609
|
});
|
|
6634
6610
|
useGlobalRealtime(
|
|
6635
|
-
|
|
6611
|
+
useCallback14(() => {
|
|
6636
6612
|
void refetch();
|
|
6637
6613
|
}, [refetch])
|
|
6638
6614
|
);
|
|
@@ -6668,7 +6644,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6668
6644
|
void api.markRead(selectedId).then(() => refetch()).catch(() => {
|
|
6669
6645
|
});
|
|
6670
6646
|
}, [markReadOnOpen, selectedId, conversations, refetch, api]);
|
|
6671
|
-
const toggleSelected =
|
|
6647
|
+
const toggleSelected = useCallback14((conversationId) => {
|
|
6672
6648
|
setSelectedIds((current) => {
|
|
6673
6649
|
const next = new Set(current);
|
|
6674
6650
|
if (next.has(conversationId)) next.delete(conversationId);
|
|
@@ -6678,7 +6654,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6678
6654
|
}, []);
|
|
6679
6655
|
const pageIds = pageConversations.map((conversation) => conversation.id);
|
|
6680
6656
|
const allOnPageSelected = pageIds.length > 0 && pageIds.every((id) => selectedIds.has(id));
|
|
6681
|
-
const toggleSelectAllOnPage =
|
|
6657
|
+
const toggleSelectAllOnPage = useCallback14(() => {
|
|
6682
6658
|
setSelectedIds((current) => {
|
|
6683
6659
|
const next = new Set(current);
|
|
6684
6660
|
if (allOnPageSelected) pageIds.forEach((id) => next.delete(id));
|
|
@@ -6686,7 +6662,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6686
6662
|
return next;
|
|
6687
6663
|
});
|
|
6688
6664
|
}, [allOnPageSelected, pageIds]);
|
|
6689
|
-
const runOnSelection =
|
|
6665
|
+
const runOnSelection = useCallback14(
|
|
6690
6666
|
async (action) => {
|
|
6691
6667
|
setBusy(true);
|
|
6692
6668
|
try {
|
|
@@ -6699,7 +6675,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6699
6675
|
},
|
|
6700
6676
|
[selectedIds, refetch]
|
|
6701
6677
|
);
|
|
6702
|
-
const runConversationAction =
|
|
6678
|
+
const runConversationAction = useCallback14(
|
|
6703
6679
|
async (action, conversationId) => {
|
|
6704
6680
|
if (!action) return;
|
|
6705
6681
|
setBusy(true);
|
|
@@ -6781,7 +6757,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6781
6757
|
}
|
|
6782
6758
|
|
|
6783
6759
|
// src/workspace/ConversationsWorkspace.tsx
|
|
6784
|
-
import { Fragment as Fragment8, jsx as
|
|
6760
|
+
import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6785
6761
|
function ConversationsWorkspace({
|
|
6786
6762
|
labels: labelsOverride,
|
|
6787
6763
|
filters,
|
|
@@ -6822,9 +6798,9 @@ function ConversationsWorkspace({
|
|
|
6822
6798
|
...markReadOnOpen === void 0 ? {} : { markReadOnOpen },
|
|
6823
6799
|
...serverPaginated ? { serverPaginated } : {}
|
|
6824
6800
|
});
|
|
6825
|
-
const [simulatorOpen, setSimulatorOpen] =
|
|
6826
|
-
const [templateModalOpen, setTemplateModalOpen] =
|
|
6827
|
-
const [openedFromLink, setOpenedFromLink] =
|
|
6801
|
+
const [simulatorOpen, setSimulatorOpen] = useState25(false);
|
|
6802
|
+
const [templateModalOpen, setTemplateModalOpen] = useState25(false);
|
|
6803
|
+
const [openedFromLink, setOpenedFromLink] = useState25(void 0);
|
|
6828
6804
|
useEffect20(() => {
|
|
6829
6805
|
const link = initialConversationId ?? initialWhatsappNumber;
|
|
6830
6806
|
if (!link || openedFromLink === link) return;
|
|
@@ -6857,50 +6833,50 @@ function ConversationsWorkspace({
|
|
|
6857
6833
|
...fromProduct,
|
|
6858
6834
|
{
|
|
6859
6835
|
key: "simulator",
|
|
6860
|
-
icon: simulator?.icon ?? /* @__PURE__ */
|
|
6836
|
+
icon: simulator?.icon ?? /* @__PURE__ */ jsx32(FlaskConical, { size: ICON_SIZE_ACTION }),
|
|
6861
6837
|
label: simulator?.label ?? "Simular cliente",
|
|
6862
6838
|
active: simulatorOpen,
|
|
6863
6839
|
run: () => setSimulatorOpen((open) => !open)
|
|
6864
6840
|
}
|
|
6865
6841
|
];
|
|
6866
6842
|
}, [selected, extraUtilitiesFor, simulatorEnabled, simulator, simulatorOpen]);
|
|
6867
|
-
return /* @__PURE__ */
|
|
6868
|
-
/* @__PURE__ */
|
|
6869
|
-
/* @__PURE__ */
|
|
6870
|
-
/* @__PURE__ */
|
|
6871
|
-
/* @__PURE__ */
|
|
6872
|
-
/* @__PURE__ */
|
|
6873
|
-
/* @__PURE__ */
|
|
6874
|
-
/* @__PURE__ */
|
|
6843
|
+
return /* @__PURE__ */ jsxs29("div", { className: `cv-workspace${className ? ` ${className}` : ""}`, children: [
|
|
6844
|
+
/* @__PURE__ */ jsx32(TooltipLayer, {}),
|
|
6845
|
+
/* @__PURE__ */ jsxs29("header", { className: "cv-workspace-header", children: [
|
|
6846
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-header__titles", children: [
|
|
6847
|
+
/* @__PURE__ */ jsx32("h1", { children: labels.title }),
|
|
6848
|
+
/* @__PURE__ */ jsxs29("p", { children: [
|
|
6849
|
+
/* @__PURE__ */ jsxs29("span", { "data-cv-tooltip": labels.conversations, className: "cv-stat", children: [
|
|
6850
|
+
/* @__PURE__ */ jsx32(MessagesSquare, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
6875
6851
|
" ",
|
|
6876
6852
|
inbox.totalCount,
|
|
6877
|
-
/* @__PURE__ */
|
|
6853
|
+
/* @__PURE__ */ jsxs29("span", { className: "cv-only-wide", children: [
|
|
6878
6854
|
" ",
|
|
6879
6855
|
labels.conversations
|
|
6880
6856
|
] })
|
|
6881
6857
|
] }),
|
|
6882
|
-
/* @__PURE__ */
|
|
6883
|
-
/* @__PURE__ */
|
|
6858
|
+
/* @__PURE__ */ jsxs29("span", { "data-cv-tooltip": labels.waiting, className: "cv-stat cv-workspace-header__waiting", children: [
|
|
6859
|
+
/* @__PURE__ */ jsx32(Hourglass2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
6884
6860
|
" ",
|
|
6885
6861
|
inbox.waitingCount,
|
|
6886
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsxs29("span", { className: "cv-only-wide", children: [
|
|
6887
6863
|
" ",
|
|
6888
6864
|
labels.waiting
|
|
6889
6865
|
] })
|
|
6890
6866
|
] }),
|
|
6891
|
-
/* @__PURE__ */
|
|
6892
|
-
/* @__PURE__ */
|
|
6867
|
+
/* @__PURE__ */ jsxs29("span", { "data-cv-tooltip": labels.unread, className: "cv-stat", children: [
|
|
6868
|
+
/* @__PURE__ */ jsx32(Mail2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
6893
6869
|
" ",
|
|
6894
6870
|
inbox.unreadCount,
|
|
6895
|
-
/* @__PURE__ */
|
|
6871
|
+
/* @__PURE__ */ jsxs29("span", { className: "cv-only-wide", children: [
|
|
6896
6872
|
" ",
|
|
6897
6873
|
labels.unread
|
|
6898
6874
|
] })
|
|
6899
6875
|
] })
|
|
6900
6876
|
] })
|
|
6901
6877
|
] }),
|
|
6902
|
-
/* @__PURE__ */
|
|
6903
|
-
/* @__PURE__ */
|
|
6878
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-header__actions", children: [
|
|
6879
|
+
/* @__PURE__ */ jsxs29(
|
|
6904
6880
|
"button",
|
|
6905
6881
|
{
|
|
6906
6882
|
type: "button",
|
|
@@ -6910,12 +6886,12 @@ function ConversationsWorkspace({
|
|
|
6910
6886
|
"aria-label": labels.waitingOnly,
|
|
6911
6887
|
className: inbox.waitingOnly ? "cv-workspace-toggle cv-workspace-toggle--on" : "cv-workspace-toggle",
|
|
6912
6888
|
children: [
|
|
6913
|
-
/* @__PURE__ */
|
|
6914
|
-
/* @__PURE__ */
|
|
6889
|
+
/* @__PURE__ */ jsx32(Hourglass2, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
6890
|
+
/* @__PURE__ */ jsx32("span", { className: "cv-only-wide", children: labels.waitingOnly })
|
|
6915
6891
|
]
|
|
6916
6892
|
}
|
|
6917
6893
|
),
|
|
6918
|
-
/* @__PURE__ */
|
|
6894
|
+
/* @__PURE__ */ jsxs29(
|
|
6919
6895
|
"button",
|
|
6920
6896
|
{
|
|
6921
6897
|
type: "button",
|
|
@@ -6925,9 +6901,9 @@ function ConversationsWorkspace({
|
|
|
6925
6901
|
"aria-label": labels.markSelectedAsRead,
|
|
6926
6902
|
className: "cv-workspace-toggle",
|
|
6927
6903
|
children: [
|
|
6928
|
-
/* @__PURE__ */
|
|
6929
|
-
/* @__PURE__ */
|
|
6930
|
-
inbox.selectedIds.size > 0 ? /* @__PURE__ */
|
|
6904
|
+
/* @__PURE__ */ jsx32(Check2, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
6905
|
+
/* @__PURE__ */ jsx32("span", { className: "cv-only-wide", children: labels.markSelectedAsRead }),
|
|
6906
|
+
inbox.selectedIds.size > 0 ? /* @__PURE__ */ jsxs29("span", { children: [
|
|
6931
6907
|
"(",
|
|
6932
6908
|
inbox.selectedIds.size,
|
|
6933
6909
|
")"
|
|
@@ -6935,7 +6911,7 @@ function ConversationsWorkspace({
|
|
|
6935
6911
|
]
|
|
6936
6912
|
}
|
|
6937
6913
|
),
|
|
6938
|
-
inbox.canMarkAllRead && inbox.unreadCount > 0 ? /* @__PURE__ */
|
|
6914
|
+
inbox.canMarkAllRead && inbox.unreadCount > 0 ? /* @__PURE__ */ jsxs29(
|
|
6939
6915
|
"button",
|
|
6940
6916
|
{
|
|
6941
6917
|
type: "button",
|
|
@@ -6945,28 +6921,28 @@ function ConversationsWorkspace({
|
|
|
6945
6921
|
"aria-label": labels.markAllAsRead,
|
|
6946
6922
|
className: "cv-workspace-toggle",
|
|
6947
6923
|
children: [
|
|
6948
|
-
/* @__PURE__ */
|
|
6949
|
-
/* @__PURE__ */
|
|
6924
|
+
/* @__PURE__ */ jsx32(CheckCheck, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
6925
|
+
/* @__PURE__ */ jsx32("span", { className: "cv-only-wide", children: labels.markAllAsRead })
|
|
6950
6926
|
]
|
|
6951
6927
|
}
|
|
6952
6928
|
) : null,
|
|
6953
6929
|
renderHeaderActions?.(inbox)
|
|
6954
6930
|
] })
|
|
6955
6931
|
] }),
|
|
6956
|
-
inbox.loadFailure ? /* @__PURE__ */
|
|
6932
|
+
inbox.loadFailure ? /* @__PURE__ */ jsxs29("p", { role: "alert", className: "cv-workspace-failure", children: [
|
|
6957
6933
|
inbox.loadFailure,
|
|
6958
|
-
signInHref ? /* @__PURE__ */
|
|
6934
|
+
signInHref ? /* @__PURE__ */ jsxs29(Fragment8, { children: [
|
|
6959
6935
|
" ",
|
|
6960
|
-
/* @__PURE__ */
|
|
6936
|
+
/* @__PURE__ */ jsx32("a", { href: signInHref, className: "cv-workspace-failure__link", children: labels.signIn })
|
|
6961
6937
|
] }) : null
|
|
6962
6938
|
] }) : null,
|
|
6963
|
-
/* @__PURE__ */
|
|
6939
|
+
/* @__PURE__ */ jsxs29(
|
|
6964
6940
|
"div",
|
|
6965
6941
|
{
|
|
6966
6942
|
className: `cv-workspace-grid${showSimulator ? " cv-workspace-grid--with-simulator" : ""}`,
|
|
6967
6943
|
"data-detail": selected ? "open" : "closed",
|
|
6968
6944
|
children: [
|
|
6969
|
-
/* @__PURE__ */
|
|
6945
|
+
/* @__PURE__ */ jsx32(
|
|
6970
6946
|
ConversationsInboxList,
|
|
6971
6947
|
{
|
|
6972
6948
|
inbox,
|
|
@@ -6978,7 +6954,7 @@ function ConversationsWorkspace({
|
|
|
6978
6954
|
...onSendTemplateToSelected ? { onSendTemplateToSelected: () => onSendTemplateToSelected(inbox) } : inbox.canListTemplates ? { onSendTemplateToSelected: () => setTemplateModalOpen(true) } : {}
|
|
6979
6955
|
}
|
|
6980
6956
|
),
|
|
6981
|
-
/* @__PURE__ */
|
|
6957
|
+
/* @__PURE__ */ jsx32("section", { className: "cv-workspace-detail", children: selected ? /* @__PURE__ */ jsx32(
|
|
6982
6958
|
ConversationPane,
|
|
6983
6959
|
{
|
|
6984
6960
|
conversation: selected,
|
|
@@ -7008,14 +6984,14 @@ function ConversationsWorkspace({
|
|
|
7008
6984
|
...renderAboveTranscript ? { renderAboveTranscript } : {},
|
|
7009
6985
|
...onAttach ? { onAttach: (file) => onAttach(selected, file) } : {}
|
|
7010
6986
|
}
|
|
7011
|
-
) : /* @__PURE__ */
|
|
6987
|
+
) : /* @__PURE__ */ jsx32("p", { className: "cv-workspace-empty", children: labels.emptyDetail }) }),
|
|
7012
6988
|
showSimulator && selected ? (
|
|
7013
6989
|
// `min-height:0` junto do `min-width:0`: sem isso a linha do grid cresce com o conteúdo do
|
|
7014
6990
|
// painel, o scroll interno nunca ativa e quem rola passa a ser a página inteira.
|
|
7015
|
-
/* @__PURE__ */
|
|
6991
|
+
/* @__PURE__ */ jsx32("div", { className: "cv-workspace-simulator", children: simulator?.render ? simulator.render({ conversationId: selected.id, channel, close: () => setSimulatorOpen(false) }) : simulatorClient && conversations ? (
|
|
7016
6992
|
// `key` pela conversa: trocar de contato sem remontar deixaria o transcript e o campo
|
|
7017
6993
|
// de texto do contato anterior na tela.
|
|
7018
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx32(
|
|
7019
6995
|
ConversationSimulatorPanel,
|
|
7020
6996
|
{
|
|
7021
6997
|
client: simulatorClient,
|
|
@@ -7036,7 +7012,7 @@ function ConversationsWorkspace({
|
|
|
7036
7012
|
]
|
|
7037
7013
|
}
|
|
7038
7014
|
),
|
|
7039
|
-
templateModalOpen ? /* @__PURE__ */
|
|
7015
|
+
templateModalOpen ? /* @__PURE__ */ jsx32(
|
|
7040
7016
|
BulkTemplateModal,
|
|
7041
7017
|
{
|
|
7042
7018
|
labels,
|