@adatechnology/conversations-ui 0.6.1 → 0.8.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 +221 -19
- package/dist/{ConversationSimulatorPanel-CrfFjiWh.d.ts → ConversationSimulatorPanel-q-wVgBCN.d.ts} +1 -1
- package/dist/{chunk-HOKNKXIT.js → chunk-HMCOTZAX.js} +1 -1
- package/dist/{chunk-FAQLC3TX.js → chunk-L3OFAQPS.js} +2 -4
- package/dist/{chunk-CBYEHPX6.js → chunk-PJNR6UMN.js} +63 -1
- package/dist/flows/index.js +3 -5
- package/dist/index.d.ts +4 -4
- package/dist/index.js +834 -764
- package/dist/participant/index.d.ts +62 -3
- package/dist/participant/index.js +1444 -394
- package/dist/preview/index.d.ts +3 -3
- package/dist/preview/index.js +2 -3
- package/dist/{quickReply.types-B4gmZsSr.d.ts → quickReply.types-DzWH3NYV.d.ts} +1 -1
- package/dist/styles.css +629 -20
- package/package.json +3 -3
- package/src/participant/ConversationThread.test.tsx +165 -0
- package/src/participant/ConversationThread.tsx +117 -0
- package/src/participant/ParticipantAuthorAvatar.test.tsx +30 -0
- package/src/participant/ParticipantAuthorAvatar.tsx +24 -0
- package/src/participant/ParticipantBackButton.tsx +14 -0
- package/src/participant/ParticipantBubbleStatus.tsx +67 -0
- package/src/participant/ParticipantChannelBadges.tsx +13 -4
- package/src/participant/ParticipantComposer.tsx +8 -40
- package/src/participant/ParticipantComposerControls.tsx +83 -0
- package/src/participant/ParticipantConversationAvatar.tsx +13 -0
- package/src/participant/ParticipantConversations.tsx +7 -0
- package/src/participant/ParticipantConversationsOptions.test.tsx +87 -0
- package/src/participant/ParticipantCopyAnnouncer.tsx +48 -0
- package/src/participant/ParticipantCopyableToken.tsx +51 -0
- package/src/participant/ParticipantDayDivider.tsx +18 -0
- package/src/participant/ParticipantInbox.tsx +3 -1
- package/src/participant/ParticipantInboxRow.tsx +6 -4
- package/src/participant/ParticipantMessageBubble.test.tsx +52 -5
- package/src/participant/ParticipantMessageBubble.tsx +32 -84
- package/src/participant/ParticipantMessageNodes.tsx +54 -0
- package/src/participant/ParticipantMessageText.test.tsx +106 -0
- package/src/participant/ParticipantMessageText.tsx +52 -0
- package/src/participant/ParticipantProtocolBadge.tsx +15 -7
- package/src/participant/ParticipantProtocolView.test.tsx +4 -6
- package/src/participant/ParticipantScrollToLatest.test.tsx +153 -0
- package/src/participant/ParticipantScrollToLatest.tsx +40 -0
- package/src/participant/ParticipantThread.test.tsx +37 -0
- package/src/participant/ParticipantThread.tsx +54 -95
- package/src/participant/ParticipantThreadAvatarSequence.test.tsx +65 -0
- package/src/participant/ParticipantThreadHeader.test.tsx +181 -0
- package/src/participant/ParticipantThreadHeader.tsx +83 -0
- package/src/participant/ParticipantThreadScreen.tsx +30 -56
- package/src/participant/ParticipantTimeline.tsx +106 -0
- package/src/participant/conversationThreadApi.test.ts +27 -0
- package/src/participant/conversationThreadApi.ts +24 -0
- package/src/participant/conversationThreadCss.test.ts +116 -0
- package/src/participant/conversationThreadSummary.ts +34 -0
- package/src/participant/index.ts +4 -0
- package/src/participant/participantAutoGrow.test.ts +43 -0
- package/src/participant/participantAutoGrow.ts +12 -0
- package/src/participant/participantAvatar.test.ts +74 -0
- package/src/participant/participantAvatar.ts +48 -0
- package/src/participant/participantBubbleTail.test.tsx +107 -0
- package/src/participant/participantChatDesign.test.tsx +198 -0
- package/src/participant/participantContrast.test-helper.ts +116 -0
- package/src/participant/participantCopyAnnouncement.test.ts +52 -0
- package/src/participant/participantCopyAnnouncement.ts +37 -0
- package/src/participant/participantCss.test-helper.ts +34 -0
- package/src/participant/participantDay.test.ts +22 -0
- package/src/participant/participantDay.ts +8 -0
- package/src/participant/participantDocuments.ts +45 -0
- package/src/participant/participantGolden.test.tsx +46 -0
- package/src/participant/participantGoldenScenarios.test-helper.tsx +57 -0
- package/src/participant/participantHeaderA11y.test.tsx +85 -0
- package/src/participant/participantHeaderDesign.test.tsx +111 -0
- package/src/participant/participantLabels.ts +11 -0
- package/src/participant/participantMessageAtoms.ts +53 -0
- package/src/participant/participantMessageCopyables.test.ts +141 -0
- package/src/participant/participantMessageCopyables.ts +76 -0
- package/src/participant/participantMessageFormat.test-helper.ts +21 -0
- package/src/participant/participantMessageFormat.test.ts +177 -0
- package/src/participant/participantMessageFormat.ts +135 -0
- package/src/participant/participantMessageFormat.types.ts +22 -0
- package/src/participant/participantMessageInline.test.ts +82 -0
- package/src/participant/participantMessageInline.ts +99 -0
- package/src/participant/participantMessageLinks.test.ts +100 -0
- package/src/participant/participantMessageLinks.ts +54 -0
- package/src/participant/participantMessageTextStyle.test.ts +137 -0
- package/src/participant/participantMessages.ts +4 -3
- package/src/participant/participantNewMessages.test.ts +21 -0
- package/src/participant/participantNewMessages.ts +8 -3
- package/src/participant/participantPerspective.test.ts +67 -0
- package/src/participant/participantPerspective.ts +50 -0
- package/src/participant/participantPerspectiveRender.test.tsx +94 -0
- package/src/participant/participantScrollFocus.test.ts +22 -0
- package/src/participant/participantScrollFocus.ts +10 -0
- package/src/participant/participantScrollView.test.ts +74 -0
- package/src/participant/participantScrollView.ts +38 -0
- package/src/participant/participantScrollbars.test.ts +156 -0
- package/src/participant/participantSubjectIcon.test.tsx +27 -0
- package/src/participant/participantSubjectIcon.ts +26 -0
- package/src/participant/participantThemeContrast.test.ts +98 -0
- package/src/participant/test-fixtures/conversations-list.golden.html +1 -0
- package/src/participant/test-fixtures/conversations-selected.golden.html +1 -0
- package/src/participant/test-fixtures/thread-avatars-initials.golden.html +1 -0
- package/src/participant/test-fixtures/thread-closed.golden.html +1 -0
- package/src/participant/test-fixtures/thread-default.golden.html +1 -0
- package/src/participant/test-fixtures/thread-error.golden.html +1 -0
- package/src/participant/test-fixtures/thread-loading.golden.html +1 -0
- package/src/participant/test-fixtures/thread-plain.golden.html +1 -0
- package/src/participant/test-fixtures/thread-tail-off.golden.html +1 -0
- package/src/participant/useParticipantConversationView.ts +3 -0
- package/src/participant/useParticipantCopyFeedback.ts +33 -0
- package/src/participant/useParticipantThread.ts +13 -2
- package/src/participant/useParticipantThreadController.ts +112 -0
- package/src/participant/useParticipantThreadScroll.ts +13 -3
- package/src/participant/useParticipantUnread.test.tsx +40 -0
- package/src/participant/useParticipantUnread.ts +38 -0
- package/src/participant/useRevealActiveChip.ts +20 -0
- package/src/participant/useScrollAwayState.ts +24 -0
- package/src/participant/useStickToBottom.ts +16 -2
- package/src/styles.css +151 -23
- package/dist/chunk-MRVFFJEH.js +0 -64
- package/dist/chunk-OVFCLRQQ.js +0 -84
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
TOOLTIP_ATTRIBUTE,
|
|
3
3
|
TooltipLayer,
|
|
4
4
|
WhatsAppMessagePreview
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HMCOTZAX.js";
|
|
6
6
|
import {
|
|
7
7
|
AudioPlayer,
|
|
8
8
|
AudioRecorderButton,
|
|
@@ -59,17 +59,17 @@ import {
|
|
|
59
59
|
useConversationLocales,
|
|
60
60
|
useConversations,
|
|
61
61
|
useQuickRepliesPicker
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-L3OFAQPS.js";
|
|
63
63
|
import {
|
|
64
|
+
ZERO_WIDTH_SPACE,
|
|
64
65
|
cn,
|
|
66
|
+
htmlToWA,
|
|
67
|
+
parseWhatsAppFormatting,
|
|
65
68
|
useDarkMode,
|
|
66
|
-
useIsDarkTheme
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
CHAT_TEXT_SECONDARY_CLASS,
|
|
71
|
-
MessageText
|
|
72
|
-
} from "./chunk-OVFCLRQQ.js";
|
|
69
|
+
useIsDarkTheme,
|
|
70
|
+
waToHTML,
|
|
71
|
+
waToHTMLInline
|
|
72
|
+
} from "./chunk-PJNR6UMN.js";
|
|
73
73
|
import {
|
|
74
74
|
CHANNEL_CAPABILITIES,
|
|
75
75
|
CHANNEL_FILTER_ALL,
|
|
@@ -90,13 +90,6 @@ import {
|
|
|
90
90
|
isSameDay,
|
|
91
91
|
phoneInitials
|
|
92
92
|
} from "./chunk-O6457XHK.js";
|
|
93
|
-
import {
|
|
94
|
-
ZERO_WIDTH_SPACE,
|
|
95
|
-
htmlToWA,
|
|
96
|
-
parseWhatsAppFormatting,
|
|
97
|
-
waToHTML,
|
|
98
|
-
waToHTMLInline
|
|
99
|
-
} from "./chunk-CBYEHPX6.js";
|
|
100
93
|
|
|
101
94
|
// src/RichMessageComposer.tsx
|
|
102
95
|
import {
|
|
@@ -1081,6 +1074,12 @@ function Avatar({ name, avatarUrl, size = "md", className = "", labels }) {
|
|
|
1081
1074
|
|
|
1082
1075
|
// src/ConversationListItem.tsx
|
|
1083
1076
|
import { useMemo } from "react";
|
|
1077
|
+
|
|
1078
|
+
// src/theme.ts
|
|
1079
|
+
var CHAT_TEXT_PRIMARY_CLASS = "text-[#111b21] dark:text-[#e9edef]";
|
|
1080
|
+
var CHAT_TEXT_SECONDARY_CLASS = "text-[#667781] dark:text-[#8696a0]";
|
|
1081
|
+
|
|
1082
|
+
// src/ConversationListItem.tsx
|
|
1084
1083
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1085
1084
|
var DEFAULT_CONVERSATION_LIST_ITEM_LABELS = {
|
|
1086
1085
|
expiredWindow: "Janela expirada",
|
|
@@ -1317,21 +1316,92 @@ function useToast() {
|
|
|
1317
1316
|
return context;
|
|
1318
1317
|
}
|
|
1319
1318
|
|
|
1319
|
+
// src/MessageText.tsx
|
|
1320
|
+
import { useCallback as useCallback3, useState as useState5 } from "react";
|
|
1321
|
+
|
|
1322
|
+
// src/messageTextCopyInteraction.ts
|
|
1323
|
+
function resolveCopyInteraction({
|
|
1324
|
+
copyOnClick,
|
|
1325
|
+
accessibleCopy,
|
|
1326
|
+
onCopy
|
|
1327
|
+
}) {
|
|
1328
|
+
if (!copyOnClick) return {};
|
|
1329
|
+
if (!accessibleCopy) return { onClick: onCopy };
|
|
1330
|
+
return {
|
|
1331
|
+
onClick: onCopy,
|
|
1332
|
+
role: "button",
|
|
1333
|
+
tabIndex: 0,
|
|
1334
|
+
onKeyDown: (event) => {
|
|
1335
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1336
|
+
event.preventDefault();
|
|
1337
|
+
onCopy();
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// src/MessageTextCopiedBadge.tsx
|
|
1343
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1344
|
+
var TAILWIND_CLASS = "absolute top-0 right-0 -translate-y-full bg-[#3b4a54] text-white text-[11px] px-1.5 py-0.5 rounded shadow-lg";
|
|
1345
|
+
function MessageTextCopiedBadge({ label = "Copiado!", appearance = "tailwind" }) {
|
|
1346
|
+
const className = appearance === "stylesheet" ? "cv-message-text__copied" : TAILWIND_CLASS;
|
|
1347
|
+
return /* @__PURE__ */ jsx7("span", { className, children: label });
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
// src/MessageText.tsx
|
|
1351
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1352
|
+
var TAILWIND_CLASS2 = "text-[14.2px] leading-[19px] whitespace-pre-wrap break-words select-all [&_strong]:font-bold [&_em]:italic [&_del]:line-through";
|
|
1353
|
+
function resolveClassName(appearance, copyOnClick) {
|
|
1354
|
+
if (appearance === "tailwind") return TAILWIND_CLASS2;
|
|
1355
|
+
return copyOnClick ? "cv-message-text cv-message-text--copyable" : "cv-message-text";
|
|
1356
|
+
}
|
|
1357
|
+
function MessageText({
|
|
1358
|
+
message,
|
|
1359
|
+
copyOnClick = true,
|
|
1360
|
+
accessibleCopy = false,
|
|
1361
|
+
copiedLabel,
|
|
1362
|
+
appearance = "tailwind"
|
|
1363
|
+
}) {
|
|
1364
|
+
const [copied, setCopied] = useState5(false);
|
|
1365
|
+
const handleCopy = useCallback3(async () => {
|
|
1366
|
+
if (!copyOnClick || !message.content) return;
|
|
1367
|
+
try {
|
|
1368
|
+
await navigator.clipboard.writeText(message.content);
|
|
1369
|
+
setCopied(true);
|
|
1370
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
1371
|
+
} catch {
|
|
1372
|
+
}
|
|
1373
|
+
}, [copyOnClick, message.content]);
|
|
1374
|
+
if (message.type === "template")
|
|
1375
|
+
return /* @__PURE__ */ jsx8("p", { className: `text-sm italic ${CHAT_TEXT_SECONDARY_CLASS}`, children: message.content ?? "Template message" });
|
|
1376
|
+
const interactionProps = resolveCopyInteraction({ copyOnClick, accessibleCopy, onCopy: handleCopy });
|
|
1377
|
+
return /* @__PURE__ */ jsxs6(
|
|
1378
|
+
"div",
|
|
1379
|
+
{
|
|
1380
|
+
className: resolveClassName(appearance, copyOnClick),
|
|
1381
|
+
...interactionProps,
|
|
1382
|
+
children: [
|
|
1383
|
+
/* @__PURE__ */ jsx8("div", { children: parseWhatsAppFormatting(message.content ?? "") }),
|
|
1384
|
+
copied && /* @__PURE__ */ jsx8(MessageTextCopiedBadge, { label: copiedLabel, appearance })
|
|
1385
|
+
]
|
|
1386
|
+
}
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1320
1390
|
// src/MessageTimestamp.tsx
|
|
1321
|
-
import { jsx as
|
|
1391
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1322
1392
|
function MessageTimestamp({ timestamp, status, isOutbound }) {
|
|
1323
|
-
return /* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
isOutbound && status && /* @__PURE__ */
|
|
1393
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-end gap-[3px]", children: [
|
|
1394
|
+
/* @__PURE__ */ jsx9("span", { className: `text-[11px] ${CHAT_TEXT_SECONDARY_CLASS} leading-[15px] select-none`, children: timestamp }),
|
|
1395
|
+
isOutbound && status && /* @__PURE__ */ jsx9("span", { className: "flex items-center -mr-[2px]", children: /* @__PURE__ */ jsx9(StatusTicks, { status }) })
|
|
1326
1396
|
] });
|
|
1327
1397
|
}
|
|
1328
1398
|
|
|
1329
1399
|
// src/MessageTail.tsx
|
|
1330
|
-
import { jsx as
|
|
1400
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1331
1401
|
function MessageTail({ isOutbound }) {
|
|
1332
1402
|
if (isOutbound)
|
|
1333
|
-
return /* @__PURE__ */
|
|
1334
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ jsx10("svg", { className: "absolute top-0 -right-[5px] w-[5px] h-[11px]", viewBox: "0 0 5 11", fill: "#d9fdd3", children: /* @__PURE__ */ jsx10("path", { d: "M5 0H0v11c1.5-2 4.5-2 5-4V0z" }) });
|
|
1404
|
+
return /* @__PURE__ */ jsx10("svg", { className: "absolute top-0 -left-[5px] w-[5px] h-[11px]", viewBox: "0 0 5 11", fill: "white", children: /* @__PURE__ */ jsx10("path", { d: "M0 0h5v11C3.5 9 .5 9 0 7V0z" }) });
|
|
1335
1405
|
}
|
|
1336
1406
|
|
|
1337
1407
|
// src/conversationWindow.ts
|
|
@@ -1408,7 +1478,7 @@ var ICON_SIZE_INLINE = 14;
|
|
|
1408
1478
|
var ICON_SIZE_ACTION = 16;
|
|
1409
1479
|
|
|
1410
1480
|
// src/ChannelIcon.tsx
|
|
1411
|
-
import { Fragment as Fragment3, jsx as
|
|
1481
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1412
1482
|
var CHANNEL_BRAND_COLOR = {
|
|
1413
1483
|
[CONVERSATION_CHANNEL.WHATSAPP]: "#25D366",
|
|
1414
1484
|
[CONVERSATION_CHANNEL.MESSENGER]: "#0084FF",
|
|
@@ -1421,9 +1491,9 @@ var CHANNEL_BRAND_COLOR = {
|
|
|
1421
1491
|
function Glyph({ channel }) {
|
|
1422
1492
|
const color = CHANNEL_BRAND_COLOR[channel];
|
|
1423
1493
|
if (channel === CONVERSATION_CHANNEL.WHATSAPP) {
|
|
1424
|
-
return /* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1494
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1495
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1496
|
+
/* @__PURE__ */ jsx11(
|
|
1427
1497
|
"path",
|
|
1428
1498
|
{
|
|
1429
1499
|
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",
|
|
@@ -1433,34 +1503,34 @@ function Glyph({ channel }) {
|
|
|
1433
1503
|
] });
|
|
1434
1504
|
}
|
|
1435
1505
|
if (channel === CONVERSATION_CHANNEL.MESSENGER) {
|
|
1436
|
-
return /* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
1506
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1507
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1508
|
+
/* @__PURE__ */ jsx11("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" })
|
|
1439
1509
|
] });
|
|
1440
1510
|
}
|
|
1441
1511
|
if (channel === CONVERSATION_CHANNEL.INSTAGRAM) {
|
|
1442
|
-
return /* @__PURE__ */
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1512
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1513
|
+
/* @__PURE__ */ jsx11("rect", { x: "2", y: "2", width: "20", height: "20", rx: "6", fill: color }),
|
|
1514
|
+
/* @__PURE__ */ jsx11("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "3.5", fill: "none", stroke: "#fff", strokeWidth: "1.6" }),
|
|
1515
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "2.6", fill: "none", stroke: "#fff", strokeWidth: "1.6" }),
|
|
1516
|
+
/* @__PURE__ */ jsx11("circle", { cx: "16.4", cy: "7.6", r: "1", fill: "#fff" })
|
|
1447
1517
|
] });
|
|
1448
1518
|
}
|
|
1449
1519
|
if (channel === CONVERSATION_CHANNEL.EMAIL) {
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1520
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1521
|
+
/* @__PURE__ */ jsx11("rect", { x: "2", y: "4", width: "20", height: "16", rx: "3", fill: color }),
|
|
1522
|
+
/* @__PURE__ */ jsx11("path", { d: "M3.5 6.5 12 13l8.5-6.5", fill: "none", stroke: "#fff", strokeWidth: "1.6", strokeLinejoin: "round", strokeLinecap: "round" })
|
|
1453
1523
|
] });
|
|
1454
1524
|
}
|
|
1455
|
-
return /* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1525
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1526
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1527
|
+
/* @__PURE__ */ jsx11("path", { d: "M6.5 8.5h11v7h-5.5L8.5 18v-2.5h-2v-7Z", fill: "#fff" })
|
|
1458
1528
|
] });
|
|
1459
1529
|
}
|
|
1460
1530
|
function ChannelIcon({ channel, size = 14, className = "" }) {
|
|
1461
1531
|
const resolved = channel ?? CONVERSATION_CHANNEL.WHATSAPP;
|
|
1462
1532
|
const { label } = capabilitiesOf(resolved);
|
|
1463
|
-
return /* @__PURE__ */
|
|
1533
|
+
return /* @__PURE__ */ jsx11(
|
|
1464
1534
|
"svg",
|
|
1465
1535
|
{
|
|
1466
1536
|
viewBox: "0 0 24 24",
|
|
@@ -1469,13 +1539,13 @@ function ChannelIcon({ channel, size = 14, className = "" }) {
|
|
|
1469
1539
|
className: `inline-block shrink-0 ${className}`.trim(),
|
|
1470
1540
|
role: "img",
|
|
1471
1541
|
"aria-label": label,
|
|
1472
|
-
children: /* @__PURE__ */
|
|
1542
|
+
children: /* @__PURE__ */ jsx11(Glyph, { channel: resolved })
|
|
1473
1543
|
}
|
|
1474
1544
|
);
|
|
1475
1545
|
}
|
|
1476
1546
|
|
|
1477
1547
|
// src/ConversationRow.tsx
|
|
1478
|
-
import { jsx as
|
|
1548
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1479
1549
|
var WINDOW_TITLE = {
|
|
1480
1550
|
[CONVERSATION_WINDOW.ALL]: "",
|
|
1481
1551
|
[CONVERSATION_WINDOW.FRESH]: "Janela de 24h aberta (menos de 12h)",
|
|
@@ -1519,8 +1589,8 @@ function ConversationRow({
|
|
|
1519
1589
|
lastInboundAt: conversation.lastInboundAt,
|
|
1520
1590
|
now
|
|
1521
1591
|
});
|
|
1522
|
-
return /* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1592
|
+
return /* @__PURE__ */ jsxs9("div", { className: cn("cv-row flex border-b", active && "cv-row--active", classNames?.root, className), children: [
|
|
1593
|
+
/* @__PURE__ */ jsx12(
|
|
1524
1594
|
"span",
|
|
1525
1595
|
{
|
|
1526
1596
|
className: cn("w-1 shrink-0", WINDOW_BAR_CLASS[window2], classNames?.windowBar),
|
|
@@ -1528,9 +1598,9 @@ function ConversationRow({
|
|
|
1528
1598
|
"aria-label": WINDOW_TITLE[window2]
|
|
1529
1599
|
}
|
|
1530
1600
|
),
|
|
1531
|
-
/* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
|
|
1602
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-2 px-2 pt-2", children: [
|
|
1603
|
+
/* @__PURE__ */ jsx12(
|
|
1534
1604
|
"input",
|
|
1535
1605
|
{
|
|
1536
1606
|
type: "checkbox",
|
|
@@ -1540,7 +1610,7 @@ function ConversationRow({
|
|
|
1540
1610
|
className: "mt-3"
|
|
1541
1611
|
}
|
|
1542
1612
|
),
|
|
1543
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsx12("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx12(
|
|
1544
1614
|
ConversationListItem,
|
|
1545
1615
|
{
|
|
1546
1616
|
conversation,
|
|
@@ -1551,37 +1621,37 @@ function ConversationRow({
|
|
|
1551
1621
|
}
|
|
1552
1622
|
) })
|
|
1553
1623
|
] }),
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1.5 px-4 pb-2 pl-8", children: [
|
|
1625
|
+
/* @__PURE__ */ jsxs9("span", { className: "cv-pill", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx12(ChannelIcon, { channel: conversation.channel }),
|
|
1557
1627
|
" ",
|
|
1558
1628
|
capabilities.label
|
|
1559
1629
|
] }),
|
|
1560
|
-
conversation.mode === "human" ? /* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1630
|
+
conversation.mode === "human" ? /* @__PURE__ */ jsxs9("span", { className: "cv-pill cv-pill--success", children: [
|
|
1631
|
+
/* @__PURE__ */ jsx12(UserRound, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1562
1632
|
" em atendimento"
|
|
1563
1633
|
] }) : null,
|
|
1564
|
-
isWaiting ? /* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1634
|
+
isWaiting ? /* @__PURE__ */ jsxs9("span", { className: "cv-pill cv-pill--warning", children: [
|
|
1635
|
+
/* @__PURE__ */ jsx12(Hourglass, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1566
1636
|
" aguardando atendimento"
|
|
1567
1637
|
] }) : null,
|
|
1568
|
-
!isWaiting && conversation.mode === "bot" ? /* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1638
|
+
!isWaiting && conversation.mode === "bot" ? /* @__PURE__ */ jsxs9("span", { className: "cv-pill", children: [
|
|
1639
|
+
/* @__PURE__ */ jsx12(Bot, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1570
1640
|
" bot ativo"
|
|
1571
1641
|
] }) : null,
|
|
1572
|
-
replyLatency ? /* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1642
|
+
replyLatency ? /* @__PURE__ */ jsxs9("span", { className: cn("cv-pill", REPLY_LATENCY_PILL_CLASS[replyLatency]), children: [
|
|
1643
|
+
/* @__PURE__ */ jsx12(AlarmClock, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1574
1644
|
" sem resposta h\xE1",
|
|
1575
1645
|
" ",
|
|
1576
1646
|
formatStalledFor(conversation.lastInboundAt ?? conversation.lastAt, now)
|
|
1577
1647
|
] }) : null,
|
|
1578
|
-
isStalled ? /* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1648
|
+
isStalled ? /* @__PURE__ */ jsxs9("span", { className: "cv-pill cv-pill--danger", children: [
|
|
1649
|
+
/* @__PURE__ */ jsx12(AlarmClock, { size: ICON_SIZE_PILL, "aria-hidden": "true" }),
|
|
1580
1650
|
" parada h\xE1",
|
|
1581
1651
|
" ",
|
|
1582
1652
|
formatStalledFor(conversation.lastAt, now)
|
|
1583
1653
|
] }) : null,
|
|
1584
|
-
isWaiting ? /* @__PURE__ */
|
|
1654
|
+
isWaiting ? /* @__PURE__ */ jsxs9(
|
|
1585
1655
|
"button",
|
|
1586
1656
|
{
|
|
1587
1657
|
type: "button",
|
|
@@ -1591,7 +1661,7 @@ function ConversationRow({
|
|
|
1591
1661
|
"aria-label": TAKEOVER_LABEL,
|
|
1592
1662
|
className: "cv-header-action",
|
|
1593
1663
|
children: [
|
|
1594
|
-
/* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ jsx12(Play, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
1595
1665
|
" ",
|
|
1596
1666
|
TAKEOVER_LABEL
|
|
1597
1667
|
]
|
|
@@ -1603,9 +1673,9 @@ function ConversationRow({
|
|
|
1603
1673
|
}
|
|
1604
1674
|
|
|
1605
1675
|
// src/ConversationHeader.tsx
|
|
1606
|
-
import { useRef as useRef4, useState as
|
|
1676
|
+
import { useRef as useRef4, useState as useState6 } from "react";
|
|
1607
1677
|
import { ArrowLeft, Bot as Bot2, Download, FileText, Headset, MoreVertical, UserRound as UserRound2, X } from "lucide-react";
|
|
1608
|
-
import { jsx as
|
|
1678
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1609
1679
|
var HEADER_UTILITIES_MIN_WIDTH = 720;
|
|
1610
1680
|
var HEADER_ACTIONS_MIN_WIDTH = 600;
|
|
1611
1681
|
var DEFAULT_CONVERSATION_HEADER_LABELS = {
|
|
@@ -1642,7 +1712,7 @@ function ConversationHeader({
|
|
|
1642
1712
|
const displayHandle = formatContactHandle({ handle, channel: conversation.channel });
|
|
1643
1713
|
const flag = contactFlag({ handle, channel: conversation.channel });
|
|
1644
1714
|
const capabilities = capabilitiesOf(conversation.channel);
|
|
1645
|
-
const [menuOpen, setMenuOpen] =
|
|
1715
|
+
const [menuOpen, setMenuOpen] = useState6(false);
|
|
1646
1716
|
const headerRef = useRef4(null);
|
|
1647
1717
|
const headerWidth = useContainerWidth(headerRef);
|
|
1648
1718
|
const showsUtilitiesInline = headerWidth === void 0 || headerWidth >= HEADER_UTILITIES_MIN_WIDTH;
|
|
@@ -1650,14 +1720,14 @@ function ConversationHeader({
|
|
|
1650
1720
|
const utilityCandidates = [
|
|
1651
1721
|
onOpenDocuments ? {
|
|
1652
1722
|
key: "documents",
|
|
1653
|
-
icon: /* @__PURE__ */
|
|
1723
|
+
icon: /* @__PURE__ */ jsx13(FileText, { size: ICON_SIZE_ACTION }),
|
|
1654
1724
|
label: labels.documents,
|
|
1655
1725
|
run: onOpenDocuments,
|
|
1656
1726
|
active: documentsOpen
|
|
1657
1727
|
} : void 0,
|
|
1658
1728
|
onDownload ? {
|
|
1659
1729
|
key: "download",
|
|
1660
|
-
icon: /* @__PURE__ */
|
|
1730
|
+
icon: /* @__PURE__ */ jsx13(Download, { size: ICON_SIZE_ACTION }),
|
|
1661
1731
|
label: labels.download,
|
|
1662
1732
|
run: onDownload,
|
|
1663
1733
|
active: false
|
|
@@ -1668,7 +1738,7 @@ function ConversationHeader({
|
|
|
1668
1738
|
const actionCandidates = [
|
|
1669
1739
|
!isHuman && onTakeover ? {
|
|
1670
1740
|
key: "takeover",
|
|
1671
|
-
icon: /* @__PURE__ */
|
|
1741
|
+
icon: /* @__PURE__ */ jsx13(Headset, { size: ICON_SIZE_ACTION }),
|
|
1672
1742
|
label: labels.takeover,
|
|
1673
1743
|
hint: labels.takeover,
|
|
1674
1744
|
run: onTakeover,
|
|
@@ -1676,7 +1746,7 @@ function ConversationHeader({
|
|
|
1676
1746
|
} : void 0,
|
|
1677
1747
|
isHuman && onReturnToBot ? {
|
|
1678
1748
|
key: "release",
|
|
1679
|
-
icon: /* @__PURE__ */
|
|
1749
|
+
icon: /* @__PURE__ */ jsx13(Bot2, { size: ICON_SIZE_ACTION }),
|
|
1680
1750
|
label: labels.returnToBot,
|
|
1681
1751
|
hint: labels.returnToBot,
|
|
1682
1752
|
run: onReturnToBot,
|
|
@@ -1684,7 +1754,7 @@ function ConversationHeader({
|
|
|
1684
1754
|
} : void 0,
|
|
1685
1755
|
isHuman && onFinish ? {
|
|
1686
1756
|
key: "finish",
|
|
1687
|
-
icon: /* @__PURE__ */
|
|
1757
|
+
icon: /* @__PURE__ */ jsx13(X, { size: ICON_SIZE_ACTION }),
|
|
1688
1758
|
label: labels.finish,
|
|
1689
1759
|
hint: labels.finish,
|
|
1690
1760
|
run: onFinish,
|
|
@@ -1703,7 +1773,7 @@ function ConversationHeader({
|
|
|
1703
1773
|
})),
|
|
1704
1774
|
...showsActionsInline ? [] : actions
|
|
1705
1775
|
];
|
|
1706
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ jsxs10(
|
|
1707
1777
|
"header",
|
|
1708
1778
|
{
|
|
1709
1779
|
ref: headerRef,
|
|
@@ -1713,37 +1783,37 @@ function ConversationHeader({
|
|
|
1713
1783
|
className
|
|
1714
1784
|
),
|
|
1715
1785
|
children: [
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
onBack ? /* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1786
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex min-w-0 flex-1 items-center gap-3", classNames?.identity), children: [
|
|
1787
|
+
onBack ? /* @__PURE__ */ jsx13("button", { type: "button", onClick: onBack, className: "cv-back cv-touch", "aria-label": labels.back, "data-cv-tooltip": labels.back, children: /* @__PURE__ */ jsx13(ArrowLeft, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }) }) : null,
|
|
1788
|
+
/* @__PURE__ */ jsx13(Avatar, { name: conversation.clientName, size: "md" }),
|
|
1789
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0", children: [
|
|
1790
|
+
/* @__PURE__ */ jsx13("p", { className: cn("truncate font-medium", classNames?.name), children: conversation.clientName ?? displayHandle }),
|
|
1791
|
+
/* @__PURE__ */ jsxs10("p", { className: cn("flex min-w-0 flex-nowrap items-center gap-2 overflow-hidden text-xs text-gray-500", classNames?.meta), children: [
|
|
1792
|
+
/* @__PURE__ */ jsxs10("span", { className: "truncate", children: [
|
|
1723
1793
|
flag ? `${flag} ` : "",
|
|
1724
1794
|
displayHandle
|
|
1725
1795
|
] }),
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
1728
|
-
showsUtilitiesInline ? /* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ jsxs10("span", { className: "inline-flex flex-shrink-0 items-center gap-1", children: [
|
|
1797
|
+
/* @__PURE__ */ jsx13(ChannelIcon, { channel: conversation.channel }),
|
|
1798
|
+
showsUtilitiesInline ? /* @__PURE__ */ jsx13("span", { children: capabilities.label }) : null
|
|
1729
1799
|
] }),
|
|
1730
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ jsxs10(
|
|
1731
1801
|
"span",
|
|
1732
1802
|
{
|
|
1733
1803
|
className: "inline-flex flex-shrink-0 items-center gap-1",
|
|
1734
1804
|
...showsUtilitiesInline ? {} : { role: "img", "aria-label": isHuman ? labels.humanMode : labels.botMode, "data-cv-tooltip": isHuman ? labels.humanMode : labels.botMode },
|
|
1735
1805
|
children: [
|
|
1736
|
-
isHuman ? /* @__PURE__ */
|
|
1737
|
-
showsUtilitiesInline ? /* @__PURE__ */
|
|
1806
|
+
isHuman ? /* @__PURE__ */ jsx13(UserRound2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }) : /* @__PURE__ */ jsx13(Bot2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
1807
|
+
showsUtilitiesInline ? /* @__PURE__ */ jsx13("span", { children: isHuman ? labels.humanMode : labels.botMode }) : null
|
|
1738
1808
|
]
|
|
1739
1809
|
}
|
|
1740
1810
|
)
|
|
1741
1811
|
] })
|
|
1742
1812
|
] })
|
|
1743
1813
|
] }),
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
(showsUtilitiesInline ? utilities : []).map((utility) => /* @__PURE__ */
|
|
1814
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex shrink-0 items-center gap-2", classNames?.actions), children: [
|
|
1815
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex items-center gap-2", classNames?.desktopActions), children: [
|
|
1816
|
+
(showsUtilitiesInline ? utilities : []).map((utility) => /* @__PURE__ */ jsx13(
|
|
1747
1817
|
"button",
|
|
1748
1818
|
{
|
|
1749
1819
|
type: "button",
|
|
@@ -1757,7 +1827,7 @@ function ConversationHeader({
|
|
|
1757
1827
|
},
|
|
1758
1828
|
utility.key
|
|
1759
1829
|
)),
|
|
1760
|
-
(showsActionsInline ? actions : []).map((action) => /* @__PURE__ */
|
|
1830
|
+
(showsActionsInline ? actions : []).map((action) => /* @__PURE__ */ jsxs10(
|
|
1761
1831
|
"button",
|
|
1762
1832
|
{
|
|
1763
1833
|
type: "button",
|
|
@@ -1774,8 +1844,8 @@ function ConversationHeader({
|
|
|
1774
1844
|
action.key
|
|
1775
1845
|
))
|
|
1776
1846
|
] }),
|
|
1777
|
-
menuItems.length > 0 ? /* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1847
|
+
menuItems.length > 0 ? /* @__PURE__ */ jsxs10("div", { className: cn("cv-menu", classNames?.mobileMenu), children: [
|
|
1848
|
+
/* @__PURE__ */ jsx13(
|
|
1779
1849
|
"button",
|
|
1780
1850
|
{
|
|
1781
1851
|
type: "button",
|
|
@@ -1784,10 +1854,10 @@ function ConversationHeader({
|
|
|
1784
1854
|
"aria-label": labels.moreActions,
|
|
1785
1855
|
"data-cv-tooltip": labels.moreActions,
|
|
1786
1856
|
className: "cv-header-icon cv-touch",
|
|
1787
|
-
children: /* @__PURE__ */
|
|
1857
|
+
children: /* @__PURE__ */ jsx13(MoreVertical, { size: ICON_SIZE_ACTION, "aria-hidden": "true" })
|
|
1788
1858
|
}
|
|
1789
1859
|
),
|
|
1790
|
-
menuOpen ? /* @__PURE__ */
|
|
1860
|
+
menuOpen ? /* @__PURE__ */ jsx13("div", { className: "cv-menu-panel", role: "menu", children: menuItems.map((item) => /* @__PURE__ */ jsxs10(
|
|
1791
1861
|
"button",
|
|
1792
1862
|
{
|
|
1793
1863
|
type: "button",
|
|
@@ -1815,14 +1885,14 @@ function ConversationHeader({
|
|
|
1815
1885
|
}
|
|
1816
1886
|
|
|
1817
1887
|
// src/ConversationContextPanel.tsx
|
|
1818
|
-
import { useState as
|
|
1888
|
+
import { useState as useState8 } from "react";
|
|
1819
1889
|
import { Check, ChevronDown, ChevronUp, Clock, Pencil } from "lucide-react";
|
|
1820
1890
|
|
|
1821
1891
|
// src/useIsNarrow.ts
|
|
1822
|
-
import { useEffect as useEffect5, useState as
|
|
1892
|
+
import { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1823
1893
|
var NARROW_MAX_WIDTH_PX = 1023;
|
|
1824
1894
|
function useIsNarrow() {
|
|
1825
|
-
const [isNarrow, setIsNarrow] =
|
|
1895
|
+
const [isNarrow, setIsNarrow] = useState7(
|
|
1826
1896
|
() => typeof window !== "undefined" && window.matchMedia(`(max-width: ${NARROW_MAX_WIDTH_PX}px)`).matches
|
|
1827
1897
|
);
|
|
1828
1898
|
useEffect5(() => {
|
|
@@ -1836,7 +1906,7 @@ function useIsNarrow() {
|
|
|
1836
1906
|
}
|
|
1837
1907
|
|
|
1838
1908
|
// src/ConversationContextPanel.tsx
|
|
1839
|
-
import { jsx as
|
|
1909
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1840
1910
|
var DEFAULT_CONVERSATION_CONTEXT_LABELS = {
|
|
1841
1911
|
title: "Suas Sele\xE7\xF5es",
|
|
1842
1912
|
empty: "Nada coletado ainda nesta conversa.",
|
|
@@ -1860,9 +1930,9 @@ var GLYPH_STYLE = {
|
|
|
1860
1930
|
};
|
|
1861
1931
|
function StatusGlyph({ status }) {
|
|
1862
1932
|
const size = 11;
|
|
1863
|
-
if (status === "completed") return /* @__PURE__ */
|
|
1864
|
-
if (status === "editing") return /* @__PURE__ */
|
|
1865
|
-
return /* @__PURE__ */
|
|
1933
|
+
if (status === "completed") return /* @__PURE__ */ jsx14(Check, { size, "aria-hidden": true });
|
|
1934
|
+
if (status === "editing") return /* @__PURE__ */ jsx14(Pencil, { size, "aria-hidden": true });
|
|
1935
|
+
return /* @__PURE__ */ jsx14(Clock, { size, "aria-hidden": true });
|
|
1866
1936
|
}
|
|
1867
1937
|
function CountPill({
|
|
1868
1938
|
status,
|
|
@@ -1870,8 +1940,8 @@ function CountPill({
|
|
|
1870
1940
|
className
|
|
1871
1941
|
}) {
|
|
1872
1942
|
if (count === 0) return null;
|
|
1873
|
-
return /* @__PURE__ */
|
|
1874
|
-
/* @__PURE__ */
|
|
1943
|
+
return /* @__PURE__ */ jsxs11("span", { className: cn("flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium", className), children: [
|
|
1944
|
+
/* @__PURE__ */ jsx14(StatusGlyph, { status }),
|
|
1875
1945
|
count
|
|
1876
1946
|
] });
|
|
1877
1947
|
}
|
|
@@ -1887,12 +1957,12 @@ function ConversationContextPanel({
|
|
|
1887
1957
|
const counts = { completed: 0, pending: 0, editing: 0 };
|
|
1888
1958
|
for (const entry of entries) counts[statusOf(entry)] += 1;
|
|
1889
1959
|
const isNarrow = useIsNarrow();
|
|
1890
|
-
const [manualOpen, setManualOpen] =
|
|
1960
|
+
const [manualOpen, setManualOpen] = useState8(void 0);
|
|
1891
1961
|
const open = manualOpen ?? defaultOpen ?? (!isNarrow && counts.completed > 0);
|
|
1892
1962
|
return (
|
|
1893
1963
|
// Faixa azul clara com separador, como o wrapper do financiamento: sem ela o card encostava
|
|
1894
1964
|
// direto no papel de parede da conversa e os dois blocos se misturavam.
|
|
1895
|
-
/* @__PURE__ */
|
|
1965
|
+
/* @__PURE__ */ jsx14("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__ */ jsxs11(
|
|
1896
1966
|
"section",
|
|
1897
1967
|
{
|
|
1898
1968
|
className: cn(
|
|
@@ -1900,7 +1970,7 @@ function ConversationContextPanel({
|
|
|
1900
1970
|
classNames?.root
|
|
1901
1971
|
),
|
|
1902
1972
|
children: [
|
|
1903
|
-
/* @__PURE__ */
|
|
1973
|
+
/* @__PURE__ */ jsxs11(
|
|
1904
1974
|
"button",
|
|
1905
1975
|
{
|
|
1906
1976
|
type: "button",
|
|
@@ -1913,11 +1983,11 @@ function ConversationContextPanel({
|
|
|
1913
1983
|
classNames?.toggle
|
|
1914
1984
|
),
|
|
1915
1985
|
children: [
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
flowLabel ? /* @__PURE__ */
|
|
1920
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ jsxs11("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1987
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u{1F4CB}" }),
|
|
1988
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.title }),
|
|
1989
|
+
flowLabel ? /* @__PURE__ */ jsx14("span", { className: "truncate text-xs font-medium text-blue-600 dark:text-blue-400", children: flowLabel }) : null,
|
|
1990
|
+
/* @__PURE__ */ jsx14(
|
|
1921
1991
|
"span",
|
|
1922
1992
|
{
|
|
1923
1993
|
className: cn(
|
|
@@ -1928,8 +1998,8 @@ function ConversationContextPanel({
|
|
|
1928
1998
|
}
|
|
1929
1999
|
)
|
|
1930
2000
|
] }),
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
2001
|
+
/* @__PURE__ */ jsxs11("span", { className: "flex flex-shrink-0 items-center gap-2", children: [
|
|
2002
|
+
/* @__PURE__ */ jsx14(
|
|
1933
2003
|
CountPill,
|
|
1934
2004
|
{
|
|
1935
2005
|
status: "completed",
|
|
@@ -1937,7 +2007,7 @@ function ConversationContextPanel({
|
|
|
1937
2007
|
className: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"
|
|
1938
2008
|
}
|
|
1939
2009
|
),
|
|
1940
|
-
/* @__PURE__ */
|
|
2010
|
+
/* @__PURE__ */ jsx14(
|
|
1941
2011
|
CountPill,
|
|
1942
2012
|
{
|
|
1943
2013
|
status: "editing",
|
|
@@ -1945,7 +2015,7 @@ function ConversationContextPanel({
|
|
|
1945
2015
|
className: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"
|
|
1946
2016
|
}
|
|
1947
2017
|
),
|
|
1948
|
-
/* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ jsx14(
|
|
1949
2019
|
CountPill,
|
|
1950
2020
|
{
|
|
1951
2021
|
status: "pending",
|
|
@@ -1953,7 +2023,7 @@ function ConversationContextPanel({
|
|
|
1953
2023
|
className: "bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"
|
|
1954
2024
|
}
|
|
1955
2025
|
),
|
|
1956
|
-
open ? /* @__PURE__ */
|
|
2026
|
+
open ? /* @__PURE__ */ jsx14(ChevronUp, { size: 15, className: "flex-shrink-0 text-blue-500", "aria-hidden": true }) : /* @__PURE__ */ jsx14(ChevronDown, { size: 15, className: "flex-shrink-0 text-blue-500", "aria-hidden": true })
|
|
1957
2027
|
] })
|
|
1958
2028
|
]
|
|
1959
2029
|
}
|
|
@@ -1969,14 +2039,14 @@ function ConversationContextPanel({
|
|
|
1969
2039
|
* Aqui só o corpo rola — o cabeçalho é o que fecha o painel, e perder o clique de fechar
|
|
1970
2040
|
* no meio da rolagem é pior do que a economia de uma linha de markup.
|
|
1971
2041
|
*/
|
|
1972
|
-
/* @__PURE__ */
|
|
2042
|
+
/* @__PURE__ */ jsx14(
|
|
1973
2043
|
"div",
|
|
1974
2044
|
{
|
|
1975
2045
|
className: cn(
|
|
1976
2046
|
"cv-scrollbar-thin max-h-64 overflow-y-auto border-t border-blue-200 px-4 pb-4 pt-1 dark:border-blue-900",
|
|
1977
2047
|
classNames?.body
|
|
1978
2048
|
),
|
|
1979
|
-
children: entries.length === 0 ? /* @__PURE__ */
|
|
2049
|
+
children: entries.length === 0 ? /* @__PURE__ */ jsx14("p", { className: "pt-2 text-xs text-gray-500 dark:text-gray-400", children: labels.empty }) : (
|
|
1980
2050
|
/**
|
|
1981
2051
|
* Três colunas no desktop, como no financiamento — com duas, seis campos viravam uma
|
|
1982
2052
|
* coluna alta que empurrava a conversa.
|
|
@@ -1986,19 +2056,19 @@ function ConversationContextPanel({
|
|
|
1986
2056
|
* e "falta endereço" é justamente o que o atendente precisa ver ao assumir. Então o
|
|
1987
2057
|
* pendente aparece — tracejado e apagado, para ler como lacuna e não como dado.
|
|
1988
2058
|
*/
|
|
1989
|
-
/* @__PURE__ */
|
|
2059
|
+
/* @__PURE__ */ jsx14("dl", { className: "mt-2 grid grid-cols-2 gap-2 lg:grid-cols-3", children: entries.map((entry) => {
|
|
1990
2060
|
const status = statusOf(entry);
|
|
1991
|
-
return /* @__PURE__ */
|
|
2061
|
+
return /* @__PURE__ */ jsxs11(
|
|
1992
2062
|
"div",
|
|
1993
2063
|
{
|
|
1994
2064
|
className: cn("min-w-0 rounded-lg p-2.5 transition-all", CARD_STYLE[status]),
|
|
1995
2065
|
children: [
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
entry.icon ? /* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */
|
|
1999
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ jsxs11("dt", { className: "mb-1 flex items-center justify-center gap-1", children: [
|
|
2067
|
+
entry.icon ? /* @__PURE__ */ jsx14("span", { "aria-hidden": true, className: "text-base leading-none", children: entry.icon }) : null,
|
|
2068
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate text-[10px] font-medium uppercase leading-none tracking-wide text-gray-500 dark:text-gray-400", children: entry.label }),
|
|
2069
|
+
/* @__PURE__ */ jsx14("span", { className: cn("flex-shrink-0 leading-none", GLYPH_STYLE[status]), children: /* @__PURE__ */ jsx14(StatusGlyph, { status }) })
|
|
2000
2070
|
] }),
|
|
2001
|
-
/* @__PURE__ */
|
|
2071
|
+
/* @__PURE__ */ jsx14(
|
|
2002
2072
|
"dd",
|
|
2003
2073
|
{
|
|
2004
2074
|
className: cn(
|
|
@@ -2026,7 +2096,7 @@ function ConversationContextPanel({
|
|
|
2026
2096
|
|
|
2027
2097
|
// src/WindowExpiredNotice.tsx
|
|
2028
2098
|
import { AlarmClock as AlarmClock2, Send } from "lucide-react";
|
|
2029
|
-
import { jsx as
|
|
2099
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2030
2100
|
var DEFAULT_WINDOW_EXPIRED_LABELS = {
|
|
2031
2101
|
title: "Janela de 24h expirada \u2014 o WhatsApp n\xE3o aceita mensagens livres.",
|
|
2032
2102
|
description: "Envie uma mensagem de template para reabrir a conversa com o cliente.",
|
|
@@ -2039,14 +2109,14 @@ function WindowExpiredNotice({
|
|
|
2039
2109
|
className
|
|
2040
2110
|
}) {
|
|
2041
2111
|
const labels = { ...DEFAULT_WINDOW_EXPIRED_LABELS, ...labelsOverride };
|
|
2042
|
-
return /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2112
|
+
return /* @__PURE__ */ jsxs12("div", { role: "status", className: cn("border-t bg-yellow-50 px-4 py-3 text-sm dark:bg-yellow-950", className), children: [
|
|
2113
|
+
/* @__PURE__ */ jsxs12("p", { className: "flex items-center gap-2 font-medium text-yellow-900 dark:text-yellow-200", children: [
|
|
2114
|
+
/* @__PURE__ */ jsx15(AlarmClock2, { size: ICON_SIZE_INLINE, "aria-hidden": "true", className: "shrink-0" }),
|
|
2045
2115
|
labels.title
|
|
2046
2116
|
] }),
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
onSendTemplate ? /* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2117
|
+
/* @__PURE__ */ jsx15("p", { className: "text-yellow-800 dark:text-yellow-300", children: labels.description }),
|
|
2118
|
+
onSendTemplate ? /* @__PURE__ */ jsxs12("button", { "data-cv-tooltip": labels.sendTemplate, "aria-label": labels.sendTemplate, type: "button", onClick: onSendTemplate, disabled, className: "cv-header-action mt-2", children: [
|
|
2119
|
+
/* @__PURE__ */ jsx15(Send, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
2050
2120
|
labels.sendTemplate
|
|
2051
2121
|
] }) : null
|
|
2052
2122
|
] });
|
|
@@ -2056,17 +2126,17 @@ function isWindowBlocking(window2) {
|
|
|
2056
2126
|
}
|
|
2057
2127
|
|
|
2058
2128
|
// src/documents/DocumentsWorkspace.tsx
|
|
2059
|
-
import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef5, useState as
|
|
2129
|
+
import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef5, useState as useState11 } from "react";
|
|
2060
2130
|
import { Download as Download2, Eye, MessageSquare, Trash2, Upload, X as X3 } from "lucide-react";
|
|
2061
2131
|
|
|
2062
2132
|
// src/listing/index.tsx
|
|
2063
|
-
import { useState as
|
|
2133
|
+
import { useState as useState9 } from "react";
|
|
2064
2134
|
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown as ChevronDown2, X as X2 } from "lucide-react";
|
|
2065
|
-
import { Fragment as Fragment4, jsx as
|
|
2135
|
+
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2066
2136
|
function SortableHead({ label, field, activeField, direction, onSort, className }) {
|
|
2067
2137
|
const isActive = activeField === field;
|
|
2068
2138
|
const Icon = !isActive ? ArrowUpDown : direction === "asc" ? ArrowUp : ArrowDown;
|
|
2069
|
-
return /* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ jsx16("th", { scope: "col", className: cn("px-3 py-2 text-left text-xs font-medium", className), children: /* @__PURE__ */ jsxs13(
|
|
2070
2140
|
"button",
|
|
2071
2141
|
{
|
|
2072
2142
|
"data-cv-tooltip": label,
|
|
@@ -2076,18 +2146,18 @@ function SortableHead({ label, field, activeField, direction, onSort, className
|
|
|
2076
2146
|
className: "inline-flex items-center gap-1 hover:text-gray-900 dark:hover:text-gray-100",
|
|
2077
2147
|
children: [
|
|
2078
2148
|
label,
|
|
2079
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ jsx16(Icon, { size: 12, className: isActive ? "" : "opacity-40", "aria-hidden": "true" })
|
|
2080
2150
|
]
|
|
2081
2151
|
}
|
|
2082
2152
|
) });
|
|
2083
2153
|
}
|
|
2084
2154
|
function MultiSelectFilter({ label, options, selected, onChange, className }) {
|
|
2085
|
-
const [open, setOpen] =
|
|
2155
|
+
const [open, setOpen] = useState9(false);
|
|
2086
2156
|
function toggle(value) {
|
|
2087
2157
|
onChange(selected.includes(value) ? selected.filter((item) => item !== value) : [...selected, value]);
|
|
2088
2158
|
}
|
|
2089
|
-
return /* @__PURE__ */
|
|
2090
|
-
/* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn("relative", className), children: [
|
|
2160
|
+
/* @__PURE__ */ jsxs13(
|
|
2091
2161
|
"button",
|
|
2092
2162
|
{
|
|
2093
2163
|
"data-cv-tooltip": label,
|
|
@@ -2097,15 +2167,15 @@ function MultiSelectFilter({ label, options, selected, onChange, className }) {
|
|
|
2097
2167
|
className: "cv-header-action inline-flex items-center gap-1",
|
|
2098
2168
|
children: [
|
|
2099
2169
|
label,
|
|
2100
|
-
selected.length > 0 ? /* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2170
|
+
selected.length > 0 ? /* @__PURE__ */ jsx16("span", { className: "cv-filter-count", children: selected.length }) : null,
|
|
2171
|
+
/* @__PURE__ */ jsx16(ChevronDown2, { size: 12, className: open ? "rotate-180 transition-transform" : "transition-transform", "aria-hidden": "true" })
|
|
2102
2172
|
]
|
|
2103
2173
|
}
|
|
2104
2174
|
),
|
|
2105
|
-
open ? /* @__PURE__ */
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2108
|
-
/* @__PURE__ */
|
|
2175
|
+
open ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2176
|
+
/* @__PURE__ */ jsx16("div", { className: "fixed inset-0 z-10", onClick: () => setOpen(false) }),
|
|
2177
|
+
/* @__PURE__ */ jsx16("div", { className: "cv-filter-menu", children: options.map((option) => /* @__PURE__ */ jsxs13("label", { className: "cv-filter-option", children: [
|
|
2178
|
+
/* @__PURE__ */ jsx16(
|
|
2109
2179
|
"input",
|
|
2110
2180
|
{
|
|
2111
2181
|
type: "checkbox",
|
|
@@ -2121,11 +2191,11 @@ function MultiSelectFilter({ label, options, selected, onChange, className }) {
|
|
|
2121
2191
|
}
|
|
2122
2192
|
function BulkActionBar({ selectedCount, selectedLabel, clearLabel, onClear, children }) {
|
|
2123
2193
|
if (selectedCount === 0) return null;
|
|
2124
|
-
return /* @__PURE__ */
|
|
2125
|
-
/* @__PURE__ */
|
|
2194
|
+
return /* @__PURE__ */ jsxs13("div", { className: "cv-bulk-bar", role: "toolbar", "aria-label": selectedLabel(selectedCount), children: [
|
|
2195
|
+
/* @__PURE__ */ jsx16("span", { className: "text-xs font-medium", children: selectedLabel(selectedCount) }),
|
|
2126
2196
|
children,
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2197
|
+
/* @__PURE__ */ jsxs13("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: [
|
|
2198
|
+
/* @__PURE__ */ jsx16(X2, { size: 12, "aria-hidden": "true" }),
|
|
2129
2199
|
clearLabel
|
|
2130
2200
|
] })
|
|
2131
2201
|
] });
|
|
@@ -2140,26 +2210,26 @@ function ListingPagination({
|
|
|
2140
2210
|
labels
|
|
2141
2211
|
}) {
|
|
2142
2212
|
const lastPage = Math.max(1, Math.ceil(total / perPage));
|
|
2143
|
-
return /* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2145
|
-
onPerPageChange && perPageOptions ? /* @__PURE__ */
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
/* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ jsxs13("div", { className: "cv-listing-pagination", children: [
|
|
2214
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400", children: [
|
|
2215
|
+
onPerPageChange && perPageOptions ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2216
|
+
/* @__PURE__ */ jsx16("span", { children: labels.show }),
|
|
2217
|
+
/* @__PURE__ */ jsx16(
|
|
2148
2218
|
"select",
|
|
2149
2219
|
{
|
|
2150
2220
|
value: perPage,
|
|
2151
2221
|
onChange: (event) => onPerPageChange(Number(event.target.value)),
|
|
2152
2222
|
"aria-label": labels.perPage,
|
|
2153
2223
|
className: "cv-listing-perpage",
|
|
2154
|
-
children: perPageOptions.map((option) => /* @__PURE__ */
|
|
2224
|
+
children: perPageOptions.map((option) => /* @__PURE__ */ jsx16("option", { value: option, children: option }, option))
|
|
2155
2225
|
}
|
|
2156
2226
|
),
|
|
2157
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ jsx16("span", { children: labels.perPage })
|
|
2158
2228
|
] }) : null,
|
|
2159
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ jsx16("span", { className: "ml-1", children: labels.total(total) })
|
|
2160
2230
|
] }),
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
/* @__PURE__ */
|
|
2231
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
2232
|
+
/* @__PURE__ */ jsx16(
|
|
2163
2233
|
"button",
|
|
2164
2234
|
{
|
|
2165
2235
|
"data-cv-tooltip": labels.previous,
|
|
@@ -2171,8 +2241,8 @@ function ListingPagination({
|
|
|
2171
2241
|
children: "\u2039"
|
|
2172
2242
|
}
|
|
2173
2243
|
),
|
|
2174
|
-
/* @__PURE__ */
|
|
2175
|
-
/* @__PURE__ */
|
|
2244
|
+
/* @__PURE__ */ jsx16("span", { className: "text-xs text-gray-500", children: labels.page(page, lastPage) }),
|
|
2245
|
+
/* @__PURE__ */ jsx16(
|
|
2176
2246
|
"button",
|
|
2177
2247
|
{
|
|
2178
2248
|
"data-cv-tooltip": labels.next,
|
|
@@ -2189,7 +2259,7 @@ function ListingPagination({
|
|
|
2189
2259
|
}
|
|
2190
2260
|
|
|
2191
2261
|
// src/hooks/useUrlFilterState.ts
|
|
2192
|
-
import { useCallback as
|
|
2262
|
+
import { useCallback as useCallback4, useEffect as useEffect6, useState as useState10 } from "react";
|
|
2193
2263
|
var LIST_SEPARATOR = ",";
|
|
2194
2264
|
function readParams() {
|
|
2195
2265
|
if (typeof window === "undefined") return new URLSearchParams();
|
|
@@ -2204,8 +2274,8 @@ function writeParam(key, value) {
|
|
|
2204
2274
|
window.history.replaceState(null, "", query ? `${window.location.pathname}?${query}` : window.location.pathname);
|
|
2205
2275
|
}
|
|
2206
2276
|
function useUrlStringState(key, initial, { enabled = true } = {}) {
|
|
2207
|
-
const [value, setValue] =
|
|
2208
|
-
const update =
|
|
2277
|
+
const [value, setValue] = useState10(() => enabled ? readParams().get(key) ?? initial : initial);
|
|
2278
|
+
const update = useCallback4(
|
|
2209
2279
|
(next) => {
|
|
2210
2280
|
setValue(next);
|
|
2211
2281
|
if (enabled) writeParam(key, next === initial ? void 0 : next);
|
|
@@ -2215,12 +2285,12 @@ function useUrlStringState(key, initial, { enabled = true } = {}) {
|
|
|
2215
2285
|
return [value, update];
|
|
2216
2286
|
}
|
|
2217
2287
|
function useUrlNumberState(key, initial, { enabled = true } = {}) {
|
|
2218
|
-
const [value, setValue] =
|
|
2288
|
+
const [value, setValue] = useState10(() => {
|
|
2219
2289
|
if (!enabled) return initial;
|
|
2220
2290
|
const raw = Number(readParams().get(key));
|
|
2221
2291
|
return Number.isFinite(raw) && raw > 0 ? raw : initial;
|
|
2222
2292
|
});
|
|
2223
|
-
const update =
|
|
2293
|
+
const update = useCallback4(
|
|
2224
2294
|
(next) => {
|
|
2225
2295
|
setValue(next);
|
|
2226
2296
|
if (enabled) writeParam(key, next === initial ? void 0 : String(next));
|
|
@@ -2230,12 +2300,12 @@ function useUrlNumberState(key, initial, { enabled = true } = {}) {
|
|
|
2230
2300
|
return [value, update];
|
|
2231
2301
|
}
|
|
2232
2302
|
function useUrlArrayState(key, { enabled = true } = {}) {
|
|
2233
|
-
const [value, setValue] =
|
|
2303
|
+
const [value, setValue] = useState10(() => {
|
|
2234
2304
|
if (!enabled) return [];
|
|
2235
2305
|
const raw = readParams().get(key);
|
|
2236
2306
|
return raw ? raw.split(LIST_SEPARATOR).filter(Boolean) : [];
|
|
2237
2307
|
});
|
|
2238
|
-
const update =
|
|
2308
|
+
const update = useCallback4(
|
|
2239
2309
|
(next) => {
|
|
2240
2310
|
setValue(next);
|
|
2241
2311
|
if (enabled) writeParam(key, next.length > 0 ? next.join(LIST_SEPARATOR) : void 0);
|
|
@@ -2245,7 +2315,7 @@ function useUrlArrayState(key, { enabled = true } = {}) {
|
|
|
2245
2315
|
return [value, update];
|
|
2246
2316
|
}
|
|
2247
2317
|
function useDebouncedValue(value, delayMs = 300) {
|
|
2248
|
-
const [debounced, setDebounced] =
|
|
2318
|
+
const [debounced, setDebounced] = useState10(value);
|
|
2249
2319
|
useEffect6(() => {
|
|
2250
2320
|
const timer = setTimeout(() => setDebounced(value), delayMs);
|
|
2251
2321
|
return () => clearTimeout(timer);
|
|
@@ -2299,7 +2369,7 @@ var DEFAULT_DOCUMENTS_WORKSPACE_LABELS = {
|
|
|
2299
2369
|
};
|
|
2300
2370
|
|
|
2301
2371
|
// src/documents/DocumentsWorkspace.tsx
|
|
2302
|
-
import { Fragment as Fragment5, jsx as
|
|
2372
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2303
2373
|
var DEFAULT_PER_PAGE = 20;
|
|
2304
2374
|
var DEFAULT_PER_PAGE_OPTIONS = [10, 20, 50, 100];
|
|
2305
2375
|
var DEFAULT_SORT_FIELD = "linkedAt";
|
|
@@ -2328,16 +2398,16 @@ function DocumentsWorkspace({
|
|
|
2328
2398
|
const [sortDirection, setSortDirection] = useUrlStringState("sortDirection", "desc", urlOptions);
|
|
2329
2399
|
const [page, setPage] = useUrlNumberState("page", 1, urlOptions);
|
|
2330
2400
|
const [perPage, setPerPage] = useUrlNumberState("limit", initialPerPage, urlOptions);
|
|
2331
|
-
const [extra, setExtra] =
|
|
2332
|
-
const [documents, setDocuments] =
|
|
2333
|
-
const [total, setTotal] =
|
|
2334
|
-
const [loading, setLoading] =
|
|
2335
|
-
const [failed, setFailed] =
|
|
2336
|
-
const [selectedIds, setSelectedIds] =
|
|
2337
|
-
const [reloadToken, setReloadToken] =
|
|
2338
|
-
const [busy, setBusy] =
|
|
2339
|
-
const [uploading, setUploading] =
|
|
2340
|
-
const [uploadFailed, setUploadFailed] =
|
|
2401
|
+
const [extra, setExtra] = useState11({});
|
|
2402
|
+
const [documents, setDocuments] = useState11([]);
|
|
2403
|
+
const [total, setTotal] = useState11(0);
|
|
2404
|
+
const [loading, setLoading] = useState11(false);
|
|
2405
|
+
const [failed, setFailed] = useState11(false);
|
|
2406
|
+
const [selectedIds, setSelectedIds] = useState11(/* @__PURE__ */ new Set());
|
|
2407
|
+
const [reloadToken, setReloadToken] = useState11(0);
|
|
2408
|
+
const [busy, setBusy] = useState11(false);
|
|
2409
|
+
const [uploading, setUploading] = useState11(false);
|
|
2410
|
+
const [uploadFailed, setUploadFailed] = useState11(false);
|
|
2341
2411
|
const fileInputRef = useRef5(null);
|
|
2342
2412
|
const debouncedSearch = useDebouncedValue(search);
|
|
2343
2413
|
const fetchAll = context?.api.getAllDocuments;
|
|
@@ -2459,14 +2529,14 @@ function DocumentsWorkspace({
|
|
|
2459
2529
|
if (!fetchAll) return null;
|
|
2460
2530
|
const direction = sortDirection === "asc" ? "asc" : "desc";
|
|
2461
2531
|
const canSelect = Boolean(removeDocument ?? downloadArchive);
|
|
2462
|
-
return /* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
/* @__PURE__ */
|
|
2532
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn("space-y-4", classNames?.root, className), children: [
|
|
2533
|
+
/* @__PURE__ */ jsx17(TooltipLayer, {}),
|
|
2534
|
+
/* @__PURE__ */ jsxs14("header", { className: cn("space-y-0.5", classNames?.header), children: [
|
|
2535
|
+
/* @__PURE__ */ jsx17("h2", { className: "text-lg font-semibold", children: labels.title }),
|
|
2536
|
+
/* @__PURE__ */ jsx17("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: labels.subtitle(total) })
|
|
2467
2537
|
] }),
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
/* @__PURE__ */
|
|
2538
|
+
/* @__PURE__ */ jsxs14("div", { className: cn("flex flex-wrap items-center gap-2", classNames?.filters), children: [
|
|
2539
|
+
/* @__PURE__ */ jsx17(
|
|
2470
2540
|
"input",
|
|
2471
2541
|
{
|
|
2472
2542
|
type: "search",
|
|
@@ -2477,8 +2547,8 @@ function DocumentsWorkspace({
|
|
|
2477
2547
|
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"
|
|
2478
2548
|
}
|
|
2479
2549
|
),
|
|
2480
|
-
/* @__PURE__ */
|
|
2481
|
-
categoryOptions.length > 0 ? /* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ jsx17(MultiSelectFilter, { label: labels.sourceFilter, options: sourceOptions, selected: source, onChange: setSource }),
|
|
2551
|
+
categoryOptions.length > 0 ? /* @__PURE__ */ jsx17(
|
|
2482
2552
|
MultiSelectFilter,
|
|
2483
2553
|
{
|
|
2484
2554
|
label: labels.categoryFilter,
|
|
@@ -2487,8 +2557,8 @@ function DocumentsWorkspace({
|
|
|
2487
2557
|
onChange: setCategory
|
|
2488
2558
|
}
|
|
2489
2559
|
) : null,
|
|
2490
|
-
dateFilter ? /* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2560
|
+
dateFilter ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
2561
|
+
/* @__PURE__ */ jsx17(
|
|
2492
2562
|
"input",
|
|
2493
2563
|
{
|
|
2494
2564
|
type: "date",
|
|
@@ -2498,7 +2568,7 @@ function DocumentsWorkspace({
|
|
|
2498
2568
|
className: "rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
|
|
2499
2569
|
}
|
|
2500
2570
|
),
|
|
2501
|
-
/* @__PURE__ */
|
|
2571
|
+
/* @__PURE__ */ jsx17(
|
|
2502
2572
|
"input",
|
|
2503
2573
|
{
|
|
2504
2574
|
type: "date",
|
|
@@ -2510,12 +2580,12 @@ function DocumentsWorkspace({
|
|
|
2510
2580
|
)
|
|
2511
2581
|
] }) : null,
|
|
2512
2582
|
renderFilters?.({ extra, setExtra }),
|
|
2513
|
-
hasFilters ? /* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2583
|
+
hasFilters ? /* @__PURE__ */ jsxs14("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: [
|
|
2584
|
+
/* @__PURE__ */ jsx17(X3, { size: 12, "aria-hidden": "true" }),
|
|
2515
2585
|
labels.clearFilters
|
|
2516
2586
|
] }) : null,
|
|
2517
|
-
uploadDocument ? /* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2587
|
+
uploadDocument ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
2588
|
+
/* @__PURE__ */ jsx17(
|
|
2519
2589
|
"input",
|
|
2520
2590
|
{
|
|
2521
2591
|
ref: fileInputRef,
|
|
@@ -2528,7 +2598,7 @@ function DocumentsWorkspace({
|
|
|
2528
2598
|
}
|
|
2529
2599
|
}
|
|
2530
2600
|
),
|
|
2531
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsxs14(
|
|
2532
2602
|
"button",
|
|
2533
2603
|
{
|
|
2534
2604
|
"data-cv-tooltip": labels.upload,
|
|
@@ -2538,15 +2608,15 @@ function DocumentsWorkspace({
|
|
|
2538
2608
|
disabled: uploading,
|
|
2539
2609
|
className: "cv-header-action ml-auto inline-flex items-center gap-1 disabled:opacity-40",
|
|
2540
2610
|
children: [
|
|
2541
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ jsx17(Upload, { size: 12, "aria-hidden": "true" }),
|
|
2542
2612
|
labels.upload
|
|
2543
2613
|
]
|
|
2544
2614
|
}
|
|
2545
2615
|
)
|
|
2546
2616
|
] }) : null
|
|
2547
2617
|
] }),
|
|
2548
|
-
uploadFailed ? /* @__PURE__ */
|
|
2549
|
-
canSelect ? /* @__PURE__ */
|
|
2618
|
+
uploadFailed ? /* @__PURE__ */ jsx17("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.uploadError }) : null,
|
|
2619
|
+
canSelect ? /* @__PURE__ */ jsxs14(
|
|
2550
2620
|
BulkActionBar,
|
|
2551
2621
|
{
|
|
2552
2622
|
selectedCount: selectedIds.size,
|
|
@@ -2554,7 +2624,7 @@ function DocumentsWorkspace({
|
|
|
2554
2624
|
clearLabel: labels.bulkClear,
|
|
2555
2625
|
onClear: () => setSelectedIds(/* @__PURE__ */ new Set()),
|
|
2556
2626
|
children: [
|
|
2557
|
-
downloadArchive ? /* @__PURE__ */
|
|
2627
|
+
downloadArchive ? /* @__PURE__ */ jsxs14(
|
|
2558
2628
|
"button",
|
|
2559
2629
|
{
|
|
2560
2630
|
"data-cv-tooltip": labels.bulkDownloadZip,
|
|
@@ -2564,12 +2634,12 @@ function DocumentsWorkspace({
|
|
|
2564
2634
|
disabled: busy,
|
|
2565
2635
|
className: "cv-header-action inline-flex items-center gap-1 disabled:opacity-40",
|
|
2566
2636
|
children: [
|
|
2567
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ jsx17(Download2, { size: 12, "aria-hidden": "true" }),
|
|
2568
2638
|
labels.bulkDownloadZip
|
|
2569
2639
|
]
|
|
2570
2640
|
}
|
|
2571
2641
|
) : null,
|
|
2572
|
-
removeDocument ? /* @__PURE__ */
|
|
2642
|
+
removeDocument ? /* @__PURE__ */ jsxs14(
|
|
2573
2643
|
"button",
|
|
2574
2644
|
{
|
|
2575
2645
|
"data-cv-tooltip": labels.bulkRemove(selectedIds.size),
|
|
@@ -2581,7 +2651,7 @@ function DocumentsWorkspace({
|
|
|
2581
2651
|
disabled: busy,
|
|
2582
2652
|
className: "cv-header-action cv-header-action--danger inline-flex items-center gap-1 disabled:opacity-40",
|
|
2583
2653
|
children: [
|
|
2584
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ jsx17(Trash2, { size: 12, "aria-hidden": "true" }),
|
|
2585
2655
|
labels.bulkRemove(selectedIds.size)
|
|
2586
2656
|
]
|
|
2587
2657
|
}
|
|
@@ -2589,12 +2659,12 @@ function DocumentsWorkspace({
|
|
|
2589
2659
|
]
|
|
2590
2660
|
}
|
|
2591
2661
|
) : null,
|
|
2592
|
-
loading ? /* @__PURE__ */
|
|
2593
|
-
failed ? /* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
canSelect ? /* @__PURE__ */
|
|
2662
|
+
loading ? /* @__PURE__ */ jsx17("p", { className: cn("text-sm text-gray-500", classNames?.status), children: labels.loading }) : null,
|
|
2663
|
+
failed ? /* @__PURE__ */ jsx17("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.failure }) : null,
|
|
2664
|
+
/* @__PURE__ */ jsxs14("div", { className: cn("cv-table-card", classNames?.table), children: [
|
|
2665
|
+
/* @__PURE__ */ jsxs14("table", { className: "cv-table", children: [
|
|
2666
|
+
/* @__PURE__ */ jsx17("thead", { children: /* @__PURE__ */ jsxs14("tr", { children: [
|
|
2667
|
+
canSelect ? /* @__PURE__ */ jsx17("th", { scope: "col", className: "w-10 px-3 py-2", children: /* @__PURE__ */ jsx17(
|
|
2598
2668
|
"input",
|
|
2599
2669
|
{
|
|
2600
2670
|
type: "checkbox",
|
|
@@ -2604,16 +2674,16 @@ function DocumentsWorkspace({
|
|
|
2604
2674
|
className: "cursor-pointer rounded border-gray-300 text-blue-600 dark:border-gray-600"
|
|
2605
2675
|
}
|
|
2606
2676
|
) }) : null,
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2612
|
-
/* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsx17(SortableHead, { label: labels.columnFilename, field: "filename", activeField: sortField, direction, onSort: toggleSort }),
|
|
2678
|
+
/* @__PURE__ */ jsx17(SortableHead, { label: labels.columnContact, field: "conversationId", activeField: sortField, direction, onSort: toggleSort, className: "hidden sm:table-cell" }),
|
|
2679
|
+
/* @__PURE__ */ jsx17(SortableHead, { label: labels.columnType, field: "mimeType", activeField: sortField, direction, onSort: toggleSort, className: "hidden md:table-cell" }),
|
|
2680
|
+
/* @__PURE__ */ jsx17(SortableHead, { label: labels.columnSize, field: "sizeBytes", activeField: sortField, direction, onSort: toggleSort, className: "hidden lg:table-cell" }),
|
|
2681
|
+
/* @__PURE__ */ jsx17(SortableHead, { label: labels.columnSource, field: "source", activeField: sortField, direction, onSort: toggleSort, className: "hidden lg:table-cell" }),
|
|
2682
|
+
/* @__PURE__ */ jsx17(SortableHead, { label: labels.columnDate, field: "linkedAt", activeField: sortField, direction, onSort: toggleSort, className: "hidden xl:table-cell" }),
|
|
2683
|
+
/* @__PURE__ */ jsx17("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: labels.columnActions })
|
|
2614
2684
|
] }) }),
|
|
2615
|
-
/* @__PURE__ */
|
|
2616
|
-
canSelect ? /* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ jsx17("tbody", { children: documents.map((document2) => /* @__PURE__ */ jsxs14("tr", { className: classNames?.row, children: [
|
|
2686
|
+
canSelect ? /* @__PURE__ */ jsx17("td", { className: "w-10 px-3 py-2", children: /* @__PURE__ */ jsx17(
|
|
2617
2687
|
"input",
|
|
2618
2688
|
{
|
|
2619
2689
|
type: "checkbox",
|
|
@@ -2623,11 +2693,11 @@ function DocumentsWorkspace({
|
|
|
2623
2693
|
className: "cursor-pointer rounded border-gray-300 text-blue-600 dark:border-gray-600"
|
|
2624
2694
|
}
|
|
2625
2695
|
) }) : null,
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
/* @__PURE__ */
|
|
2628
|
-
/* @__PURE__ */
|
|
2696
|
+
/* @__PURE__ */ jsx17("td", { className: "max-w-xs px-3 py-2", children: /* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2697
|
+
/* @__PURE__ */ jsx17(FileIcon, { filename: document2.filename, mimeType: document2.mimeType }),
|
|
2698
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", "data-cv-tooltip": document2.filename, children: document2.filename })
|
|
2629
2699
|
] }) }),
|
|
2630
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsx17("td", { className: "hidden px-3 py-2 sm:table-cell", children: onOpenConversation ? /* @__PURE__ */ jsxs14(
|
|
2631
2701
|
"button",
|
|
2632
2702
|
{
|
|
2633
2703
|
type: "button",
|
|
@@ -2636,17 +2706,17 @@ function DocumentsWorkspace({
|
|
|
2636
2706
|
"aria-label": labels.openConversation,
|
|
2637
2707
|
className: "cv-header-action inline-flex items-center gap-1",
|
|
2638
2708
|
children: [
|
|
2639
|
-
/* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsx17(MessageSquare, { size: 12, "aria-hidden": "true" }),
|
|
2640
2710
|
document2.contactName ?? formatPhone(document2.conversationId)
|
|
2641
2711
|
]
|
|
2642
2712
|
}
|
|
2643
|
-
) : /* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2649
|
-
/* @__PURE__ */
|
|
2713
|
+
) : /* @__PURE__ */ jsx17("span", { className: "text-xs text-gray-500", children: document2.contactName ?? formatPhone(document2.conversationId) }) }),
|
|
2714
|
+
/* @__PURE__ */ jsx17("td", { className: "hidden px-3 py-2 md:table-cell", "data-cv-tooltip": document2.mimeType, children: /* @__PURE__ */ jsx17("span", { className: "cv-type-tag", children: documentTypeLabel(document2.filename, document2.mimeType) }) }),
|
|
2715
|
+
/* @__PURE__ */ jsx17("td", { className: "hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell", children: formatFileSize(document2.sizeBytes) }),
|
|
2716
|
+
/* @__PURE__ */ jsx17("td", { className: "hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell", children: labels.sourceLabels[document2.source] ?? document2.source }),
|
|
2717
|
+
/* @__PURE__ */ jsx17("td", { className: "hidden whitespace-nowrap px-3 py-2 text-xs xl:table-cell", children: formatDateTime(document2.linkedAt) }),
|
|
2718
|
+
/* @__PURE__ */ jsx17("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
|
|
2719
|
+
/* @__PURE__ */ jsx17(
|
|
2650
2720
|
"button",
|
|
2651
2721
|
{
|
|
2652
2722
|
type: "button",
|
|
@@ -2654,10 +2724,10 @@ function DocumentsWorkspace({
|
|
|
2654
2724
|
"data-cv-tooltip": labels.view,
|
|
2655
2725
|
"aria-label": `${labels.view}: ${document2.filename}`,
|
|
2656
2726
|
className: "cv-header-icon",
|
|
2657
|
-
children: /* @__PURE__ */
|
|
2727
|
+
children: /* @__PURE__ */ jsx17(Eye, { size: 14 })
|
|
2658
2728
|
}
|
|
2659
2729
|
),
|
|
2660
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsx17(
|
|
2661
2731
|
"button",
|
|
2662
2732
|
{
|
|
2663
2733
|
type: "button",
|
|
@@ -2665,10 +2735,10 @@ function DocumentsWorkspace({
|
|
|
2665
2735
|
"data-cv-tooltip": labels.download,
|
|
2666
2736
|
"aria-label": `${labels.download}: ${document2.filename}`,
|
|
2667
2737
|
className: "cv-header-icon",
|
|
2668
|
-
children: /* @__PURE__ */
|
|
2738
|
+
children: /* @__PURE__ */ jsx17(Download2, { size: 14 })
|
|
2669
2739
|
}
|
|
2670
2740
|
),
|
|
2671
|
-
removeDocument ? /* @__PURE__ */
|
|
2741
|
+
removeDocument ? /* @__PURE__ */ jsx17(
|
|
2672
2742
|
"button",
|
|
2673
2743
|
{
|
|
2674
2744
|
type: "button",
|
|
@@ -2679,15 +2749,15 @@ function DocumentsWorkspace({
|
|
|
2679
2749
|
"data-cv-tooltip": labels.remove,
|
|
2680
2750
|
"aria-label": `${labels.remove}: ${document2.filename}`,
|
|
2681
2751
|
className: "cv-header-icon disabled:opacity-40",
|
|
2682
|
-
children: /* @__PURE__ */
|
|
2752
|
+
children: /* @__PURE__ */ jsx17(Trash2, { size: 14, className: "text-red-500" })
|
|
2683
2753
|
}
|
|
2684
2754
|
) : null
|
|
2685
2755
|
] }) })
|
|
2686
2756
|
] }, `${document2.conversationId}:${document2.id}`)) })
|
|
2687
2757
|
] }),
|
|
2688
|
-
!loading && documents.length === 0 ? /* @__PURE__ */
|
|
2758
|
+
!loading && documents.length === 0 ? /* @__PURE__ */ jsx17("p", { className: cn("py-8 text-center text-sm text-gray-400", classNames?.status), children: hasFilters ? labels.noResults : labels.empty }) : null
|
|
2689
2759
|
] }),
|
|
2690
|
-
/* @__PURE__ */
|
|
2760
|
+
/* @__PURE__ */ jsx17(
|
|
2691
2761
|
ListingPagination,
|
|
2692
2762
|
{
|
|
2693
2763
|
page,
|
|
@@ -2754,7 +2824,7 @@ function downloadTextFile(filename, content) {
|
|
|
2754
2824
|
|
|
2755
2825
|
// src/DarkModeToggle.tsx
|
|
2756
2826
|
import { Moon, Sun } from "lucide-react";
|
|
2757
|
-
import { jsx as
|
|
2827
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2758
2828
|
var DEFAULT_DARK_MODE_TOGGLE_LABELS = {
|
|
2759
2829
|
toDark: "Tema escuro",
|
|
2760
2830
|
toLight: "Tema claro"
|
|
@@ -2769,7 +2839,7 @@ function DarkModeToggle({
|
|
|
2769
2839
|
}) {
|
|
2770
2840
|
const label = isDark ? labels?.toLight ?? DEFAULT_DARK_MODE_TOGGLE_LABELS.toLight : labels?.toDark ?? DEFAULT_DARK_MODE_TOGGLE_LABELS.toDark;
|
|
2771
2841
|
const Icon = isDark ? Sun : Moon;
|
|
2772
|
-
return /* @__PURE__ */
|
|
2842
|
+
return /* @__PURE__ */ jsxs15(
|
|
2773
2843
|
"button",
|
|
2774
2844
|
{
|
|
2775
2845
|
type: "button",
|
|
@@ -2784,7 +2854,7 @@ function DarkModeToggle({
|
|
|
2784
2854
|
className
|
|
2785
2855
|
),
|
|
2786
2856
|
children: [
|
|
2787
|
-
/* @__PURE__ */
|
|
2857
|
+
/* @__PURE__ */ jsx18(
|
|
2788
2858
|
Icon,
|
|
2789
2859
|
{
|
|
2790
2860
|
"aria-hidden": "true",
|
|
@@ -2792,14 +2862,14 @@ function DarkModeToggle({
|
|
|
2792
2862
|
size: classNames?.icon ? void 0 : ICON_SIZE_ACTION
|
|
2793
2863
|
}
|
|
2794
2864
|
),
|
|
2795
|
-
showLabel ? /* @__PURE__ */
|
|
2865
|
+
showLabel ? /* @__PURE__ */ jsx18("span", { className: classNames?.label, children: label }) : null
|
|
2796
2866
|
]
|
|
2797
2867
|
}
|
|
2798
2868
|
);
|
|
2799
2869
|
}
|
|
2800
2870
|
|
|
2801
2871
|
// src/useWaitingNotifications.ts
|
|
2802
|
-
import { useState as
|
|
2872
|
+
import { useState as useState12, useEffect as useEffect8, useRef as useRef6, useCallback as useCallback5 } from "react";
|
|
2803
2873
|
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
2804
2874
|
var DEFAULT_LIMIT = 50;
|
|
2805
2875
|
var DEFAULT_LABELS = {
|
|
@@ -2808,7 +2878,7 @@ var DEFAULT_LABELS = {
|
|
|
2808
2878
|
};
|
|
2809
2879
|
function useWaitingNotifications(params) {
|
|
2810
2880
|
const conversationsContext = useConversations();
|
|
2811
|
-
const [conversations, setConversations] =
|
|
2881
|
+
const [conversations, setConversations] = useState12([]);
|
|
2812
2882
|
const previousUnreadMap = useRef6(/* @__PURE__ */ new Map());
|
|
2813
2883
|
const notifiedIds = useRef6(/* @__PURE__ */ new Set());
|
|
2814
2884
|
const isPollingRef = useRef6(false);
|
|
@@ -2818,7 +2888,7 @@ function useWaitingNotifications(params) {
|
|
|
2818
2888
|
const listParams = params?.params;
|
|
2819
2889
|
const labelTitle = params?.labels?.title ?? DEFAULT_LABELS.title;
|
|
2820
2890
|
const labelBody = params?.labels?.body ?? DEFAULT_LABELS.body;
|
|
2821
|
-
const refresh =
|
|
2891
|
+
const refresh = useCallback5(async () => {
|
|
2822
2892
|
if (!conversationsContext || isPollingRef.current) return;
|
|
2823
2893
|
isPollingRef.current = true;
|
|
2824
2894
|
try {
|
|
@@ -2858,7 +2928,7 @@ function useWaitingNotifications(params) {
|
|
|
2858
2928
|
|
|
2859
2929
|
// src/settings/WhatsAppTemplateSettingsForm.tsx
|
|
2860
2930
|
import { Plus, RefreshCw, Save, Trash2 as Trash22 } from "lucide-react";
|
|
2861
|
-
import { jsx as
|
|
2931
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2862
2932
|
var DEFAULT_LABELS2 = {
|
|
2863
2933
|
sectionTitle: "WhatsApp",
|
|
2864
2934
|
sectionDescription: "Template usado para reabrir a janela de 24h com o cliente.",
|
|
@@ -2917,16 +2987,16 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2917
2987
|
}
|
|
2918
2988
|
onVariablesChange([...variables, token]);
|
|
2919
2989
|
}
|
|
2920
|
-
return /* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
/* @__PURE__ */
|
|
2990
|
+
return /* @__PURE__ */ jsxs16("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
2991
|
+
/* @__PURE__ */ jsxs16("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
2992
|
+
/* @__PURE__ */ jsx19("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }),
|
|
2993
|
+
/* @__PURE__ */ jsx19("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
2924
2994
|
] }),
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
2927
|
-
/* @__PURE__ */
|
|
2928
|
-
/* @__PURE__ */
|
|
2929
|
-
/* @__PURE__ */
|
|
2995
|
+
/* @__PURE__ */ jsxs16("form", { onSubmit: onSave, className: "p-6 space-y-4", children: [
|
|
2996
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
2997
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
2998
|
+
/* @__PURE__ */ jsx19("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.templateLabel }),
|
|
2999
|
+
/* @__PURE__ */ jsxs16(
|
|
2930
3000
|
"button",
|
|
2931
3001
|
{
|
|
2932
3002
|
"data-cv-tooltip": labels.refreshList,
|
|
@@ -2936,31 +3006,31 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2936
3006
|
disabled: loadingTemplates,
|
|
2937
3007
|
className: "flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",
|
|
2938
3008
|
children: [
|
|
2939
|
-
/* @__PURE__ */
|
|
3009
|
+
/* @__PURE__ */ jsx19(RefreshCw, { size: 11, className: loadingTemplates ? "animate-spin" : "" }),
|
|
2940
3010
|
labels.refreshList
|
|
2941
3011
|
]
|
|
2942
3012
|
}
|
|
2943
3013
|
)
|
|
2944
3014
|
] }),
|
|
2945
|
-
templatesError && /* @__PURE__ */
|
|
3015
|
+
templatesError && /* @__PURE__ */ jsxs16("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: [
|
|
2946
3016
|
labels.errorLoading,
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
/* @__PURE__ */
|
|
3017
|
+
/* @__PURE__ */ jsx19("br", {}),
|
|
3018
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-gray-500 dark:text-gray-400 mt-0.5 block", children: [
|
|
2949
3019
|
labels.currentNameSaved,
|
|
2950
3020
|
" ",
|
|
2951
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsx19("strong", { children: selectedTemplateName || "\u2014" })
|
|
2952
3022
|
] })
|
|
2953
3023
|
] }),
|
|
2954
|
-
loadingTemplates && /* @__PURE__ */
|
|
2955
|
-
!loadingTemplates && !templatesError && /* @__PURE__ */
|
|
3024
|
+
loadingTemplates && /* @__PURE__ */ jsx19("div", { className: "h-10 rounded-xl bg-gray-100 dark:bg-gray-700 animate-pulse" }),
|
|
3025
|
+
!loadingTemplates && !templatesError && /* @__PURE__ */ jsxs16(
|
|
2956
3026
|
"select",
|
|
2957
3027
|
{
|
|
2958
3028
|
value: selectedTemplateName,
|
|
2959
3029
|
onChange: (e) => handleSelect(e.target.value),
|
|
2960
3030
|
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",
|
|
2961
3031
|
children: [
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
templates.map((template) => /* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx19("option", { value: "", children: labels.selectPlaceholder }),
|
|
3033
|
+
templates.map((template) => /* @__PURE__ */ jsxs16("option", { value: template.name, disabled: template.status !== "APPROVED", children: [
|
|
2964
3034
|
template.displayName,
|
|
2965
3035
|
" \xB7 ",
|
|
2966
3036
|
template.shortId,
|
|
@@ -2972,12 +3042,12 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2972
3042
|
]
|
|
2973
3043
|
}
|
|
2974
3044
|
),
|
|
2975
|
-
selected?.bodyText && /* @__PURE__ */
|
|
3045
|
+
selected?.bodyText && /* @__PURE__ */ jsx19("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 })
|
|
2976
3046
|
] }),
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
3047
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3048
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
3049
|
+
/* @__PURE__ */ jsx19("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.variablesLabel }),
|
|
3050
|
+
/* @__PURE__ */ jsxs16(
|
|
2981
3051
|
"button",
|
|
2982
3052
|
{
|
|
2983
3053
|
"data-cv-tooltip": labels.addVariable,
|
|
@@ -2986,15 +3056,15 @@ function WhatsAppTemplateSettingsForm({
|
|
|
2986
3056
|
onClick: () => onVariablesChange([...variables, ""]),
|
|
2987
3057
|
className: "flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline",
|
|
2988
3058
|
children: [
|
|
2989
|
-
/* @__PURE__ */
|
|
3059
|
+
/* @__PURE__ */ jsx19(Plus, { size: 12 }),
|
|
2990
3060
|
labels.addVariable
|
|
2991
3061
|
]
|
|
2992
3062
|
}
|
|
2993
3063
|
)
|
|
2994
3064
|
] }),
|
|
2995
|
-
availableVariables.length > 0 && /* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
3065
|
+
availableVariables.length > 0 && /* @__PURE__ */ jsxs16("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: [
|
|
3066
|
+
/* @__PURE__ */ jsx19("p", { className: "text-xs font-medium text-gray-600 dark:text-gray-300 mb-1.5", children: labels.variablesAvailableTitle }),
|
|
3067
|
+
/* @__PURE__ */ jsx19("div", { className: "flex flex-wrap gap-1.5", children: availableVariables.map((available) => /* @__PURE__ */ jsxs16(
|
|
2998
3068
|
"button",
|
|
2999
3069
|
{
|
|
3000
3070
|
type: "button",
|
|
@@ -3003,8 +3073,8 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3003
3073
|
"aria-label": `Inserir ${available.token}`,
|
|
3004
3074
|
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",
|
|
3005
3075
|
children: [
|
|
3006
|
-
/* @__PURE__ */
|
|
3007
|
-
/* @__PURE__ */
|
|
3076
|
+
/* @__PURE__ */ jsx19("code", { className: "text-blue-600 dark:text-blue-300", children: available.token }),
|
|
3077
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-gray-400 dark:text-gray-500", children: [
|
|
3008
3078
|
"\xB7 ",
|
|
3009
3079
|
available.label
|
|
3010
3080
|
] })
|
|
@@ -3012,13 +3082,13 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3012
3082
|
},
|
|
3013
3083
|
available.token
|
|
3014
3084
|
)) }),
|
|
3015
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx19("p", { className: "mt-1.5 text-[11px] text-gray-400 dark:text-gray-500", children: labels.variablesAvailableHint })
|
|
3016
3086
|
] }),
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
variables.length === 0 && /* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
3021
|
-
/* @__PURE__ */
|
|
3087
|
+
/* @__PURE__ */ jsx19("p", { className: "text-xs text-gray-400 dark:text-gray-500 mb-2", children: labels.variablesMappingHint }),
|
|
3088
|
+
variables.length === 0 && /* @__PURE__ */ jsx19("p", { className: "text-xs text-gray-400 dark:text-gray-500 italic", children: labels.noVariables }),
|
|
3089
|
+
/* @__PURE__ */ jsx19("div", { className: "space-y-2", children: variables.map((variable, index) => /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
3090
|
+
/* @__PURE__ */ jsx19("span", { className: "text-xs text-gray-400 dark:text-gray-500 w-6 text-right flex-shrink-0", children: `{{${index + 1}}}` }),
|
|
3091
|
+
/* @__PURE__ */ jsx19(
|
|
3022
3092
|
"input",
|
|
3023
3093
|
{
|
|
3024
3094
|
type: "text",
|
|
@@ -3028,7 +3098,7 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3028
3098
|
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"
|
|
3029
3099
|
}
|
|
3030
3100
|
),
|
|
3031
|
-
/* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsx19(
|
|
3032
3102
|
"button",
|
|
3033
3103
|
{
|
|
3034
3104
|
type: "button",
|
|
@@ -3036,13 +3106,13 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3036
3106
|
className: "text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors flex-shrink-0",
|
|
3037
3107
|
"data-cv-tooltip": labels.removeVariable,
|
|
3038
3108
|
"aria-label": labels.removeVariable,
|
|
3039
|
-
children: /* @__PURE__ */
|
|
3109
|
+
children: /* @__PURE__ */ jsx19(Trash22, { size: 14 })
|
|
3040
3110
|
}
|
|
3041
3111
|
)
|
|
3042
3112
|
] }, index)) })
|
|
3043
3113
|
] }),
|
|
3044
|
-
saveSuccess && /* @__PURE__ */
|
|
3045
|
-
/* @__PURE__ */
|
|
3114
|
+
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 }),
|
|
3115
|
+
/* @__PURE__ */ jsx19("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs16(
|
|
3046
3116
|
"button",
|
|
3047
3117
|
{
|
|
3048
3118
|
"data-cv-tooltip": saving ? labels.saving : labels.save,
|
|
@@ -3051,7 +3121,7 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3051
3121
|
disabled: saving || !selectedTemplateName.trim(),
|
|
3052
3122
|
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",
|
|
3053
3123
|
children: [
|
|
3054
|
-
saving ? /* @__PURE__ */
|
|
3124
|
+
saving ? /* @__PURE__ */ jsx19("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx19(Save, { size: 14 }),
|
|
3055
3125
|
saving ? labels.saving : labels.save
|
|
3056
3126
|
]
|
|
3057
3127
|
}
|
|
@@ -3062,7 +3132,7 @@ function WhatsAppTemplateSettingsForm({
|
|
|
3062
3132
|
|
|
3063
3133
|
// src/settings/WhatsAppCreateTemplateForm.tsx
|
|
3064
3134
|
import { SendHorizonal as SendHorizonal2 } from "lucide-react";
|
|
3065
|
-
import { jsx as
|
|
3135
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3066
3136
|
var DEFAULT_LABELS3 = {
|
|
3067
3137
|
sectionTitle: "Criar novo template",
|
|
3068
3138
|
sectionDescription: "Envia um template para aprova\xE7\xE3o da Meta.",
|
|
@@ -3119,16 +3189,16 @@ function WhatsAppCreateTemplateForm({
|
|
|
3119
3189
|
function set(key, next) {
|
|
3120
3190
|
onChange({ ...value, [key]: next });
|
|
3121
3191
|
}
|
|
3122
|
-
return /* @__PURE__ */
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
3192
|
+
return /* @__PURE__ */ jsxs17("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3193
|
+
/* @__PURE__ */ jsxs17("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
3194
|
+
/* @__PURE__ */ jsx20("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }),
|
|
3195
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
3126
3196
|
] }),
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3130
|
-
/* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsxs17("form", { onSubmit, className: "p-6 space-y-4", children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3199
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.nameLabel }),
|
|
3200
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.nameHint }),
|
|
3201
|
+
/* @__PURE__ */ jsx20(
|
|
3132
3202
|
"input",
|
|
3133
3203
|
{
|
|
3134
3204
|
type: "text",
|
|
@@ -3140,56 +3210,56 @@ function WhatsAppCreateTemplateForm({
|
|
|
3140
3210
|
}
|
|
3141
3211
|
)
|
|
3142
3212
|
] }),
|
|
3143
|
-
/* @__PURE__ */
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
/* @__PURE__ */
|
|
3213
|
+
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
3214
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3215
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.categoryLabel }),
|
|
3216
|
+
/* @__PURE__ */ jsxs17(
|
|
3147
3217
|
"select",
|
|
3148
3218
|
{
|
|
3149
3219
|
value: value.category,
|
|
3150
3220
|
onChange: (e) => set("category", e.target.value),
|
|
3151
3221
|
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",
|
|
3152
3222
|
children: [
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3223
|
+
/* @__PURE__ */ jsx20("option", { value: "UTILITY", children: "UTILITY (Transacional)" }),
|
|
3224
|
+
/* @__PURE__ */ jsx20("option", { value: "MARKETING", children: "MARKETING (Promocional)" })
|
|
3155
3225
|
]
|
|
3156
3226
|
}
|
|
3157
3227
|
)
|
|
3158
3228
|
] }),
|
|
3159
|
-
/* @__PURE__ */
|
|
3160
|
-
/* @__PURE__ */
|
|
3161
|
-
/* @__PURE__ */
|
|
3229
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3230
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.languageLabel }),
|
|
3231
|
+
/* @__PURE__ */ jsxs17(
|
|
3162
3232
|
"select",
|
|
3163
3233
|
{
|
|
3164
3234
|
value: value.language,
|
|
3165
3235
|
onChange: (e) => set("language", e.target.value),
|
|
3166
3236
|
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",
|
|
3167
3237
|
children: [
|
|
3168
|
-
/* @__PURE__ */
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3238
|
+
/* @__PURE__ */ jsx20("option", { value: "pt_BR", children: "Portugu\xEAs (Brasil)" }),
|
|
3239
|
+
/* @__PURE__ */ jsx20("option", { value: "en_US", children: "Ingl\xEAs (EUA)" }),
|
|
3240
|
+
/* @__PURE__ */ jsx20("option", { value: "es_ES", children: "Espanhol" })
|
|
3171
3241
|
]
|
|
3172
3242
|
}
|
|
3173
3243
|
)
|
|
3174
3244
|
] })
|
|
3175
3245
|
] }),
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3247
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.headerLabel }),
|
|
3248
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.headerHint }),
|
|
3249
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-2", children: [
|
|
3250
|
+
/* @__PURE__ */ jsxs17(
|
|
3181
3251
|
"select",
|
|
3182
3252
|
{
|
|
3183
3253
|
value: value.headerType,
|
|
3184
3254
|
onChange: (e) => set("headerType", e.target.value),
|
|
3185
3255
|
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",
|
|
3186
3256
|
children: [
|
|
3187
|
-
/* @__PURE__ */
|
|
3188
|
-
/* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsx20("option", { value: "NONE", children: labels.headerNone }),
|
|
3258
|
+
/* @__PURE__ */ jsx20("option", { value: "TEXT", children: labels.headerText })
|
|
3189
3259
|
]
|
|
3190
3260
|
}
|
|
3191
3261
|
),
|
|
3192
|
-
value.headerType === "TEXT" && /* @__PURE__ */
|
|
3262
|
+
value.headerType === "TEXT" && /* @__PURE__ */ jsx20(
|
|
3193
3263
|
"input",
|
|
3194
3264
|
{
|
|
3195
3265
|
type: "text",
|
|
@@ -3202,10 +3272,10 @@ function WhatsAppCreateTemplateForm({
|
|
|
3202
3272
|
)
|
|
3203
3273
|
] })
|
|
3204
3274
|
] }),
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
/* @__PURE__ */
|
|
3275
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3276
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.bodyLabel }),
|
|
3277
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.bodyHint }),
|
|
3278
|
+
/* @__PURE__ */ jsx20(
|
|
3209
3279
|
"textarea",
|
|
3210
3280
|
{
|
|
3211
3281
|
value: value.bodyText,
|
|
@@ -3216,26 +3286,26 @@ function WhatsAppCreateTemplateForm({
|
|
|
3216
3286
|
required: true
|
|
3217
3287
|
}
|
|
3218
3288
|
),
|
|
3219
|
-
detectedVariables.length > 0 && /* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */
|
|
3223
|
-
/* @__PURE__ */
|
|
3289
|
+
detectedVariables.length > 0 && /* @__PURE__ */ jsxs17("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: [
|
|
3290
|
+
/* @__PURE__ */ jsx20("p", { className: "font-medium text-gray-500 dark:text-gray-400 mb-1.5 uppercase tracking-wide text-xs", children: labels.detectedVariables }),
|
|
3291
|
+
/* @__PURE__ */ jsx20("div", { className: "flex flex-wrap gap-2", children: detectedVariables.map((num) => /* @__PURE__ */ jsxs17("span", { className: "inline-flex items-center gap-1 text-xs", children: [
|
|
3292
|
+
/* @__PURE__ */ jsx20("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}}}` }),
|
|
3293
|
+
/* @__PURE__ */ jsxs17("span", { className: "text-gray-400 dark:text-gray-500", children: [
|
|
3224
3294
|
"= ",
|
|
3225
3295
|
variableExamples[Number(num) - 1] ?? labels.variableLabel(Number(num))
|
|
3226
3296
|
] })
|
|
3227
3297
|
] }, num)) }),
|
|
3228
|
-
/* @__PURE__ */
|
|
3298
|
+
/* @__PURE__ */ jsxs17("p", { className: "text-gray-400 dark:text-gray-500 mt-1.5 text-xs", children: [
|
|
3229
3299
|
labels.configureHintPrefix,
|
|
3230
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsx20("strong", { children: labels.configureHintLink }),
|
|
3231
3301
|
labels.configureHintSuffix
|
|
3232
3302
|
] })
|
|
3233
3303
|
] })
|
|
3234
3304
|
] }),
|
|
3235
|
-
/* @__PURE__ */
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3305
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3306
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.footerLabel }),
|
|
3307
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.footerHint }),
|
|
3308
|
+
/* @__PURE__ */ jsx20(
|
|
3239
3309
|
"input",
|
|
3240
3310
|
{
|
|
3241
3311
|
type: "text",
|
|
@@ -3247,41 +3317,41 @@ function WhatsAppCreateTemplateForm({
|
|
|
3247
3317
|
}
|
|
3248
3318
|
)
|
|
3249
3319
|
] }),
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3257
|
-
/* @__PURE__ */
|
|
3320
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3321
|
+
/* @__PURE__ */ jsx20("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 block", children: labels.previewLabel }),
|
|
3322
|
+
/* @__PURE__ */ jsxs17("div", { className: "rounded-2xl bg-[#e5ddd5] dark:bg-[#1a1a2e] border border-gray-300 dark:border-gray-600 overflow-hidden shadow-inner", children: [
|
|
3323
|
+
/* @__PURE__ */ jsxs17("div", { className: "bg-[#075e54] px-4 py-2.5 flex items-center gap-2", children: [
|
|
3324
|
+
/* @__PURE__ */ jsx20("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() }),
|
|
3325
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3326
|
+
/* @__PURE__ */ jsx20("p", { className: "text-white text-xs font-semibold leading-tight", children: previewCompanyName }),
|
|
3327
|
+
/* @__PURE__ */ jsx20("p", { className: "text-white/60 text-xs", children: labels.previewOnline })
|
|
3258
3328
|
] })
|
|
3259
3329
|
] }),
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
3330
|
+
/* @__PURE__ */ jsxs17("div", { className: "px-3 py-4 space-y-3", style: { minHeight: "120px" }, children: [
|
|
3331
|
+
/* @__PURE__ */ jsx20("div", { className: "flex justify-start", style: { maxWidth: "85%" }, children: /* @__PURE__ */ jsxs17("div", { className: "bg-white dark:bg-gray-700 rounded-lg rounded-tl-none px-3 py-2 shadow-sm", children: [
|
|
3332
|
+
/* @__PURE__ */ jsx20("p", { className: "text-gray-500 dark:text-gray-400 leading-tight text-sm", children: labels.previewDescription }),
|
|
3333
|
+
/* @__PURE__ */ jsx20("p", { className: "text-gray-400 dark:text-gray-500 mt-1 text-right text-[9px]", children: "12:00" })
|
|
3264
3334
|
] }) }),
|
|
3265
|
-
/* @__PURE__ */
|
|
3266
|
-
value.headerType === "TEXT" && value.headerText && /* @__PURE__ */
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
value.footerText && /* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ jsx20("div", { className: "flex justify-end ml-auto", style: { maxWidth: "85%" }, children: /* @__PURE__ */ jsxs17("div", { className: "bg-[#dcf8c6] dark:bg-[#1b5e20] rounded-lg rounded-tr-none px-3 py-2 shadow-sm", children: [
|
|
3336
|
+
value.headerType === "TEXT" && value.headerText && /* @__PURE__ */ jsx20("p", { className: "text-xs font-bold text-gray-700 dark:text-gray-200 mb-1", children: fillPreviewTokens(value.headerText) || labels.previewHeaderFallback }),
|
|
3337
|
+
/* @__PURE__ */ jsx20("p", { className: "text-sm text-gray-800 dark:text-gray-100 leading-relaxed", children: value.bodyText ? fillPreviewTokens(value.bodyText) : /* @__PURE__ */ jsx20("span", { className: "text-gray-400 italic", children: labels.previewBodyPlaceholder }) }),
|
|
3338
|
+
value.footerText && /* @__PURE__ */ jsx20("p", { className: "text-gray-400 dark:text-gray-400 mt-1 text-xs", children: value.footerText }),
|
|
3339
|
+
/* @__PURE__ */ jsx20("p", { className: "text-gray-400 dark:text-gray-400 mt-1 text-right text-[9px]", children: "12:01 \u2713" })
|
|
3270
3340
|
] }) })
|
|
3271
3341
|
] })
|
|
3272
3342
|
] })
|
|
3273
3343
|
] }),
|
|
3274
|
-
result && /* @__PURE__ */
|
|
3344
|
+
result && /* @__PURE__ */ jsxs17(
|
|
3275
3345
|
"div",
|
|
3276
3346
|
{
|
|
3277
3347
|
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"}`,
|
|
3278
3348
|
children: [
|
|
3279
3349
|
result.message,
|
|
3280
|
-
result.ok && result.status && /* @__PURE__ */
|
|
3350
|
+
result.ok && result.status && /* @__PURE__ */ jsx20("p", { className: "text-xs mt-1 opacity-75", children: labels.successStatus(result.status) })
|
|
3281
3351
|
]
|
|
3282
3352
|
}
|
|
3283
3353
|
),
|
|
3284
|
-
/* @__PURE__ */
|
|
3354
|
+
/* @__PURE__ */ jsx20("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs17(
|
|
3285
3355
|
"button",
|
|
3286
3356
|
{
|
|
3287
3357
|
"data-cv-tooltip": submitting ? labels.sending : labels.sendForApproval,
|
|
@@ -3290,7 +3360,7 @@ function WhatsAppCreateTemplateForm({
|
|
|
3290
3360
|
disabled: submitting || !value.name || !value.bodyText,
|
|
3291
3361
|
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",
|
|
3292
3362
|
children: [
|
|
3293
|
-
submitting ? /* @__PURE__ */
|
|
3363
|
+
submitting ? /* @__PURE__ */ jsx20("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx20(SendHorizonal2, { size: 14 }),
|
|
3294
3364
|
submitting ? labels.sending : labels.sendForApproval
|
|
3295
3365
|
]
|
|
3296
3366
|
}
|
|
@@ -3301,7 +3371,7 @@ function WhatsAppCreateTemplateForm({
|
|
|
3301
3371
|
|
|
3302
3372
|
// src/settings/WelcomeFarewellForm.tsx
|
|
3303
3373
|
import { LogOut, Mail, Save as Save2 } from "lucide-react";
|
|
3304
|
-
import { jsx as
|
|
3374
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3305
3375
|
var DEFAULT_LABELS4 = {
|
|
3306
3376
|
sectionTitle: "Boas-vindas e encerramento",
|
|
3307
3377
|
welcomeMessage: "Mensagem de boas-vindas",
|
|
@@ -3329,15 +3399,15 @@ function WelcomeFarewellForm({
|
|
|
3329
3399
|
labels: labelsOverride
|
|
3330
3400
|
}) {
|
|
3331
3401
|
const labels = { ...DEFAULT_LABELS4, ...labelsOverride };
|
|
3332
|
-
return /* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3337
|
-
/* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ jsxs18("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3403
|
+
/* @__PURE__ */ jsx21("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: /* @__PURE__ */ jsx21("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }) }),
|
|
3404
|
+
/* @__PURE__ */ jsxs18("form", { onSubmit: onSave, className: "p-6 space-y-5", children: [
|
|
3405
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3406
|
+
/* @__PURE__ */ jsxs18("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 flex items-center gap-1.5", children: [
|
|
3407
|
+
/* @__PURE__ */ jsx21(Mail, { size: 13, className: "text-blue-600 dark:text-blue-400" }),
|
|
3338
3408
|
labels.welcomeMessage
|
|
3339
3409
|
] }),
|
|
3340
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsx21(
|
|
3341
3411
|
WhatsAppMessageEditor,
|
|
3342
3412
|
{
|
|
3343
3413
|
value: welcomeMessage,
|
|
@@ -3346,14 +3416,14 @@ function WelcomeFarewellForm({
|
|
|
3346
3416
|
placeholders: welcomePlaceholders
|
|
3347
3417
|
}
|
|
3348
3418
|
),
|
|
3349
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ jsx21("p", { className: "mt-1.5 text-xs text-gray-500 dark:text-gray-400", children: labels.welcomeMessageHint })
|
|
3350
3420
|
] }),
|
|
3351
|
-
/* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3421
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
3422
|
+
/* @__PURE__ */ jsxs18("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 flex items-center gap-1.5", children: [
|
|
3423
|
+
/* @__PURE__ */ jsx21(LogOut, { size: 13, className: "text-blue-600 dark:text-blue-400" }),
|
|
3354
3424
|
labels.farewellMessage
|
|
3355
3425
|
] }),
|
|
3356
|
-
/* @__PURE__ */
|
|
3426
|
+
/* @__PURE__ */ jsx21(
|
|
3357
3427
|
WhatsAppMessageEditor,
|
|
3358
3428
|
{
|
|
3359
3429
|
value: farewellMessage,
|
|
@@ -3362,10 +3432,10 @@ function WelcomeFarewellForm({
|
|
|
3362
3432
|
placeholders: farewellPlaceholders
|
|
3363
3433
|
}
|
|
3364
3434
|
),
|
|
3365
|
-
/* @__PURE__ */
|
|
3435
|
+
/* @__PURE__ */ jsx21("p", { className: "mt-1.5 text-xs text-gray-500 dark:text-gray-400", children: labels.farewellMessageHint })
|
|
3366
3436
|
] }),
|
|
3367
|
-
saveSuccess && /* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3437
|
+
saveSuccess && /* @__PURE__ */ jsx21("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 }),
|
|
3438
|
+
/* @__PURE__ */ jsx21("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs18(
|
|
3369
3439
|
"button",
|
|
3370
3440
|
{
|
|
3371
3441
|
"data-cv-tooltip": saving ? labels.saving : labels.save,
|
|
@@ -3374,7 +3444,7 @@ function WelcomeFarewellForm({
|
|
|
3374
3444
|
disabled: saving,
|
|
3375
3445
|
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",
|
|
3376
3446
|
children: [
|
|
3377
|
-
saving ? /* @__PURE__ */
|
|
3447
|
+
saving ? /* @__PURE__ */ jsx21("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx21(Save2, { size: 14 }),
|
|
3378
3448
|
saving ? labels.saving : labels.save
|
|
3379
3449
|
]
|
|
3380
3450
|
}
|
|
@@ -3385,7 +3455,7 @@ function WelcomeFarewellForm({
|
|
|
3385
3455
|
|
|
3386
3456
|
// src/settings/TranscriptionSettingsForm.tsx
|
|
3387
3457
|
import { AudioLines, Save as Save3 } from "lucide-react";
|
|
3388
|
-
import { jsx as
|
|
3458
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3389
3459
|
var DEFAULT_LABELS5 = {
|
|
3390
3460
|
sectionTitle: "Transcri\xE7\xE3o de \xE1udio",
|
|
3391
3461
|
enabled: "Transcrever notas de voz",
|
|
@@ -3412,15 +3482,15 @@ function TranscriptionSettingsForm({
|
|
|
3412
3482
|
labels: labelsOverride
|
|
3413
3483
|
}) {
|
|
3414
3484
|
const labels = { ...DEFAULT_LABELS5, ...labelsOverride };
|
|
3415
|
-
return /* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3417
|
-
/* @__PURE__ */
|
|
3485
|
+
return /* @__PURE__ */ jsxs19("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3486
|
+
/* @__PURE__ */ jsx22("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: /* @__PURE__ */ jsxs19("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-1.5", children: [
|
|
3487
|
+
/* @__PURE__ */ jsx22(AudioLines, { size: 14, className: "text-blue-600 dark:text-blue-400" }),
|
|
3418
3488
|
labels.sectionTitle
|
|
3419
3489
|
] }) }),
|
|
3420
|
-
/* @__PURE__ */
|
|
3421
|
-
!isAvailable && /* @__PURE__ */
|
|
3422
|
-
/* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3490
|
+
/* @__PURE__ */ jsxs19("form", { onSubmit: onSave, className: "p-6 space-y-5", children: [
|
|
3491
|
+
!isAvailable && /* @__PURE__ */ jsx22("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 }),
|
|
3492
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
3493
|
+
/* @__PURE__ */ jsx22(
|
|
3424
3494
|
"input",
|
|
3425
3495
|
{
|
|
3426
3496
|
type: "checkbox",
|
|
@@ -3430,14 +3500,14 @@ function TranscriptionSettingsForm({
|
|
|
3430
3500
|
className: "mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:opacity-50"
|
|
3431
3501
|
}
|
|
3432
3502
|
),
|
|
3433
|
-
/* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
3504
|
+
/* @__PURE__ */ jsx22("span", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.enabled }),
|
|
3505
|
+
/* @__PURE__ */ jsx22("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: labels.enabledHint })
|
|
3436
3506
|
] })
|
|
3437
3507
|
] }),
|
|
3438
|
-
enabled && /* @__PURE__ */
|
|
3439
|
-
/* @__PURE__ */
|
|
3440
|
-
/* @__PURE__ */
|
|
3508
|
+
enabled && /* @__PURE__ */ jsxs19("fieldset", { disabled: !isAvailable, className: "space-y-2.5", children: [
|
|
3509
|
+
/* @__PURE__ */ jsx22("legend", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: labels.modeTitle }),
|
|
3510
|
+
/* @__PURE__ */ jsx22(
|
|
3441
3511
|
ModeOption,
|
|
3442
3512
|
{
|
|
3443
3513
|
value: "onDemand",
|
|
@@ -3447,7 +3517,7 @@ function TranscriptionSettingsForm({
|
|
|
3447
3517
|
hint: labels.modeOnDemandHint
|
|
3448
3518
|
}
|
|
3449
3519
|
),
|
|
3450
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx22(
|
|
3451
3521
|
ModeOption,
|
|
3452
3522
|
{
|
|
3453
3523
|
value: "auto",
|
|
@@ -3458,8 +3528,8 @@ function TranscriptionSettingsForm({
|
|
|
3458
3528
|
}
|
|
3459
3529
|
)
|
|
3460
3530
|
] }),
|
|
3461
|
-
saveSuccess && /* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3531
|
+
saveSuccess && /* @__PURE__ */ jsx22("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 }),
|
|
3532
|
+
/* @__PURE__ */ jsx22("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs19(
|
|
3463
3533
|
"button",
|
|
3464
3534
|
{
|
|
3465
3535
|
"data-cv-tooltip": saving ? labels.saving : labels.save,
|
|
@@ -3468,7 +3538,7 @@ function TranscriptionSettingsForm({
|
|
|
3468
3538
|
disabled: saving || !isAvailable,
|
|
3469
3539
|
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",
|
|
3470
3540
|
children: [
|
|
3471
|
-
saving ? /* @__PURE__ */
|
|
3541
|
+
saving ? /* @__PURE__ */ jsx22("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx22(Save3, { size: 14 }),
|
|
3472
3542
|
saving ? labels.saving : labels.save
|
|
3473
3543
|
]
|
|
3474
3544
|
}
|
|
@@ -3484,12 +3554,12 @@ function ModeOption({
|
|
|
3484
3554
|
hint
|
|
3485
3555
|
}) {
|
|
3486
3556
|
const isSelected = current === value;
|
|
3487
|
-
return /* @__PURE__ */
|
|
3557
|
+
return /* @__PURE__ */ jsxs19(
|
|
3488
3558
|
"label",
|
|
3489
3559
|
{
|
|
3490
3560
|
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"}`,
|
|
3491
3561
|
children: [
|
|
3492
|
-
/* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsx22(
|
|
3493
3563
|
"input",
|
|
3494
3564
|
{
|
|
3495
3565
|
type: "radio",
|
|
@@ -3500,9 +3570,9 @@ function ModeOption({
|
|
|
3500
3570
|
className: "mt-0.5 h-4 w-4 border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
3501
3571
|
}
|
|
3502
3572
|
),
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3505
|
-
/* @__PURE__ */
|
|
3573
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
3574
|
+
/* @__PURE__ */ jsx22("span", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: title }),
|
|
3575
|
+
/* @__PURE__ */ jsx22("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: hint })
|
|
3506
3576
|
] })
|
|
3507
3577
|
]
|
|
3508
3578
|
}
|
|
@@ -3510,8 +3580,8 @@ function ModeOption({
|
|
|
3510
3580
|
}
|
|
3511
3581
|
|
|
3512
3582
|
// src/settings/WhatsAppTemplatesSettings.tsx
|
|
3513
|
-
import { useState as
|
|
3514
|
-
import { jsx as
|
|
3583
|
+
import { useState as useState13 } from "react";
|
|
3584
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3515
3585
|
var TEMPLATE_SETTINGS_TAB = {
|
|
3516
3586
|
SELECT: "select",
|
|
3517
3587
|
CREATE: "create"
|
|
@@ -3528,10 +3598,10 @@ function WhatsAppTemplatesSettings({
|
|
|
3528
3598
|
...settingsProps
|
|
3529
3599
|
}) {
|
|
3530
3600
|
const labels = { ...DEFAULT_TEMPLATES_SETTINGS_LABELS, ...labelsOverride };
|
|
3531
|
-
const [tab, setTab] =
|
|
3532
|
-
return /* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */
|
|
3601
|
+
const [tab, setTab] = useState13(TEMPLATE_SETTINGS_TAB.SELECT);
|
|
3602
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-4", children: [
|
|
3603
|
+
/* @__PURE__ */ jsxs20("nav", { className: "flex gap-1 border-b", role: "tablist", children: [
|
|
3604
|
+
/* @__PURE__ */ jsx23(
|
|
3535
3605
|
"button",
|
|
3536
3606
|
{
|
|
3537
3607
|
"data-cv-tooltip": labels.selectTab,
|
|
@@ -3544,7 +3614,7 @@ function WhatsAppTemplatesSettings({
|
|
|
3544
3614
|
children: labels.selectTab
|
|
3545
3615
|
}
|
|
3546
3616
|
),
|
|
3547
|
-
create ? /* @__PURE__ */
|
|
3617
|
+
create ? /* @__PURE__ */ jsx23(
|
|
3548
3618
|
"button",
|
|
3549
3619
|
{
|
|
3550
3620
|
"data-cv-tooltip": labels.createTab,
|
|
@@ -3558,16 +3628,16 @@ function WhatsAppTemplatesSettings({
|
|
|
3558
3628
|
}
|
|
3559
3629
|
) : null
|
|
3560
3630
|
] }),
|
|
3561
|
-
tab === TEMPLATE_SETTINGS_TAB.SELECT ? /* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3631
|
+
tab === TEMPLATE_SETTINGS_TAB.SELECT ? /* @__PURE__ */ jsxs20("div", { className: "space-y-6", children: [
|
|
3632
|
+
/* @__PURE__ */ jsx23(WhatsAppTemplateSettingsForm, { ...settingsProps, ...settingsLabels ? { labels: settingsLabels } : {} }),
|
|
3563
3633
|
extraRoleForms
|
|
3564
|
-
] }) : create ? /* @__PURE__ */
|
|
3634
|
+
] }) : create ? /* @__PURE__ */ jsx23(WhatsAppCreateTemplateForm, { ...create }) : null
|
|
3565
3635
|
] });
|
|
3566
3636
|
}
|
|
3567
3637
|
|
|
3568
3638
|
// src/settings/TopicsForm.tsx
|
|
3569
3639
|
import { Megaphone, Save as Save4 } from "lucide-react";
|
|
3570
|
-
import { jsx as
|
|
3640
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3571
3641
|
var DEFAULT_LABELS6 = {
|
|
3572
3642
|
sectionTitle: "T\xF3picos intermedi\xE1rios",
|
|
3573
3643
|
sectionDescription: "Mensagens autom\xE1ticas para assuntos espec\xEDficos, disparadas quando o cliente demonstra interesse.",
|
|
@@ -3585,19 +3655,19 @@ function TopicsForm({
|
|
|
3585
3655
|
labels: labelsOverride
|
|
3586
3656
|
}) {
|
|
3587
3657
|
const labels = { ...DEFAULT_LABELS6, ...labelsOverride };
|
|
3588
|
-
return /* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3658
|
+
return /* @__PURE__ */ jsxs21("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
3659
|
+
/* @__PURE__ */ jsxs21("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
3660
|
+
/* @__PURE__ */ jsxs21("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2", children: [
|
|
3661
|
+
/* @__PURE__ */ jsx24(Megaphone, { size: 16, className: "text-orange-600 dark:text-orange-400" }),
|
|
3592
3662
|
labels.sectionTitle
|
|
3593
3663
|
] }),
|
|
3594
|
-
/* @__PURE__ */
|
|
3664
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
3595
3665
|
] }),
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
topics.map((topic) => /* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3600
|
-
/* @__PURE__ */
|
|
3666
|
+
/* @__PURE__ */ jsxs21("form", { onSubmit: onSave, className: "p-6 space-y-6", children: [
|
|
3667
|
+
topics.map((topic) => /* @__PURE__ */ jsxs21("div", { className: "space-y-2", children: [
|
|
3668
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-start gap-4", children: [
|
|
3669
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1", children: /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: topic.label }) }),
|
|
3670
|
+
/* @__PURE__ */ jsx24(
|
|
3601
3671
|
"button",
|
|
3602
3672
|
{
|
|
3603
3673
|
"data-cv-tooltip": topic.label,
|
|
@@ -3607,7 +3677,7 @@ function TopicsForm({
|
|
|
3607
3677
|
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"}`,
|
|
3608
3678
|
role: "switch",
|
|
3609
3679
|
"aria-checked": topic.enabled,
|
|
3610
|
-
children: /* @__PURE__ */
|
|
3680
|
+
children: /* @__PURE__ */ jsx24(
|
|
3611
3681
|
"span",
|
|
3612
3682
|
{
|
|
3613
3683
|
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"}`
|
|
@@ -3616,7 +3686,7 @@ function TopicsForm({
|
|
|
3616
3686
|
}
|
|
3617
3687
|
)
|
|
3618
3688
|
] }),
|
|
3619
|
-
/* @__PURE__ */
|
|
3689
|
+
/* @__PURE__ */ jsx24(
|
|
3620
3690
|
"textarea",
|
|
3621
3691
|
{
|
|
3622
3692
|
value: topic.message,
|
|
@@ -3628,8 +3698,8 @@ function TopicsForm({
|
|
|
3628
3698
|
}
|
|
3629
3699
|
)
|
|
3630
3700
|
] }, topic.key)),
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3701
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-3", children: [
|
|
3702
|
+
/* @__PURE__ */ jsxs21(
|
|
3633
3703
|
"button",
|
|
3634
3704
|
{
|
|
3635
3705
|
"data-cv-tooltip": labels.saveButton,
|
|
@@ -3638,20 +3708,20 @@ function TopicsForm({
|
|
|
3638
3708
|
disabled: saving,
|
|
3639
3709
|
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",
|
|
3640
3710
|
children: [
|
|
3641
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx24(Save4, { size: 14 }),
|
|
3642
3712
|
labels.saveButton
|
|
3643
3713
|
]
|
|
3644
3714
|
}
|
|
3645
3715
|
),
|
|
3646
|
-
saveSuccess && /* @__PURE__ */
|
|
3716
|
+
saveSuccess && /* @__PURE__ */ jsx24("span", { className: "text-sm text-green-600 dark:text-green-400", children: labels.saveSuccess })
|
|
3647
3717
|
] })
|
|
3648
3718
|
] })
|
|
3649
3719
|
] });
|
|
3650
3720
|
}
|
|
3651
3721
|
|
|
3652
3722
|
// src/settings/MessagesWorkspace.tsx
|
|
3653
|
-
import { useCallback as
|
|
3654
|
-
import { Fragment as Fragment6, jsx as
|
|
3723
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useState as useState14 } from "react";
|
|
3724
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3655
3725
|
var DEFAULT_LABELS7 = {
|
|
3656
3726
|
title: "Mensagens",
|
|
3657
3727
|
subtitle: "Mensagens do bot e templates do WhatsApp.",
|
|
@@ -3709,30 +3779,30 @@ function MessagesWorkspace({
|
|
|
3709
3779
|
const hasTopics = Boolean(api.getTopics && api.saveTopics);
|
|
3710
3780
|
const hasTemplates = Boolean(api.getTemplateSettings && api.saveTemplateSettings);
|
|
3711
3781
|
const hasTranscription = Boolean(api.getTranscription && api.saveTranscription);
|
|
3712
|
-
const [tab, setTab] =
|
|
3713
|
-
const [loadState, setLoadState] =
|
|
3714
|
-
const [messages, setMessages] =
|
|
3715
|
-
const [savingMessages, setSavingMessages] =
|
|
3716
|
-
const [messagesSaved, setMessagesSaved] =
|
|
3717
|
-
const [topics, setTopics] =
|
|
3718
|
-
const [savingTopics, setSavingTopics] =
|
|
3719
|
-
const [topicsSaved, setTopicsSaved] =
|
|
3720
|
-
const [templateSettings, setTemplateSettings] =
|
|
3721
|
-
const [templates, setTemplates] =
|
|
3722
|
-
const [loadingTemplates, setLoadingTemplates] =
|
|
3723
|
-
const [templatesError, setTemplatesError] =
|
|
3724
|
-
const [savingTemplate, setSavingTemplate] =
|
|
3725
|
-
const [templateSaved, setTemplateSaved] =
|
|
3726
|
-
const [roleSettings, setRoleSettings] =
|
|
3727
|
-
const [savingRole, setSavingRole] =
|
|
3728
|
-
const [roleSaved, setRoleSaved] =
|
|
3729
|
-
const [createTemplate, setCreateTemplate] =
|
|
3730
|
-
const [creatingTemplate, setCreatingTemplate] =
|
|
3731
|
-
const [createResult, setCreateResult] =
|
|
3732
|
-
const [transcription, setTranscription] =
|
|
3733
|
-
const [savingTranscription, setSavingTranscription] =
|
|
3734
|
-
const [transcriptionSaved, setTranscriptionSaved] =
|
|
3735
|
-
const reloadTemplates =
|
|
3782
|
+
const [tab, setTab] = useState14(MESSAGES_TAB.BOT);
|
|
3783
|
+
const [loadState, setLoadState] = useState14("loading");
|
|
3784
|
+
const [messages, setMessages] = useState14(EMPTY_MESSAGES);
|
|
3785
|
+
const [savingMessages, setSavingMessages] = useState14(false);
|
|
3786
|
+
const [messagesSaved, setMessagesSaved] = useState14(false);
|
|
3787
|
+
const [topics, setTopics] = useState14([]);
|
|
3788
|
+
const [savingTopics, setSavingTopics] = useState14(false);
|
|
3789
|
+
const [topicsSaved, setTopicsSaved] = useState14(false);
|
|
3790
|
+
const [templateSettings, setTemplateSettings] = useState14(EMPTY_TEMPLATE_SETTINGS);
|
|
3791
|
+
const [templates, setTemplates] = useState14([]);
|
|
3792
|
+
const [loadingTemplates, setLoadingTemplates] = useState14(false);
|
|
3793
|
+
const [templatesError, setTemplatesError] = useState14(false);
|
|
3794
|
+
const [savingTemplate, setSavingTemplate] = useState14(false);
|
|
3795
|
+
const [templateSaved, setTemplateSaved] = useState14(false);
|
|
3796
|
+
const [roleSettings, setRoleSettings] = useState14({});
|
|
3797
|
+
const [savingRole, setSavingRole] = useState14({});
|
|
3798
|
+
const [roleSaved, setRoleSaved] = useState14({});
|
|
3799
|
+
const [createTemplate, setCreateTemplate] = useState14(EMPTY_CREATE_TEMPLATE);
|
|
3800
|
+
const [creatingTemplate, setCreatingTemplate] = useState14(false);
|
|
3801
|
+
const [createResult, setCreateResult] = useState14(null);
|
|
3802
|
+
const [transcription, setTranscription] = useState14(UNDECIDED_TRANSCRIPTION);
|
|
3803
|
+
const [savingTranscription, setSavingTranscription] = useState14(false);
|
|
3804
|
+
const [transcriptionSaved, setTranscriptionSaved] = useState14(false);
|
|
3805
|
+
const reloadTemplates = useCallback6(async () => {
|
|
3736
3806
|
if (!api.listTemplates) return;
|
|
3737
3807
|
setLoadingTemplates(true);
|
|
3738
3808
|
setTemplatesError(false);
|
|
@@ -3882,23 +3952,23 @@ function MessagesWorkspace({
|
|
|
3882
3952
|
});
|
|
3883
3953
|
}
|
|
3884
3954
|
if (loadState === "loading") {
|
|
3885
|
-
return /* @__PURE__ */
|
|
3955
|
+
return /* @__PURE__ */ jsx25("p", { className: "p-6 text-sm text-gray-500 dark:text-gray-400", children: labels.loading });
|
|
3886
3956
|
}
|
|
3887
3957
|
if (loadState === "error") {
|
|
3888
|
-
return /* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ jsx25("p", { role: "alert", className: "p-6 text-sm text-red-600 dark:text-red-400", children: labels.loadError });
|
|
3889
3959
|
}
|
|
3890
3960
|
const tabs = [
|
|
3891
3961
|
{ id: MESSAGES_TAB.BOT, label: labels.tabBot },
|
|
3892
3962
|
...hasTemplates ? [{ id: MESSAGES_TAB.TEMPLATES, label: labels.tabTemplates }] : [],
|
|
3893
3963
|
...hasTranscription ? [{ id: MESSAGES_TAB.TRANSCRIPTION, label: labels.tabTranscription }] : []
|
|
3894
3964
|
];
|
|
3895
|
-
return /* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
3898
|
-
/* @__PURE__ */
|
|
3899
|
-
/* @__PURE__ */
|
|
3965
|
+
return /* @__PURE__ */ jsxs22("div", { className: `space-y-6 p-4 lg:p-0 ${className ?? ""}`, children: [
|
|
3966
|
+
/* @__PURE__ */ jsx25(TooltipLayer, {}),
|
|
3967
|
+
/* @__PURE__ */ jsxs22("header", { children: [
|
|
3968
|
+
/* @__PURE__ */ jsx25("h1", { className: "text-xl font-semibold text-gray-900 dark:text-gray-100", children: labels.title }),
|
|
3969
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: labels.subtitle })
|
|
3900
3970
|
] }),
|
|
3901
|
-
tabs.length > 1 ? /* @__PURE__ */
|
|
3971
|
+
tabs.length > 1 ? /* @__PURE__ */ jsx25("nav", { className: "flex gap-1 border-b border-gray-200 dark:border-gray-700", role: "tablist", children: tabs.map((item) => /* @__PURE__ */ jsx25(
|
|
3902
3972
|
"button",
|
|
3903
3973
|
{
|
|
3904
3974
|
"data-cv-tooltip": item.label,
|
|
@@ -3912,8 +3982,8 @@ function MessagesWorkspace({
|
|
|
3912
3982
|
},
|
|
3913
3983
|
item.id
|
|
3914
3984
|
)) }) : null,
|
|
3915
|
-
tab === MESSAGES_TAB.BOT ? /* @__PURE__ */
|
|
3916
|
-
/* @__PURE__ */
|
|
3985
|
+
tab === MESSAGES_TAB.BOT ? /* @__PURE__ */ jsxs22("div", { className: "space-y-8", children: [
|
|
3986
|
+
/* @__PURE__ */ jsx25(
|
|
3917
3987
|
WelcomeFarewellForm,
|
|
3918
3988
|
{
|
|
3919
3989
|
welcomeMessage: messages.welcomeMessage,
|
|
@@ -3928,7 +3998,7 @@ function MessagesWorkspace({
|
|
|
3928
3998
|
...farewellPlaceholders ? { farewellPlaceholders } : {}
|
|
3929
3999
|
}
|
|
3930
4000
|
),
|
|
3931
|
-
hasTopics ? /* @__PURE__ */
|
|
4001
|
+
hasTopics ? /* @__PURE__ */ jsx25(
|
|
3932
4002
|
TopicsForm,
|
|
3933
4003
|
{
|
|
3934
4004
|
topics,
|
|
@@ -3945,9 +4015,9 @@ function MessagesWorkspace({
|
|
|
3945
4015
|
}
|
|
3946
4016
|
) : null
|
|
3947
4017
|
] }) : null,
|
|
3948
|
-
tab === MESSAGES_TAB.TEMPLATES ? /* @__PURE__ */
|
|
4018
|
+
tab === MESSAGES_TAB.TEMPLATES ? /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
|
|
3949
4019
|
renderTemplatesNotice?.(),
|
|
3950
|
-
/* @__PURE__ */
|
|
4020
|
+
/* @__PURE__ */ jsx25(
|
|
3951
4021
|
WhatsAppTemplatesSettings,
|
|
3952
4022
|
{
|
|
3953
4023
|
templates,
|
|
@@ -3977,9 +4047,9 @@ function MessagesWorkspace({
|
|
|
3977
4047
|
}
|
|
3978
4048
|
} : {},
|
|
3979
4049
|
...templateRoles.length > 0 ? {
|
|
3980
|
-
extraRoleForms: /* @__PURE__ */
|
|
4050
|
+
extraRoleForms: /* @__PURE__ */ jsx25(Fragment6, { children: templateRoles.map((role) => {
|
|
3981
4051
|
const settings = roleSettings[role.key] ?? EMPTY_TEMPLATE_SETTINGS;
|
|
3982
|
-
return /* @__PURE__ */
|
|
4052
|
+
return /* @__PURE__ */ jsx25(
|
|
3983
4053
|
WhatsAppTemplateSettingsForm,
|
|
3984
4054
|
{
|
|
3985
4055
|
templates,
|
|
@@ -4006,7 +4076,7 @@ function MessagesWorkspace({
|
|
|
4006
4076
|
}
|
|
4007
4077
|
)
|
|
4008
4078
|
] }) : null,
|
|
4009
|
-
tab === MESSAGES_TAB.TRANSCRIPTION ? /* @__PURE__ */
|
|
4079
|
+
tab === MESSAGES_TAB.TRANSCRIPTION ? /* @__PURE__ */ jsx25(
|
|
4010
4080
|
TranscriptionSettingsForm,
|
|
4011
4081
|
{
|
|
4012
4082
|
enabled: transcription.enabled,
|
|
@@ -4024,7 +4094,7 @@ function MessagesWorkspace({
|
|
|
4024
4094
|
}
|
|
4025
4095
|
|
|
4026
4096
|
// src/hooks/useConversationMessages.ts
|
|
4027
|
-
import { useCallback as
|
|
4097
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef7, useState as useState15 } from "react";
|
|
4028
4098
|
var OLDER_MESSAGES_PAGE_LIMIT = 50;
|
|
4029
4099
|
function dedupeMessagesById(messages) {
|
|
4030
4100
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -4058,16 +4128,16 @@ function useConversationMessages(conversationId, params) {
|
|
|
4058
4128
|
() => api.fetchMessages(conversationId, params),
|
|
4059
4129
|
[conversationId, params?.limit, params?.before]
|
|
4060
4130
|
);
|
|
4061
|
-
const [olderMessages, setOlderMessages] =
|
|
4062
|
-
const [hasMoreOlderMessages, setHasMoreOlderMessages] =
|
|
4063
|
-
const [loadingOlderMessages, setLoadingOlderMessages] =
|
|
4131
|
+
const [olderMessages, setOlderMessages] = useState15([]);
|
|
4132
|
+
const [hasMoreOlderMessages, setHasMoreOlderMessages] = useState15(true);
|
|
4133
|
+
const [loadingOlderMessages, setLoadingOlderMessages] = useState15(false);
|
|
4064
4134
|
const loadingOlderMessagesRef = useRef7(false);
|
|
4065
4135
|
useEffect10(() => {
|
|
4066
4136
|
setOlderMessages([]);
|
|
4067
4137
|
setHasMoreOlderMessages(true);
|
|
4068
4138
|
}, [conversationId]);
|
|
4069
4139
|
const messages = useMemo3(() => dedupeMessagesById([...olderMessages, ...data ?? []]), [olderMessages, data]);
|
|
4070
|
-
const loadOlderMessages =
|
|
4140
|
+
const loadOlderMessages = useCallback7(async () => {
|
|
4071
4141
|
const oldestMessage = messages[0];
|
|
4072
4142
|
if (!shouldFetchOlderMessages({
|
|
4073
4143
|
isLoading: loadingOlderMessagesRef.current,
|
|
@@ -4090,7 +4160,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
4090
4160
|
setLoadingOlderMessages(false);
|
|
4091
4161
|
}
|
|
4092
4162
|
}, [api, conversationId, hasMoreOlderMessages, messages]);
|
|
4093
|
-
const sendMessage =
|
|
4163
|
+
const sendMessage = useCallback7(
|
|
4094
4164
|
async (text) => {
|
|
4095
4165
|
const message = await api.sendMessage(conversationId, text);
|
|
4096
4166
|
await refetch();
|
|
@@ -4098,7 +4168,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
4098
4168
|
},
|
|
4099
4169
|
[api, conversationId, refetch]
|
|
4100
4170
|
);
|
|
4101
|
-
const sendMedia =
|
|
4171
|
+
const sendMedia = useCallback7(
|
|
4102
4172
|
async (mediaData) => {
|
|
4103
4173
|
const message = await api.sendMedia(conversationId, mediaData);
|
|
4104
4174
|
await refetch();
|
|
@@ -4106,14 +4176,14 @@ function useConversationMessages(conversationId, params) {
|
|
|
4106
4176
|
},
|
|
4107
4177
|
[api, conversationId, refetch]
|
|
4108
4178
|
);
|
|
4109
|
-
const sendTemplate =
|
|
4179
|
+
const sendTemplate = useCallback7(
|
|
4110
4180
|
async (templateData) => {
|
|
4111
4181
|
await api.sendTemplate(conversationId, templateData);
|
|
4112
4182
|
await refetch();
|
|
4113
4183
|
},
|
|
4114
4184
|
[api, conversationId, refetch]
|
|
4115
4185
|
);
|
|
4116
|
-
const markRead =
|
|
4186
|
+
const markRead = useCallback7(() => api.markRead(conversationId), [api, conversationId]);
|
|
4117
4187
|
return {
|
|
4118
4188
|
messages,
|
|
4119
4189
|
loading,
|
|
@@ -4130,7 +4200,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
4130
4200
|
}
|
|
4131
4201
|
|
|
4132
4202
|
// src/hooks/useScrollToLatestMessage.ts
|
|
4133
|
-
import { useCallback as
|
|
4203
|
+
import { useCallback as useCallback8, useLayoutEffect, useRef as useRef8, useState as useState16 } from "react";
|
|
4134
4204
|
var NEAR_BOTTOM_THRESHOLD_PX = 120;
|
|
4135
4205
|
var SCROLL_BEHAVIOR = "auto";
|
|
4136
4206
|
function useScrollToLatestMessage({
|
|
@@ -4138,14 +4208,14 @@ function useScrollToLatestMessage({
|
|
|
4138
4208
|
messageCount
|
|
4139
4209
|
}) {
|
|
4140
4210
|
const containerRef = useRef8(null);
|
|
4141
|
-
const [isAwayFromBottom, setIsAwayFromBottom] =
|
|
4211
|
+
const [isAwayFromBottom, setIsAwayFromBottom] = useState16(false);
|
|
4142
4212
|
const isAwayFromBottomRef = useRef8(false);
|
|
4143
|
-
const scrollToBottom =
|
|
4213
|
+
const scrollToBottom = useCallback8((behavior = SCROLL_BEHAVIOR) => {
|
|
4144
4214
|
const container = containerRef.current;
|
|
4145
4215
|
if (!container) return;
|
|
4146
4216
|
container.scrollTo({ top: container.scrollHeight, behavior });
|
|
4147
4217
|
}, []);
|
|
4148
|
-
const handleScroll =
|
|
4218
|
+
const handleScroll = useCallback8((event) => {
|
|
4149
4219
|
const target = event.currentTarget;
|
|
4150
4220
|
const distanceFromBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
4151
4221
|
const away = distanceFromBottom > NEAR_BOTTOM_THRESHOLD_PX;
|
|
@@ -4398,11 +4468,11 @@ async function sendQueuedMessage(params) {
|
|
|
4398
4468
|
}
|
|
4399
4469
|
|
|
4400
4470
|
// src/quickReplies/QuickRepliesWorkspace.tsx
|
|
4401
|
-
import { useEffect as useEffect14, useId as useId2, useRef as useRef12, useState as
|
|
4471
|
+
import { useEffect as useEffect14, useId as useId2, useRef as useRef12, useState as useState19 } from "react";
|
|
4402
4472
|
import { Pencil as Pencil2, Plus as Plus2, Trash2 as Trash23 } from "lucide-react";
|
|
4403
4473
|
|
|
4404
4474
|
// src/quickReplies/useQuickRepliesWorkspace.ts
|
|
4405
|
-
import { useCallback as
|
|
4475
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useState as useState18 } from "react";
|
|
4406
4476
|
|
|
4407
4477
|
// src/quickReplies/quickReplyAttachmentUpload.ts
|
|
4408
4478
|
function validateAttachmentFiles(files, currentCount, limits) {
|
|
@@ -4434,7 +4504,7 @@ function moveAttachment(list, index, direction) {
|
|
|
4434
4504
|
}
|
|
4435
4505
|
|
|
4436
4506
|
// src/quickReplies/useQuickReplyAttachmentUploads.ts
|
|
4437
|
-
import { useCallback as
|
|
4507
|
+
import { useCallback as useCallback9, useEffect as useEffect12, useRef as useRef10, useState as useState17 } from "react";
|
|
4438
4508
|
|
|
4439
4509
|
// src/quickReplies/createUploadQueue.ts
|
|
4440
4510
|
function createUploadQueue(maxConcurrent) {
|
|
@@ -4490,8 +4560,8 @@ function useQuickReplyAttachmentUploads({
|
|
|
4490
4560
|
attachmentsCount,
|
|
4491
4561
|
onUploaded
|
|
4492
4562
|
}) {
|
|
4493
|
-
const [pendingUploads, setPendingUploads] =
|
|
4494
|
-
const [attachmentRejections, setAttachmentRejections] =
|
|
4563
|
+
const [pendingUploads, setPendingUploads] = useState17([]);
|
|
4564
|
+
const [attachmentRejections, setAttachmentRejections] = useState17([]);
|
|
4495
4565
|
const uploadQueueRef = useRef10(createUploadQueue(3));
|
|
4496
4566
|
const isMountedRef = useRef10(true);
|
|
4497
4567
|
useEffect12(
|
|
@@ -4501,19 +4571,19 @@ function useQuickReplyAttachmentUploads({
|
|
|
4501
4571
|
},
|
|
4502
4572
|
[]
|
|
4503
4573
|
);
|
|
4504
|
-
const abortAllUploads =
|
|
4574
|
+
const abortAllUploads = useCallback9(() => {
|
|
4505
4575
|
uploadQueueRef.current.abortAll();
|
|
4506
4576
|
setPendingUploads([]);
|
|
4507
4577
|
}, []);
|
|
4508
|
-
const dismissAttachmentRejections =
|
|
4509
|
-
const cancelAttachmentUpload =
|
|
4578
|
+
const dismissAttachmentRejections = useCallback9(() => setAttachmentRejections([]), []);
|
|
4579
|
+
const cancelAttachmentUpload = useCallback9((localId) => {
|
|
4510
4580
|
uploadQueueRef.current.abort(localId);
|
|
4511
4581
|
setPendingUploads((current) => current.filter((item) => item.localId !== localId));
|
|
4512
4582
|
}, []);
|
|
4513
|
-
const updatePendingUpload =
|
|
4583
|
+
const updatePendingUpload = useCallback9((localId, patch) => {
|
|
4514
4584
|
setPendingUploads((current) => current.map((item) => item.localId === localId ? { ...item, ...patch } : item));
|
|
4515
4585
|
}, []);
|
|
4516
|
-
const uploadOneFile =
|
|
4586
|
+
const uploadOneFile = useCallback9(
|
|
4517
4587
|
(localId, file) => {
|
|
4518
4588
|
if (!upload) return;
|
|
4519
4589
|
uploadQueueRef.current.enqueue(localId, async (signal) => {
|
|
@@ -4538,7 +4608,7 @@ function useQuickReplyAttachmentUploads({
|
|
|
4538
4608
|
},
|
|
4539
4609
|
[upload, updatePendingUpload, onUploaded, labels.saveError]
|
|
4540
4610
|
);
|
|
4541
|
-
const retryAttachmentUpload =
|
|
4611
|
+
const retryAttachmentUpload = useCallback9(
|
|
4542
4612
|
(localId) => {
|
|
4543
4613
|
const item = pendingUploads.find((pending) => pending.localId === localId);
|
|
4544
4614
|
if (!item) return;
|
|
@@ -4547,7 +4617,7 @@ function useQuickReplyAttachmentUploads({
|
|
|
4547
4617
|
},
|
|
4548
4618
|
[pendingUploads, updatePendingUpload, uploadOneFile]
|
|
4549
4619
|
);
|
|
4550
|
-
const addAttachmentFiles =
|
|
4620
|
+
const addAttachmentFiles = useCallback9(
|
|
4551
4621
|
(files) => {
|
|
4552
4622
|
if (!upload) return;
|
|
4553
4623
|
const currentCount = attachmentsCount + pendingUploads.length;
|
|
@@ -4672,16 +4742,16 @@ function useQuickRepliesWorkspace({
|
|
|
4672
4742
|
labels,
|
|
4673
4743
|
attachmentSizeLimits
|
|
4674
4744
|
}) {
|
|
4675
|
-
const [quickReplies, setQuickReplies] =
|
|
4676
|
-
const [isLoading, setIsLoading] =
|
|
4677
|
-
const [loadError, setLoadError] =
|
|
4678
|
-
const [search, setSearch] =
|
|
4679
|
-
const [editing, setEditing] =
|
|
4680
|
-
const [fieldErrors, setFieldErrors] =
|
|
4681
|
-
const [isSaving, setIsSaving] =
|
|
4682
|
-
const [saveError, setSaveError] =
|
|
4683
|
-
const [deletingId, setDeletingId] =
|
|
4684
|
-
const uploadAttachment =
|
|
4745
|
+
const [quickReplies, setQuickReplies] = useState18([]);
|
|
4746
|
+
const [isLoading, setIsLoading] = useState18(false);
|
|
4747
|
+
const [loadError, setLoadError] = useState18(void 0);
|
|
4748
|
+
const [search, setSearch] = useState18("");
|
|
4749
|
+
const [editing, setEditing] = useState18(void 0);
|
|
4750
|
+
const [fieldErrors, setFieldErrors] = useState18({});
|
|
4751
|
+
const [isSaving, setIsSaving] = useState18(false);
|
|
4752
|
+
const [saveError, setSaveError] = useState18(void 0);
|
|
4753
|
+
const [deletingId, setDeletingId] = useState18(void 0);
|
|
4754
|
+
const uploadAttachment = useCallback10((attachment) => {
|
|
4685
4755
|
setEditing((current) => current ? { ...current, attachments: [...current.attachments, attachment] } : current);
|
|
4686
4756
|
}, []);
|
|
4687
4757
|
const {
|
|
@@ -4716,14 +4786,14 @@ function useQuickRepliesWorkspace({
|
|
|
4716
4786
|
};
|
|
4717
4787
|
}, [api.listQuickReplies]);
|
|
4718
4788
|
const filtered = filterQuickReplies({ quickReplies, search });
|
|
4719
|
-
const startCreate =
|
|
4789
|
+
const startCreate = useCallback10(() => {
|
|
4720
4790
|
abortAllUploads();
|
|
4721
4791
|
dismissAttachmentRejections();
|
|
4722
4792
|
setEditing({ id: null, title: "", shortcut: "", body: "", attachments: [] });
|
|
4723
4793
|
setFieldErrors({});
|
|
4724
4794
|
setSaveError(void 0);
|
|
4725
4795
|
}, [abortAllUploads, dismissAttachmentRejections]);
|
|
4726
|
-
const startEdit =
|
|
4796
|
+
const startEdit = useCallback10(
|
|
4727
4797
|
(quickReply) => {
|
|
4728
4798
|
abortAllUploads();
|
|
4729
4799
|
dismissAttachmentRejections();
|
|
@@ -4739,14 +4809,14 @@ function useQuickRepliesWorkspace({
|
|
|
4739
4809
|
},
|
|
4740
4810
|
[abortAllUploads, dismissAttachmentRejections]
|
|
4741
4811
|
);
|
|
4742
|
-
const cancelEdit =
|
|
4812
|
+
const cancelEdit = useCallback10(() => {
|
|
4743
4813
|
abortAllUploads();
|
|
4744
4814
|
dismissAttachmentRejections();
|
|
4745
4815
|
setEditing(void 0);
|
|
4746
4816
|
setFieldErrors({});
|
|
4747
4817
|
setSaveError(void 0);
|
|
4748
4818
|
}, [abortAllUploads, dismissAttachmentRejections]);
|
|
4749
|
-
const updateField =
|
|
4819
|
+
const updateField = useCallback10((field, value) => {
|
|
4750
4820
|
setEditing((current) => current ? { ...current, [field]: value } : current);
|
|
4751
4821
|
setFieldErrors((current) => {
|
|
4752
4822
|
if (!(field in current)) return current;
|
|
@@ -4755,7 +4825,7 @@ function useQuickRepliesWorkspace({
|
|
|
4755
4825
|
return next;
|
|
4756
4826
|
});
|
|
4757
4827
|
}, []);
|
|
4758
|
-
const submit =
|
|
4828
|
+
const submit = useCallback10(async () => {
|
|
4759
4829
|
if (!editing || pendingUploads.length > 0) return;
|
|
4760
4830
|
setIsSaving(true);
|
|
4761
4831
|
setSaveError(void 0);
|
|
@@ -4772,7 +4842,7 @@ function useQuickRepliesWorkspace({
|
|
|
4772
4842
|
setFieldErrors(result.fieldErrors);
|
|
4773
4843
|
if (result.outcome === "rejected") setSaveError(result.formError);
|
|
4774
4844
|
}, [editing, api, labels, pendingUploads.length]);
|
|
4775
|
-
const remove =
|
|
4845
|
+
const remove = useCallback10(
|
|
4776
4846
|
async (id) => {
|
|
4777
4847
|
if (!api.deleteQuickReply) return;
|
|
4778
4848
|
setDeletingId(id);
|
|
@@ -4785,12 +4855,12 @@ function useQuickRepliesWorkspace({
|
|
|
4785
4855
|
},
|
|
4786
4856
|
[api]
|
|
4787
4857
|
);
|
|
4788
|
-
const removeAttachment =
|
|
4858
|
+
const removeAttachment = useCallback10((uploadId) => {
|
|
4789
4859
|
setEditing(
|
|
4790
4860
|
(current) => current ? { ...current, attachments: current.attachments.filter((attachment) => attachment.uploadId !== uploadId) } : current
|
|
4791
4861
|
);
|
|
4792
4862
|
}, []);
|
|
4793
|
-
const moveAttachmentAt =
|
|
4863
|
+
const moveAttachmentAt = useCallback10((index, direction) => {
|
|
4794
4864
|
setEditing(
|
|
4795
4865
|
(current) => current ? { ...current, attachments: moveAttachment(current.attachments, index, direction) } : current
|
|
4796
4866
|
);
|
|
@@ -4968,7 +5038,7 @@ function changedRange(previous, next) {
|
|
|
4968
5038
|
|
|
4969
5039
|
// src/quickReplies/QuickReplyFormattingToolbar.tsx
|
|
4970
5040
|
import { Bold as Bold3, Code as Code2, Italic as Italic3, List, ListOrdered, Quote, SquareCode, Strikethrough as Strikethrough3 } from "lucide-react";
|
|
4971
|
-
import { jsx as
|
|
5041
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4972
5042
|
function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
4973
5043
|
const buttons = [
|
|
4974
5044
|
{ action: QUICK_REPLY_FORMATTING_ACTION.BOLD, label: labels.formatBold, Icon: Bold3 },
|
|
@@ -4980,7 +5050,7 @@ function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
|
4980
5050
|
{ action: QUICK_REPLY_FORMATTING_ACTION.NUMBERED_LIST, label: labels.formatNumberedList, Icon: ListOrdered },
|
|
4981
5051
|
{ action: QUICK_REPLY_FORMATTING_ACTION.QUOTE, label: labels.formatQuote, Icon: Quote }
|
|
4982
5052
|
];
|
|
4983
|
-
return /* @__PURE__ */
|
|
5053
|
+
return /* @__PURE__ */ jsx26("div", { role: "toolbar", "aria-label": labels.formattingToolbar, className: "flex flex-wrap gap-1", children: buttons.map(({ action, label, Icon }) => /* @__PURE__ */ jsx26(
|
|
4984
5054
|
"button",
|
|
4985
5055
|
{
|
|
4986
5056
|
type: "button",
|
|
@@ -4989,7 +5059,7 @@ function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
|
4989
5059
|
onMouseDown: (event) => event.preventDefault(),
|
|
4990
5060
|
onClick: () => onFormat(action),
|
|
4991
5061
|
className: cn(COMPOSER_TOOL_BUTTON_CLASS, COMPOSER_TOOL_BUTTON_IDLE_CLASS),
|
|
4992
|
-
children: /* @__PURE__ */
|
|
5062
|
+
children: /* @__PURE__ */ jsx26(Icon, { size: 16, "aria-hidden": "true" })
|
|
4993
5063
|
},
|
|
4994
5064
|
action
|
|
4995
5065
|
)) });
|
|
@@ -4997,7 +5067,7 @@ function QuickReplyFormattingToolbar({ labels, onFormat }) {
|
|
|
4997
5067
|
|
|
4998
5068
|
// src/quickReplies/QuickReplyWhatsAppPreview.tsx
|
|
4999
5069
|
import { Paperclip as Paperclip2 } from "lucide-react";
|
|
5000
|
-
import { jsx as
|
|
5070
|
+
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5001
5071
|
function resolvePreviewVariables(body, variables = []) {
|
|
5002
5072
|
return variables.reduce(
|
|
5003
5073
|
(resolved, variable) => variable.marker ? resolved.split(variable.marker).join(variable.value || variable.label) : resolved,
|
|
@@ -5007,21 +5077,21 @@ function resolvePreviewVariables(body, variables = []) {
|
|
|
5007
5077
|
function QuickReplyWhatsAppPreview({ body, variables, attachments, labels }) {
|
|
5008
5078
|
const resolvedBody = resolvePreviewVariables(body, variables);
|
|
5009
5079
|
const hasAttachments = (attachments?.length ?? 0) > 0;
|
|
5010
|
-
return /* @__PURE__ */
|
|
5011
|
-
/* @__PURE__ */
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
hasAttachments ? /* @__PURE__ */
|
|
5080
|
+
return /* @__PURE__ */ jsxs23("section", { "aria-label": labels.previewTitle, className: "space-y-1", children: [
|
|
5081
|
+
/* @__PURE__ */ jsx27("h3", { className: "text-sm font-medium", children: labels.previewTitle }),
|
|
5082
|
+
/* @__PURE__ */ jsxs23(WhatsAppMessagePreview, { children: [
|
|
5083
|
+
hasAttachments ? /* @__PURE__ */ jsx27("ul", { className: "mb-1.5 flex flex-wrap gap-1 whitespace-normal", children: attachments?.map((attachment) => /* @__PURE__ */ jsxs23(
|
|
5014
5084
|
"li",
|
|
5015
5085
|
{
|
|
5016
5086
|
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",
|
|
5017
5087
|
children: [
|
|
5018
|
-
/* @__PURE__ */
|
|
5019
|
-
/* @__PURE__ */
|
|
5088
|
+
/* @__PURE__ */ jsx27(Paperclip2, { size: 12, "aria-hidden": "true", className: "shrink-0" }),
|
|
5089
|
+
/* @__PURE__ */ jsx27("span", { className: "truncate", children: attachment.filename })
|
|
5020
5090
|
]
|
|
5021
5091
|
},
|
|
5022
5092
|
attachment.uploadId
|
|
5023
5093
|
)) }) : null,
|
|
5024
|
-
resolvedBody ? parseWhatsAppFormatting(resolvedBody) : /* @__PURE__ */
|
|
5094
|
+
resolvedBody ? parseWhatsAppFormatting(resolvedBody) : /* @__PURE__ */ jsx27("span", { className: "italic text-gray-400", children: labels.previewEmptyBody })
|
|
5025
5095
|
] })
|
|
5026
5096
|
] });
|
|
5027
5097
|
}
|
|
@@ -5029,7 +5099,7 @@ function QuickReplyWhatsAppPreview({ body, variables, attachments, labels }) {
|
|
|
5029
5099
|
// src/quickReplies/AttachmentsFormSection.tsx
|
|
5030
5100
|
import { useRef as useRef11 } from "react";
|
|
5031
5101
|
import { Paperclip as Paperclip3, X as X4 } from "lucide-react";
|
|
5032
|
-
import { Fragment as Fragment7, jsx as
|
|
5102
|
+
import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5033
5103
|
function AttachmentsFormSection({
|
|
5034
5104
|
labels: text,
|
|
5035
5105
|
attachments,
|
|
@@ -5043,18 +5113,18 @@ function AttachmentsFormSection({
|
|
|
5043
5113
|
onDismissRejections
|
|
5044
5114
|
}) {
|
|
5045
5115
|
const attachmentFileInputRef = useRef11(null);
|
|
5046
|
-
return /* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
attachments.length === 0 && pendingUploads.length === 0 ? /* @__PURE__ */
|
|
5049
|
-
attachments.map((attachment, index) => /* @__PURE__ */
|
|
5116
|
+
return /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
|
|
5117
|
+
/* @__PURE__ */ jsx28("span", { className: "block text-sm font-medium", children: text.attachmentsTitle }),
|
|
5118
|
+
attachments.length === 0 && pendingUploads.length === 0 ? /* @__PURE__ */ jsx28("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: text.attachmentsEmpty }) : /* @__PURE__ */ jsxs24("ul", { className: "space-y-1", children: [
|
|
5119
|
+
attachments.map((attachment, index) => /* @__PURE__ */ jsxs24(
|
|
5050
5120
|
"li",
|
|
5051
5121
|
{
|
|
5052
5122
|
className: "flex items-center gap-2 rounded-md border border-gray-200 px-2 py-1.5 text-xs dark:border-gray-700",
|
|
5053
5123
|
children: [
|
|
5054
|
-
/* @__PURE__ */
|
|
5055
|
-
/* @__PURE__ */
|
|
5056
|
-
/* @__PURE__ */
|
|
5057
|
-
/* @__PURE__ */
|
|
5124
|
+
/* @__PURE__ */ jsx28(Paperclip3, { "aria-hidden": "true", className: "h-3.5 w-3.5 flex-none text-gray-400" }),
|
|
5125
|
+
/* @__PURE__ */ jsx28("span", { className: "min-w-0 flex-1 truncate", children: attachment.filename }),
|
|
5126
|
+
/* @__PURE__ */ jsx28("span", { className: "flex-none text-gray-400", children: formatFileSize(attachment.sizeBytes) }),
|
|
5127
|
+
/* @__PURE__ */ jsx28(
|
|
5058
5128
|
"button",
|
|
5059
5129
|
{
|
|
5060
5130
|
type: "button",
|
|
@@ -5065,7 +5135,7 @@ function AttachmentsFormSection({
|
|
|
5065
5135
|
children: "\u2191"
|
|
5066
5136
|
}
|
|
5067
5137
|
),
|
|
5068
|
-
/* @__PURE__ */
|
|
5138
|
+
/* @__PURE__ */ jsx28(
|
|
5069
5139
|
"button",
|
|
5070
5140
|
{
|
|
5071
5141
|
type: "button",
|
|
@@ -5076,32 +5146,32 @@ function AttachmentsFormSection({
|
|
|
5076
5146
|
children: "\u2193"
|
|
5077
5147
|
}
|
|
5078
5148
|
),
|
|
5079
|
-
/* @__PURE__ */
|
|
5149
|
+
/* @__PURE__ */ jsx28(
|
|
5080
5150
|
"button",
|
|
5081
5151
|
{
|
|
5082
5152
|
type: "button",
|
|
5083
5153
|
"aria-label": text.attachmentRemove,
|
|
5084
5154
|
onClick: () => onRemoveAttachment(attachment.uploadId),
|
|
5085
5155
|
className: "flex-none text-red-600 dark:text-red-400",
|
|
5086
|
-
children: /* @__PURE__ */
|
|
5156
|
+
children: /* @__PURE__ */ jsx28(X4, { "aria-hidden": "true", className: "h-3.5 w-3.5" })
|
|
5087
5157
|
}
|
|
5088
5158
|
)
|
|
5089
5159
|
]
|
|
5090
5160
|
},
|
|
5091
5161
|
attachment.uploadId
|
|
5092
5162
|
)),
|
|
5093
|
-
pendingUploads.map((pending) => /* @__PURE__ */
|
|
5163
|
+
pendingUploads.map((pending) => /* @__PURE__ */ jsxs24(
|
|
5094
5164
|
"li",
|
|
5095
5165
|
{
|
|
5096
5166
|
className: "flex items-center gap-2 rounded-md border border-gray-200 px-2 py-1.5 text-xs dark:border-gray-700",
|
|
5097
5167
|
"aria-busy": pending.status === "uploading",
|
|
5098
5168
|
"aria-live": "polite",
|
|
5099
5169
|
children: [
|
|
5100
|
-
/* @__PURE__ */
|
|
5101
|
-
/* @__PURE__ */
|
|
5102
|
-
pending.status === "uploading" ? /* @__PURE__ */
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5170
|
+
/* @__PURE__ */ jsx28(Paperclip3, { "aria-hidden": "true", className: "h-3.5 w-3.5 flex-none text-gray-400" }),
|
|
5171
|
+
/* @__PURE__ */ jsx28("span", { className: "min-w-0 flex-1 truncate", children: pending.file.name }),
|
|
5172
|
+
pending.status === "uploading" ? /* @__PURE__ */ jsx28("span", { className: "flex-none text-gray-500 dark:text-gray-400", children: text.attachmentUploading(Math.round(pending.progress * 100)) }) : /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5173
|
+
/* @__PURE__ */ jsx28("span", { role: "alert", className: "flex-none text-red-600 dark:text-red-400", children: pending.error }),
|
|
5174
|
+
/* @__PURE__ */ jsx28(
|
|
5105
5175
|
"button",
|
|
5106
5176
|
{
|
|
5107
5177
|
type: "button",
|
|
@@ -5111,14 +5181,14 @@ function AttachmentsFormSection({
|
|
|
5111
5181
|
}
|
|
5112
5182
|
)
|
|
5113
5183
|
] }),
|
|
5114
|
-
/* @__PURE__ */
|
|
5184
|
+
/* @__PURE__ */ jsx28(
|
|
5115
5185
|
"button",
|
|
5116
5186
|
{
|
|
5117
5187
|
type: "button",
|
|
5118
5188
|
"aria-label": text.attachmentCancel,
|
|
5119
5189
|
onClick: () => onCancelUpload(pending.localId),
|
|
5120
5190
|
className: "flex-none text-gray-400",
|
|
5121
|
-
children: /* @__PURE__ */
|
|
5191
|
+
children: /* @__PURE__ */ jsx28(X4, { "aria-hidden": "true", className: "h-3.5 w-3.5" })
|
|
5122
5192
|
}
|
|
5123
5193
|
)
|
|
5124
5194
|
]
|
|
@@ -5126,11 +5196,11 @@ function AttachmentsFormSection({
|
|
|
5126
5196
|
pending.localId
|
|
5127
5197
|
))
|
|
5128
5198
|
] }),
|
|
5129
|
-
attachmentRejections.length > 0 ? /* @__PURE__ */
|
|
5130
|
-
attachmentRejections.map((rejection, index) => /* @__PURE__ */
|
|
5131
|
-
/* @__PURE__ */
|
|
5199
|
+
attachmentRejections.length > 0 ? /* @__PURE__ */ jsxs24("div", { role: "alert", className: "space-y-0.5 text-xs text-red-600 dark:text-red-400", children: [
|
|
5200
|
+
attachmentRejections.map((rejection, index) => /* @__PURE__ */ jsx28("p", { children: rejection.reason === "limit" ? text.attachmentLimitReached : text.attachmentTooLarge(rejection.file.name) }, index)),
|
|
5201
|
+
/* @__PURE__ */ jsx28("button", { type: "button", onClick: onDismissRejections, className: "hover:underline", children: text.cancel })
|
|
5132
5202
|
] }) : null,
|
|
5133
|
-
/* @__PURE__ */
|
|
5203
|
+
/* @__PURE__ */ jsx28(
|
|
5134
5204
|
"input",
|
|
5135
5205
|
{
|
|
5136
5206
|
ref: attachmentFileInputRef,
|
|
@@ -5143,7 +5213,7 @@ function AttachmentsFormSection({
|
|
|
5143
5213
|
}
|
|
5144
5214
|
}
|
|
5145
5215
|
),
|
|
5146
|
-
/* @__PURE__ */
|
|
5216
|
+
/* @__PURE__ */ jsx28(
|
|
5147
5217
|
"button",
|
|
5148
5218
|
{
|
|
5149
5219
|
type: "button",
|
|
@@ -5156,7 +5226,7 @@ function AttachmentsFormSection({
|
|
|
5156
5226
|
}
|
|
5157
5227
|
|
|
5158
5228
|
// src/quickReplies/QuickRepliesWorkspace.tsx
|
|
5159
|
-
import { jsx as
|
|
5229
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5160
5230
|
var TABLE_SKELETON_ROWS = 3;
|
|
5161
5231
|
function replaceWithNativeUndo(field, previous, next) {
|
|
5162
5232
|
if (!canExecuteFormattingCommand()) return false;
|
|
@@ -5182,7 +5252,7 @@ function QuickRepliesWorkspace({
|
|
|
5182
5252
|
const titleFieldId = `${formId}-title`;
|
|
5183
5253
|
const shortcutFieldId = `${formId}-shortcut`;
|
|
5184
5254
|
const bodyFieldId = `${formId}-body`;
|
|
5185
|
-
const [confirmingDeleteId, setConfirmingDeleteId] =
|
|
5255
|
+
const [confirmingDeleteId, setConfirmingDeleteId] = useState19(null);
|
|
5186
5256
|
const deleteButtonRefs = useRef12({});
|
|
5187
5257
|
const confirmButtonRef = useRef12(null);
|
|
5188
5258
|
useEffect14(() => {
|
|
@@ -5272,14 +5342,14 @@ function QuickRepliesWorkspace({
|
|
|
5272
5342
|
event.preventDefault();
|
|
5273
5343
|
applyFormatting(action);
|
|
5274
5344
|
};
|
|
5275
|
-
return /* @__PURE__ */
|
|
5276
|
-
/* @__PURE__ */
|
|
5277
|
-
/* @__PURE__ */
|
|
5278
|
-
/* @__PURE__ */
|
|
5345
|
+
return /* @__PURE__ */ jsxs25("div", { className: cn("space-y-4", className), children: [
|
|
5346
|
+
/* @__PURE__ */ jsxs25("header", { className: "space-y-0.5", children: [
|
|
5347
|
+
/* @__PURE__ */ jsx29("h2", { className: "text-lg font-semibold", children: text.title }),
|
|
5348
|
+
/* @__PURE__ */ jsx29("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: text.subtitle(quickReplies.length) })
|
|
5279
5349
|
] }),
|
|
5280
|
-
readOnly ? /* @__PURE__ */
|
|
5281
|
-
/* @__PURE__ */
|
|
5282
|
-
/* @__PURE__ */
|
|
5350
|
+
readOnly ? /* @__PURE__ */ jsx29("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: text.readOnlyNotice }) : null,
|
|
5351
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5352
|
+
/* @__PURE__ */ jsx29(
|
|
5283
5353
|
"input",
|
|
5284
5354
|
{
|
|
5285
5355
|
type: "search",
|
|
@@ -5290,22 +5360,22 @@ function QuickRepliesWorkspace({
|
|
|
5290
5360
|
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"
|
|
5291
5361
|
}
|
|
5292
5362
|
),
|
|
5293
|
-
!readOnly ? /* @__PURE__ */
|
|
5363
|
+
!readOnly ? /* @__PURE__ */ jsxs25(
|
|
5294
5364
|
"button",
|
|
5295
5365
|
{
|
|
5296
5366
|
type: "button",
|
|
5297
5367
|
onClick: startCreate,
|
|
5298
5368
|
className: "cv-header-action cv-header-action--primary ml-auto inline-flex items-center gap-1",
|
|
5299
5369
|
children: [
|
|
5300
|
-
/* @__PURE__ */
|
|
5370
|
+
/* @__PURE__ */ jsx29(Plus2, { size: 14, "aria-hidden": "true" }),
|
|
5301
5371
|
text.create
|
|
5302
5372
|
]
|
|
5303
5373
|
}
|
|
5304
5374
|
) : null
|
|
5305
5375
|
] }),
|
|
5306
|
-
isLoading ? /* @__PURE__ */
|
|
5307
|
-
loadError ? /* @__PURE__ */
|
|
5308
|
-
editing ? /* @__PURE__ */
|
|
5376
|
+
isLoading ? /* @__PURE__ */ jsx29("span", { className: "sr-only", "aria-live": "polite", children: text.loading }) : null,
|
|
5377
|
+
loadError ? /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-sm text-red-600 dark:text-red-400", children: loadError || text.failure }) : null,
|
|
5378
|
+
editing ? /* @__PURE__ */ jsxs25(
|
|
5309
5379
|
"form",
|
|
5310
5380
|
{
|
|
5311
5381
|
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)]",
|
|
@@ -5314,10 +5384,10 @@ function QuickRepliesWorkspace({
|
|
|
5314
5384
|
void submit();
|
|
5315
5385
|
},
|
|
5316
5386
|
children: [
|
|
5317
|
-
/* @__PURE__ */
|
|
5318
|
-
/* @__PURE__ */
|
|
5319
|
-
/* @__PURE__ */
|
|
5320
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-3", children: [
|
|
5388
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-1", children: [
|
|
5389
|
+
/* @__PURE__ */ jsx29("label", { className: "block text-sm font-medium", htmlFor: titleFieldId, children: text.fieldTitle }),
|
|
5390
|
+
/* @__PURE__ */ jsx29(
|
|
5321
5391
|
"input",
|
|
5322
5392
|
{
|
|
5323
5393
|
id: titleFieldId,
|
|
@@ -5330,11 +5400,11 @@ function QuickRepliesWorkspace({
|
|
|
5330
5400
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-gray-700 dark:bg-gray-900"
|
|
5331
5401
|
}
|
|
5332
5402
|
),
|
|
5333
|
-
fieldErrors.title ? /* @__PURE__ */
|
|
5403
|
+
fieldErrors.title ? /* @__PURE__ */ jsx29("p", { id: `${titleFieldId}-error`, role: "alert", className: "text-xs text-red-600 dark:text-red-400", children: fieldErrors.title }) : null
|
|
5334
5404
|
] }),
|
|
5335
|
-
/* @__PURE__ */
|
|
5336
|
-
/* @__PURE__ */
|
|
5337
|
-
/* @__PURE__ */
|
|
5405
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-1", children: [
|
|
5406
|
+
/* @__PURE__ */ jsx29("label", { className: "block text-sm font-medium", htmlFor: shortcutFieldId, children: text.fieldShortcut }),
|
|
5407
|
+
/* @__PURE__ */ jsx29(
|
|
5338
5408
|
"input",
|
|
5339
5409
|
{
|
|
5340
5410
|
id: shortcutFieldId,
|
|
@@ -5347,12 +5417,12 @@ function QuickRepliesWorkspace({
|
|
|
5347
5417
|
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"
|
|
5348
5418
|
}
|
|
5349
5419
|
),
|
|
5350
|
-
fieldErrors.shortcut ? /* @__PURE__ */
|
|
5420
|
+
fieldErrors.shortcut ? /* @__PURE__ */ jsx29("p", { id: `${shortcutFieldId}-error`, role: "alert", className: "text-xs text-red-600 dark:text-red-400", children: fieldErrors.shortcut }) : /* @__PURE__ */ jsx29("p", { id: `${shortcutFieldId}-hint`, className: "text-xs text-gray-400", children: text.fieldShortcutHint })
|
|
5351
5421
|
] }),
|
|
5352
|
-
/* @__PURE__ */
|
|
5353
|
-
/* @__PURE__ */
|
|
5354
|
-
/* @__PURE__ */
|
|
5355
|
-
/* @__PURE__ */
|
|
5422
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-1", children: [
|
|
5423
|
+
/* @__PURE__ */ jsx29("label", { className: "block text-sm font-medium", htmlFor: bodyFieldId, children: text.fieldBody }),
|
|
5424
|
+
/* @__PURE__ */ jsx29(QuickReplyFormattingToolbar, { labels: text, onFormat: applyFormatting }),
|
|
5425
|
+
/* @__PURE__ */ jsx29(
|
|
5356
5426
|
"textarea",
|
|
5357
5427
|
{
|
|
5358
5428
|
id: bodyFieldId,
|
|
@@ -5367,8 +5437,8 @@ function QuickRepliesWorkspace({
|
|
|
5367
5437
|
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"
|
|
5368
5438
|
}
|
|
5369
5439
|
),
|
|
5370
|
-
fieldErrors.body ? /* @__PURE__ */
|
|
5371
|
-
variables && variables.length > 0 ? /* @__PURE__ */
|
|
5440
|
+
fieldErrors.body ? /* @__PURE__ */ jsx29("p", { id: `${bodyFieldId}-error`, role: "alert", className: "text-xs text-red-600 dark:text-red-400", children: fieldErrors.body }) : null,
|
|
5441
|
+
variables && variables.length > 0 ? /* @__PURE__ */ jsx29("div", { className: "flex flex-wrap gap-1 pt-1", children: variables.map((variable) => /* @__PURE__ */ jsx29(
|
|
5372
5442
|
"button",
|
|
5373
5443
|
{
|
|
5374
5444
|
type: "button",
|
|
@@ -5380,7 +5450,7 @@ function QuickRepliesWorkspace({
|
|
|
5380
5450
|
variable.id
|
|
5381
5451
|
)) }) : null
|
|
5382
5452
|
] }),
|
|
5383
|
-
hasAttachmentsCapability ? /* @__PURE__ */
|
|
5453
|
+
hasAttachmentsCapability ? /* @__PURE__ */ jsx29(
|
|
5384
5454
|
AttachmentsFormSection,
|
|
5385
5455
|
{
|
|
5386
5456
|
labels: text,
|
|
@@ -5395,9 +5465,9 @@ function QuickRepliesWorkspace({
|
|
|
5395
5465
|
onDismissRejections: dismissAttachmentRejections
|
|
5396
5466
|
}
|
|
5397
5467
|
) : null,
|
|
5398
|
-
saveError ? /* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5400
|
-
/* @__PURE__ */
|
|
5468
|
+
saveError ? /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-sm text-red-600 dark:text-red-400", children: saveError }) : null,
|
|
5469
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
|
|
5470
|
+
/* @__PURE__ */ jsx29(
|
|
5401
5471
|
"button",
|
|
5402
5472
|
{
|
|
5403
5473
|
type: "submit",
|
|
@@ -5408,10 +5478,10 @@ function QuickRepliesWorkspace({
|
|
|
5408
5478
|
children: isSaving ? text.saving : hasPendingUploads ? text.saveBlockedUploading : text.save
|
|
5409
5479
|
}
|
|
5410
5480
|
),
|
|
5411
|
-
/* @__PURE__ */
|
|
5481
|
+
/* @__PURE__ */ jsx29("button", { type: "button", onClick: cancelEdit, className: "text-sm text-gray-500 hover:underline", children: text.cancel })
|
|
5412
5482
|
] })
|
|
5413
5483
|
] }),
|
|
5414
|
-
/* @__PURE__ */
|
|
5484
|
+
/* @__PURE__ */ jsx29(
|
|
5415
5485
|
QuickReplyWhatsAppPreview,
|
|
5416
5486
|
{
|
|
5417
5487
|
body: editing.body,
|
|
@@ -5423,29 +5493,29 @@ function QuickRepliesWorkspace({
|
|
|
5423
5493
|
]
|
|
5424
5494
|
}
|
|
5425
5495
|
) : null,
|
|
5426
|
-
/* @__PURE__ */
|
|
5427
|
-
/* @__PURE__ */
|
|
5428
|
-
/* @__PURE__ */
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
/* @__PURE__ */
|
|
5431
|
-
!readOnly ? /* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsx29("div", { className: "cv-table-card", children: /* @__PURE__ */ jsxs25("table", { className: "cv-table", children: [
|
|
5497
|
+
/* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs25("tr", { children: [
|
|
5498
|
+
/* @__PURE__ */ jsx29("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: text.columnTitle }),
|
|
5499
|
+
/* @__PURE__ */ jsx29("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: text.columnShortcut }),
|
|
5500
|
+
/* @__PURE__ */ jsx29("th", { scope: "col", className: "hidden px-3 py-2 text-left text-xs font-medium sm:table-cell", children: text.columnBody }),
|
|
5501
|
+
!readOnly ? /* @__PURE__ */ jsx29("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: text.columnActions }) : null
|
|
5432
5502
|
] }) }),
|
|
5433
|
-
/* @__PURE__ */
|
|
5434
|
-
isLoading ? Array.from({ length: TABLE_SKELETON_ROWS }).map((_, index) => /* @__PURE__ */
|
|
5435
|
-
/* @__PURE__ */
|
|
5436
|
-
/* @__PURE__ */
|
|
5437
|
-
/* @__PURE__ */
|
|
5438
|
-
!readOnly ? /* @__PURE__ */
|
|
5439
|
-
] }, index)) : filtered.length === 0 ? /* @__PURE__ */
|
|
5440
|
-
!isLoading && filtered.map((quickReply) => /* @__PURE__ */
|
|
5441
|
-
/* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5503
|
+
/* @__PURE__ */ jsxs25("tbody", { children: [
|
|
5504
|
+
isLoading ? Array.from({ length: TABLE_SKELETON_ROWS }).map((_, index) => /* @__PURE__ */ jsxs25("tr", { "aria-hidden": "true", children: [
|
|
5505
|
+
/* @__PURE__ */ jsx29("td", { className: "px-3 py-3", children: /* @__PURE__ */ jsx29("span", { className: "cv-skeleton-line cv-skeleton-line--title block" }) }),
|
|
5506
|
+
/* @__PURE__ */ jsx29("td", { className: "px-3 py-3", children: /* @__PURE__ */ jsx29("span", { className: "cv-skeleton-line cv-skeleton-line--shortcut block" }) }),
|
|
5507
|
+
/* @__PURE__ */ jsx29("td", { className: "hidden px-3 py-3 sm:table-cell", children: /* @__PURE__ */ jsx29("span", { className: "cv-skeleton-line cv-skeleton-line--body block" }) }),
|
|
5508
|
+
!readOnly ? /* @__PURE__ */ jsx29("td", { className: "px-3 py-3" }) : null
|
|
5509
|
+
] }, index)) : filtered.length === 0 ? /* @__PURE__ */ jsx29("tr", { children: /* @__PURE__ */ jsx29("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,
|
|
5510
|
+
!isLoading && filtered.map((quickReply) => /* @__PURE__ */ jsxs25("tr", { className: cn(deletingId === quickReply.id ? "cv-row-departing" : void 0), children: [
|
|
5511
|
+
/* @__PURE__ */ jsx29("td", { className: "px-3 py-2 font-medium", children: quickReply.title }),
|
|
5512
|
+
/* @__PURE__ */ jsxs25("td", { className: "px-3 py-2 font-mono text-xs text-gray-500", children: [
|
|
5443
5513
|
"/",
|
|
5444
5514
|
quickReply.shortcut
|
|
5445
5515
|
] }),
|
|
5446
|
-
/* @__PURE__ */
|
|
5447
|
-
!readOnly ? /* @__PURE__ */
|
|
5448
|
-
canEdit ? /* @__PURE__ */
|
|
5516
|
+
/* @__PURE__ */ jsx29("td", { className: "hidden max-w-sm truncate px-3 py-2 text-gray-500 sm:table-cell", children: quickReply.body }),
|
|
5517
|
+
!readOnly ? /* @__PURE__ */ jsx29("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
|
|
5518
|
+
canEdit ? /* @__PURE__ */ jsx29(
|
|
5449
5519
|
"button",
|
|
5450
5520
|
{
|
|
5451
5521
|
type: "button",
|
|
@@ -5453,13 +5523,13 @@ function QuickRepliesWorkspace({
|
|
|
5453
5523
|
"data-cv-tooltip": text.edit,
|
|
5454
5524
|
"aria-label": `${text.edit}: ${quickReply.title}`,
|
|
5455
5525
|
className: "cv-header-icon",
|
|
5456
|
-
children: /* @__PURE__ */
|
|
5526
|
+
children: /* @__PURE__ */ jsx29(Pencil2, { size: 14, "aria-hidden": "true" })
|
|
5457
5527
|
}
|
|
5458
5528
|
) : null,
|
|
5459
5529
|
canDelete ? confirmingDeleteId === quickReply.id ? (
|
|
5460
5530
|
// Linha de confirmação inline em vez de `window.confirm`: trava a aba
|
|
5461
5531
|
// inteira e não segue os tokens visuais do pacote (`web.md` §14).
|
|
5462
|
-
/* @__PURE__ */
|
|
5532
|
+
/* @__PURE__ */ jsxs25(
|
|
5463
5533
|
"span",
|
|
5464
5534
|
{
|
|
5465
5535
|
role: "group",
|
|
@@ -5468,7 +5538,7 @@ function QuickRepliesWorkspace({
|
|
|
5468
5538
|
className: "flex items-center gap-2 text-xs",
|
|
5469
5539
|
children: [
|
|
5470
5540
|
text.removeConfirm(quickReply.title),
|
|
5471
|
-
/* @__PURE__ */
|
|
5541
|
+
/* @__PURE__ */ jsxs25(
|
|
5472
5542
|
"button",
|
|
5473
5543
|
{
|
|
5474
5544
|
ref: confirmButtonRef,
|
|
@@ -5479,12 +5549,12 @@ function QuickRepliesWorkspace({
|
|
|
5479
5549
|
},
|
|
5480
5550
|
className: "cv-header-action cv-header-action--danger inline-flex items-center gap-1",
|
|
5481
5551
|
children: [
|
|
5482
|
-
/* @__PURE__ */
|
|
5552
|
+
/* @__PURE__ */ jsx29(Trash23, { size: 12, "aria-hidden": "true" }),
|
|
5483
5553
|
text.remove
|
|
5484
5554
|
]
|
|
5485
5555
|
}
|
|
5486
5556
|
),
|
|
5487
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsx29(
|
|
5488
5558
|
"button",
|
|
5489
5559
|
{
|
|
5490
5560
|
type: "button",
|
|
@@ -5496,7 +5566,7 @@ function QuickRepliesWorkspace({
|
|
|
5496
5566
|
]
|
|
5497
5567
|
}
|
|
5498
5568
|
)
|
|
5499
|
-
) : /* @__PURE__ */
|
|
5569
|
+
) : /* @__PURE__ */ jsx29(
|
|
5500
5570
|
"button",
|
|
5501
5571
|
{
|
|
5502
5572
|
ref: (node) => {
|
|
@@ -5509,7 +5579,7 @@ function QuickRepliesWorkspace({
|
|
|
5509
5579
|
"data-cv-tooltip": deletingId === quickReply.id ? text.deleting : text.remove,
|
|
5510
5580
|
"aria-label": `${deletingId === quickReply.id ? text.deleting : text.remove}: ${quickReply.title}`,
|
|
5511
5581
|
className: "cv-header-icon disabled:opacity-40",
|
|
5512
|
-
children: /* @__PURE__ */
|
|
5582
|
+
children: /* @__PURE__ */ jsx29(Trash23, { size: 14, "aria-hidden": "true", className: "text-red-500" })
|
|
5513
5583
|
}
|
|
5514
5584
|
) : null
|
|
5515
5585
|
] }) }) : null
|
|
@@ -5520,12 +5590,12 @@ function QuickRepliesWorkspace({
|
|
|
5520
5590
|
}
|
|
5521
5591
|
|
|
5522
5592
|
// src/workspace/ConversationsWorkspace.tsx
|
|
5523
|
-
import { useEffect as useEffect20, useMemo as useMemo7, useState as
|
|
5593
|
+
import { useEffect as useEffect20, useMemo as useMemo7, useState as useState26 } from "react";
|
|
5524
5594
|
import { Check as Check2, CheckCheck, FlaskConical, Hourglass as Hourglass2, Mail as Mail2, MessagesSquare } from "lucide-react";
|
|
5525
5595
|
|
|
5526
5596
|
// src/workspace/BulkTemplateModal.tsx
|
|
5527
|
-
import { useEffect as useEffect15, useMemo as useMemo5, useState as
|
|
5528
|
-
import { jsx as
|
|
5597
|
+
import { useEffect as useEffect15, useMemo as useMemo5, useState as useState20 } from "react";
|
|
5598
|
+
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5529
5599
|
function BulkTemplateModal({
|
|
5530
5600
|
labels,
|
|
5531
5601
|
expiredCount,
|
|
@@ -5538,9 +5608,9 @@ function BulkTemplateModal({
|
|
|
5538
5608
|
throw new Error("BulkTemplateModal requires an ancestor <ConversationsProvider>");
|
|
5539
5609
|
}
|
|
5540
5610
|
const { api } = context;
|
|
5541
|
-
const [templates, setTemplates] =
|
|
5542
|
-
const [search, setSearch] =
|
|
5543
|
-
const [selected, setSelected] =
|
|
5611
|
+
const [templates, setTemplates] = useState20([]);
|
|
5612
|
+
const [search, setSearch] = useState20("");
|
|
5613
|
+
const [selected, setSelected] = useState20("");
|
|
5544
5614
|
useEffect15(() => {
|
|
5545
5615
|
let active = true;
|
|
5546
5616
|
void api.listTemplates?.().then((loaded) => {
|
|
@@ -5556,15 +5626,15 @@ function BulkTemplateModal({
|
|
|
5556
5626
|
if (!term) return templates;
|
|
5557
5627
|
return templates.filter((template) => template.name.toLowerCase().includes(term));
|
|
5558
5628
|
}, [templates, search]);
|
|
5559
|
-
return /* @__PURE__ */
|
|
5560
|
-
/* @__PURE__ */
|
|
5561
|
-
/* @__PURE__ */
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
/* @__PURE__ */
|
|
5629
|
+
return /* @__PURE__ */ jsx30("div", { className: "cv-workspace-modal", role: "dialog", "aria-modal": "true", "aria-label": labels.templateModalTitle, children: /* @__PURE__ */ jsxs26("div", { className: "cv-workspace-modal__box", children: [
|
|
5630
|
+
/* @__PURE__ */ jsxs26("header", { className: "cv-workspace-modal__header", children: [
|
|
5631
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
5632
|
+
/* @__PURE__ */ jsx30("h3", { children: labels.templateModalTitle }),
|
|
5633
|
+
/* @__PURE__ */ jsx30("p", { children: labels.templateModalAvailable(templates.length) })
|
|
5564
5634
|
] }),
|
|
5565
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx30("button", { "data-cv-tooltip": labels.templateModalCancel, type: "button", onClick: onClose, "aria-label": labels.templateModalCancel, children: "\u2715" })
|
|
5566
5636
|
] }),
|
|
5567
|
-
/* @__PURE__ */
|
|
5637
|
+
/* @__PURE__ */ jsx30("div", { className: "cv-workspace-modal__search", children: /* @__PURE__ */ jsx30(
|
|
5568
5638
|
"input",
|
|
5569
5639
|
{
|
|
5570
5640
|
type: "search",
|
|
@@ -5574,9 +5644,9 @@ function BulkTemplateModal({
|
|
|
5574
5644
|
autoFocus: true
|
|
5575
5645
|
}
|
|
5576
5646
|
) }),
|
|
5577
|
-
/* @__PURE__ */
|
|
5578
|
-
filtered.length === 0 ? /* @__PURE__ */
|
|
5579
|
-
filtered.map((template) => /* @__PURE__ */
|
|
5647
|
+
/* @__PURE__ */ jsxs26("div", { className: "cv-workspace-modal__list", children: [
|
|
5648
|
+
filtered.length === 0 ? /* @__PURE__ */ jsx30("p", { className: "cv-workspace-empty", children: labels.templateModalEmpty }) : null,
|
|
5649
|
+
filtered.map((template) => /* @__PURE__ */ jsxs26(
|
|
5580
5650
|
"button",
|
|
5581
5651
|
{
|
|
5582
5652
|
"data-cv-tooltip": template.name,
|
|
@@ -5586,8 +5656,8 @@ function BulkTemplateModal({
|
|
|
5586
5656
|
"aria-pressed": template.name === selected,
|
|
5587
5657
|
className: `cv-workspace-modal__item${template.name === selected ? " cv-workspace-modal__item--on" : ""}`,
|
|
5588
5658
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5659
|
+
/* @__PURE__ */ jsx30("span", { className: "cv-workspace-modal__item-name", children: template.name }),
|
|
5660
|
+
/* @__PURE__ */ jsxs26("span", { className: "cv-workspace-modal__item-meta", children: [
|
|
5591
5661
|
template.language,
|
|
5592
5662
|
template.category ? ` \xB7 ${template.category.toLowerCase()}` : ""
|
|
5593
5663
|
] })
|
|
@@ -5596,10 +5666,10 @@ function BulkTemplateModal({
|
|
|
5596
5666
|
template.name
|
|
5597
5667
|
))
|
|
5598
5668
|
] }),
|
|
5599
|
-
expiredCount === 0 ? /* @__PURE__ */
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
/* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
5669
|
+
expiredCount === 0 ? /* @__PURE__ */ jsx30("p", { className: "cv-workspace-modal__warning", children: labels.templateModalNoneExpired }) : null,
|
|
5670
|
+
/* @__PURE__ */ jsxs26("footer", { className: "cv-workspace-modal__footer", children: [
|
|
5671
|
+
/* @__PURE__ */ jsx30("button", { "data-cv-tooltip": labels.templateModalCancel, "aria-label": labels.templateModalCancel, type: "button", onClick: onClose, children: labels.templateModalCancel }),
|
|
5672
|
+
/* @__PURE__ */ jsx30(
|
|
5603
5673
|
"button",
|
|
5604
5674
|
{
|
|
5605
5675
|
"data-cv-tooltip": sending ? labels.templateModalSending : labels.templateModalSend(expiredCount),
|
|
@@ -5615,10 +5685,10 @@ function BulkTemplateModal({
|
|
|
5615
5685
|
}
|
|
5616
5686
|
|
|
5617
5687
|
// src/workspace/ConversationPane.tsx
|
|
5618
|
-
import { useCallback as
|
|
5688
|
+
import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef17, useState as useState24 } from "react";
|
|
5619
5689
|
|
|
5620
5690
|
// src/hooks/useLoadOlderMessagesScroll.ts
|
|
5621
|
-
import { useCallback as
|
|
5691
|
+
import { useCallback as useCallback11, useLayoutEffect as useLayoutEffect2, useRef as useRef13 } from "react";
|
|
5622
5692
|
var NEAR_TOP_THRESHOLD_PX = 200;
|
|
5623
5693
|
function computeScrollTopAfterPrepend(before, scrollHeightAfter) {
|
|
5624
5694
|
return before.scrollTop + (scrollHeightAfter - before.scrollHeight);
|
|
@@ -5632,14 +5702,14 @@ function useLoadOlderMessagesScroll({
|
|
|
5632
5702
|
}) {
|
|
5633
5703
|
const pendingSnapshotRef = useRef13(null);
|
|
5634
5704
|
const previousOldestMessageIdRef = useRef13(oldestMessageId);
|
|
5635
|
-
const triggerLoadOlder =
|
|
5705
|
+
const triggerLoadOlder = useCallback11(() => {
|
|
5636
5706
|
if (loading || !hasMore) return;
|
|
5637
5707
|
const container = containerRef.current;
|
|
5638
5708
|
if (!container) return;
|
|
5639
5709
|
pendingSnapshotRef.current = { scrollHeight: container.scrollHeight, scrollTop: container.scrollTop };
|
|
5640
5710
|
onLoadOlder();
|
|
5641
5711
|
}, [containerRef, hasMore, loading, onLoadOlder]);
|
|
5642
|
-
const handleScroll =
|
|
5712
|
+
const handleScroll = useCallback11(
|
|
5643
5713
|
(event) => {
|
|
5644
5714
|
if (event.currentTarget.scrollTop > NEAR_TOP_THRESHOLD_PX) return;
|
|
5645
5715
|
triggerLoadOlder();
|
|
@@ -5677,8 +5747,8 @@ function resolveConversationVariables({
|
|
|
5677
5747
|
}
|
|
5678
5748
|
|
|
5679
5749
|
// src/workspace/QueuedAttachmentsList.tsx
|
|
5680
|
-
import { useEffect as useEffect16, useRef as useRef14, useState as
|
|
5681
|
-
import { jsx as
|
|
5750
|
+
import { useEffect as useEffect16, useRef as useRef14, useState as useState21 } from "react";
|
|
5751
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5682
5752
|
function nameOf(item) {
|
|
5683
5753
|
return item.kind === "local" ? item.file.name : item.filename;
|
|
5684
5754
|
}
|
|
@@ -5693,7 +5763,7 @@ function AttachmentThumbnail({
|
|
|
5693
5763
|
getThumbnailUrl
|
|
5694
5764
|
}) {
|
|
5695
5765
|
const isImage = mimeTypeOf(item).startsWith("image/");
|
|
5696
|
-
const [url, setUrl] =
|
|
5766
|
+
const [url, setUrl] = useState21(item.kind === "local" ? void 0 : item.previewUrl);
|
|
5697
5767
|
const localFile = item.kind === "local" ? item.file : void 0;
|
|
5698
5768
|
const uploadId = item.kind === "stored" ? item.uploadId : void 0;
|
|
5699
5769
|
useEffect16(() => {
|
|
@@ -5713,15 +5783,15 @@ function AttachmentThumbnail({
|
|
|
5713
5783
|
};
|
|
5714
5784
|
}, [isImage, uploadId, getThumbnailUrl]);
|
|
5715
5785
|
if (!isImage) return null;
|
|
5716
|
-
return /* @__PURE__ */
|
|
5786
|
+
return /* @__PURE__ */ jsx31("span", { className: "cv-attachment-item__thumbnail", "aria-hidden": "true", children: url ? /* @__PURE__ */ jsx31("img", { src: url, alt: "" }) : null });
|
|
5717
5787
|
}
|
|
5718
5788
|
function departedItemsOf(previouslyRendered, items) {
|
|
5719
5789
|
const currentKeys = new Set(items.map(attachmentKey));
|
|
5720
5790
|
return previouslyRendered.filter((item) => !currentKeys.has(attachmentKey(item)));
|
|
5721
5791
|
}
|
|
5722
5792
|
function useDepartingItems(items) {
|
|
5723
|
-
const [rendered, setRendered] =
|
|
5724
|
-
const [departingKeys, setDepartingKeys] =
|
|
5793
|
+
const [rendered, setRendered] = useState21(items);
|
|
5794
|
+
const [departingKeys, setDepartingKeys] = useState21(/* @__PURE__ */ new Set());
|
|
5725
5795
|
const renderedRef = useRef14(rendered);
|
|
5726
5796
|
renderedRef.current = rendered;
|
|
5727
5797
|
useEffect16(() => {
|
|
@@ -5760,25 +5830,25 @@ function QueuedAttachmentsList({
|
|
|
5760
5830
|
if (status === "skipped") return labels.skipped;
|
|
5761
5831
|
return labels.waiting;
|
|
5762
5832
|
};
|
|
5763
|
-
return /* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsx31("ul", { className: "cv-workspace-attachments", "aria-busy": busy, "aria-live": "polite", children: rendered.map((item) => {
|
|
5764
5834
|
const key = attachmentKey(item);
|
|
5765
5835
|
const status = statusOf2(key);
|
|
5766
5836
|
const isDeparting = departingKeys.has(key);
|
|
5767
|
-
return /* @__PURE__ */
|
|
5837
|
+
return /* @__PURE__ */ jsxs27(
|
|
5768
5838
|
"li",
|
|
5769
5839
|
{
|
|
5770
5840
|
className: `cv-attachment-item cv-attachment-item--${status}${isDeparting ? " cv-attachment-item--departing" : ""}`,
|
|
5771
5841
|
children: [
|
|
5772
|
-
/* @__PURE__ */
|
|
5773
|
-
/* @__PURE__ */
|
|
5774
|
-
/* @__PURE__ */
|
|
5775
|
-
/* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsx31(AttachmentThumbnail, { item, getThumbnailUrl }),
|
|
5843
|
+
/* @__PURE__ */ jsxs27("span", { className: "cv-attachment-item__info", children: [
|
|
5844
|
+
/* @__PURE__ */ jsx31("span", { className: "cv-attachment-item__name", children: nameOf(item) }),
|
|
5845
|
+
/* @__PURE__ */ jsxs27("span", { className: "cv-attachment-item__meta", children: [
|
|
5776
5846
|
formatFileSize(sizeOf(item)),
|
|
5777
5847
|
" \xB7 ",
|
|
5778
5848
|
statusLabelOf(status)
|
|
5779
5849
|
] })
|
|
5780
5850
|
] }),
|
|
5781
|
-
(status === "failed" || status === "skipped") && onRetry ? /* @__PURE__ */
|
|
5851
|
+
(status === "failed" || status === "skipped") && onRetry ? /* @__PURE__ */ jsx31(
|
|
5782
5852
|
"button",
|
|
5783
5853
|
{
|
|
5784
5854
|
type: "button",
|
|
@@ -5789,7 +5859,7 @@ function QueuedAttachmentsList({
|
|
|
5789
5859
|
children: labels.retry
|
|
5790
5860
|
}
|
|
5791
5861
|
) : null,
|
|
5792
|
-
/* @__PURE__ */
|
|
5862
|
+
/* @__PURE__ */ jsx31(
|
|
5793
5863
|
"button",
|
|
5794
5864
|
{
|
|
5795
5865
|
"data-cv-tooltip": labels.remove,
|
|
@@ -5808,10 +5878,10 @@ function QueuedAttachmentsList({
|
|
|
5808
5878
|
}
|
|
5809
5879
|
|
|
5810
5880
|
// src/workspace/useComposerQueue.ts
|
|
5811
|
-
import { useCallback as
|
|
5881
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useRef as useRef16, useState as useState23 } from "react";
|
|
5812
5882
|
|
|
5813
5883
|
// src/workspace/useComposerAttachmentRetry.ts
|
|
5814
|
-
import { useCallback as
|
|
5884
|
+
import { useCallback as useCallback12, useRef as useRef15, useState as useState22 } from "react";
|
|
5815
5885
|
function useComposerAttachmentRetry(params) {
|
|
5816
5886
|
const {
|
|
5817
5887
|
conversationId,
|
|
@@ -5827,7 +5897,7 @@ function useComposerAttachmentRetry(params) {
|
|
|
5827
5897
|
} = params;
|
|
5828
5898
|
const retryIdempotencyKeyRef = useRef15(void 0);
|
|
5829
5899
|
const retryingKeysRef = useRef15(/* @__PURE__ */ new Set());
|
|
5830
|
-
const [retryingKeys, setRetryingKeys] =
|
|
5900
|
+
const [retryingKeys, setRetryingKeys] = useState22(/* @__PURE__ */ new Set());
|
|
5831
5901
|
function markRetrying(key) {
|
|
5832
5902
|
retryingKeysRef.current.add(key);
|
|
5833
5903
|
setRetryingKeys(new Set(retryingKeysRef.current));
|
|
@@ -5903,7 +5973,7 @@ function useComposerAttachmentRetry(params) {
|
|
|
5903
5973
|
}
|
|
5904
5974
|
void retryStoredAttachment(item).finally(release);
|
|
5905
5975
|
}
|
|
5906
|
-
const resetRetryState =
|
|
5976
|
+
const resetRetryState = useCallback12(() => {
|
|
5907
5977
|
retryIdempotencyKeyRef.current = void 0;
|
|
5908
5978
|
retryingKeysRef.current.clear();
|
|
5909
5979
|
setRetryingKeys(/* @__PURE__ */ new Set());
|
|
@@ -5914,9 +5984,9 @@ function useComposerAttachmentRetry(params) {
|
|
|
5914
5984
|
// src/workspace/useComposerQueue.ts
|
|
5915
5985
|
function useComposerQueue(params) {
|
|
5916
5986
|
const { conversationId, draft, setDraft, api, labels, onSendAttachments, refetch, setSendFailure } = params;
|
|
5917
|
-
const [queue, setQueue] =
|
|
5918
|
-
const [attachmentStatus, setAttachmentStatus] =
|
|
5919
|
-
const [isSendingDraft, setIsSendingDraft] =
|
|
5987
|
+
const [queue, setQueue] = useState23([]);
|
|
5988
|
+
const [attachmentStatus, setAttachmentStatus] = useState23({});
|
|
5989
|
+
const [isSendingDraft, setIsSendingDraft] = useState23(false);
|
|
5920
5990
|
const sendInFlightRef = useRef16(false);
|
|
5921
5991
|
const idempotencyKeyRef = useRef16(void 0);
|
|
5922
5992
|
const currentConversationIdRef = useRef16(conversationId);
|
|
@@ -5941,11 +6011,11 @@ function useComposerQueue(params) {
|
|
|
5941
6011
|
setIsSendingDraft(false);
|
|
5942
6012
|
resetRetryState();
|
|
5943
6013
|
}, [conversationId, resetRetryState]);
|
|
5944
|
-
const enqueueAttachments =
|
|
6014
|
+
const enqueueAttachments = useCallback13((items) => {
|
|
5945
6015
|
if (items.length === 0) return;
|
|
5946
6016
|
setQueue((current) => [...current, ...items]);
|
|
5947
6017
|
}, []);
|
|
5948
|
-
const removeQueuedAttachment =
|
|
6018
|
+
const removeQueuedAttachment = useCallback13((item) => {
|
|
5949
6019
|
setQueue((current) => current.filter((queued) => attachmentKey(queued) !== attachmentKey(item)));
|
|
5950
6020
|
}, []);
|
|
5951
6021
|
async function runSend(action, fallback) {
|
|
@@ -6051,7 +6121,7 @@ function useComposerQueue(params) {
|
|
|
6051
6121
|
}
|
|
6052
6122
|
|
|
6053
6123
|
// src/workspace/ConversationPane.tsx
|
|
6054
|
-
import { jsx as
|
|
6124
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6055
6125
|
function ConversationPane({
|
|
6056
6126
|
conversation,
|
|
6057
6127
|
now,
|
|
@@ -6087,10 +6157,10 @@ function ConversationPane({
|
|
|
6087
6157
|
conversation.id
|
|
6088
6158
|
);
|
|
6089
6159
|
const { context: conversationContext } = useConversationContext(conversation.id);
|
|
6090
|
-
const [documentsOpen, setDocumentsOpen] =
|
|
6091
|
-
const [sendFailure, setSendFailure] =
|
|
6092
|
-
const [selectedMessageIds, setSelectedMessageIds] =
|
|
6093
|
-
const [draft, setDraft] =
|
|
6160
|
+
const [documentsOpen, setDocumentsOpen] = useState24(false);
|
|
6161
|
+
const [sendFailure, setSendFailure] = useState24(void 0);
|
|
6162
|
+
const [selectedMessageIds, setSelectedMessageIds] = useState24(/* @__PURE__ */ new Set());
|
|
6163
|
+
const [draft, setDraft] = useState24(initialComposerText ?? "");
|
|
6094
6164
|
const {
|
|
6095
6165
|
queue,
|
|
6096
6166
|
enqueueAttachments,
|
|
@@ -6111,7 +6181,7 @@ function ConversationPane({
|
|
|
6111
6181
|
setSendFailure
|
|
6112
6182
|
});
|
|
6113
6183
|
const thumbnailUrlCacheRef = useRef17(/* @__PURE__ */ new Map());
|
|
6114
|
-
const getQueuedAttachmentThumbnailUrl =
|
|
6184
|
+
const getQueuedAttachmentThumbnailUrl = useCallback14(
|
|
6115
6185
|
(uploadId) => {
|
|
6116
6186
|
const cached = thumbnailUrlCacheRef.current.get(uploadId);
|
|
6117
6187
|
if (cached) return cached;
|
|
@@ -6213,8 +6283,8 @@ function ConversationPane({
|
|
|
6213
6283
|
}
|
|
6214
6284
|
} : void 0;
|
|
6215
6285
|
const botOwnsConversation = Boolean(requireTakeoverToReply) && conversation.mode !== "human";
|
|
6216
|
-
return /* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6286
|
+
return /* @__PURE__ */ jsxs28("div", { className: "cv-workspace-pane", children: [
|
|
6287
|
+
/* @__PURE__ */ jsx32(
|
|
6218
6288
|
ConversationHeader,
|
|
6219
6289
|
{
|
|
6220
6290
|
conversation,
|
|
@@ -6229,10 +6299,10 @@ function ConversationPane({
|
|
|
6229
6299
|
...extraUtilities ? { extraUtilities } : {}
|
|
6230
6300
|
}
|
|
6231
6301
|
),
|
|
6232
|
-
contextEntries && contextEntries.length > 0 || flowLabel ? /* @__PURE__ */
|
|
6233
|
-
/* @__PURE__ */
|
|
6302
|
+
contextEntries && contextEntries.length > 0 || flowLabel ? /* @__PURE__ */ jsx32(ConversationContextPanel, { entries: contextEntries ?? [], ...flowLabel ? { flowLabel } : {} }) : null,
|
|
6303
|
+
/* @__PURE__ */ jsx32(ConversationDocumentsPanel, { conversationId: conversation.id, open: documentsOpen }),
|
|
6234
6304
|
renderAboveTranscript?.(conversation, conversationContext),
|
|
6235
|
-
/* @__PURE__ */
|
|
6305
|
+
/* @__PURE__ */ jsxs28(
|
|
6236
6306
|
ConversationWallpaper,
|
|
6237
6307
|
{
|
|
6238
6308
|
ref: scroll.containerRef,
|
|
@@ -6242,13 +6312,13 @@ function ConversationPane({
|
|
|
6242
6312
|
},
|
|
6243
6313
|
className: "cv-workspace-transcript",
|
|
6244
6314
|
children: [
|
|
6245
|
-
hasMoreOlderMessages ? /* @__PURE__ */
|
|
6315
|
+
hasMoreOlderMessages ? /* @__PURE__ */ jsx32("div", { className: "cv-workspace-load-older", children: /* @__PURE__ */ jsx32("button", { type: "button", onClick: loadOlder.triggerLoadOlder, disabled: loadingOlderMessages, children: loadingOlderMessages ? labels.loadingOlderMessages : labels.loadOlderMessages }) }) : null,
|
|
6246
6316
|
messages.map((message, index) => {
|
|
6247
6317
|
const previous = index > 0 ? messages[index - 1] : void 0;
|
|
6248
6318
|
const startsNewDay = !previous || new Date(message.timestamp).toDateString() !== new Date(previous.timestamp).toDateString();
|
|
6249
|
-
return /* @__PURE__ */
|
|
6250
|
-
startsNewDay ? /* @__PURE__ */
|
|
6251
|
-
/* @__PURE__ */
|
|
6319
|
+
return /* @__PURE__ */ jsxs28("div", { children: [
|
|
6320
|
+
startsNewDay ? /* @__PURE__ */ jsx32(DateDivider, { iso: message.timestamp }) : null,
|
|
6321
|
+
/* @__PURE__ */ jsx32(
|
|
6252
6322
|
MessageBubble,
|
|
6253
6323
|
{
|
|
6254
6324
|
message,
|
|
@@ -6267,10 +6337,10 @@ function ConversationPane({
|
|
|
6267
6337
|
]
|
|
6268
6338
|
}
|
|
6269
6339
|
),
|
|
6270
|
-
messageSelection && selectedMessageIds.size > 0 ? /* @__PURE__ */
|
|
6271
|
-
/* @__PURE__ */
|
|
6272
|
-
/* @__PURE__ */
|
|
6273
|
-
/* @__PURE__ */
|
|
6340
|
+
messageSelection && selectedMessageIds.size > 0 ? /* @__PURE__ */ jsxs28("div", { className: "cv-workspace-selection", children: [
|
|
6341
|
+
/* @__PURE__ */ jsx32("span", { children: labels.messagesSelected(selectedMessageIds.size) }),
|
|
6342
|
+
/* @__PURE__ */ jsxs28("div", { className: "cv-workspace-selection__actions", children: [
|
|
6343
|
+
/* @__PURE__ */ jsx32(
|
|
6274
6344
|
"button",
|
|
6275
6345
|
{
|
|
6276
6346
|
"data-cv-tooltip": labels.bulkClear,
|
|
@@ -6280,7 +6350,7 @@ function ConversationPane({
|
|
|
6280
6350
|
children: labels.bulkClear
|
|
6281
6351
|
}
|
|
6282
6352
|
),
|
|
6283
|
-
/* @__PURE__ */
|
|
6353
|
+
/* @__PURE__ */ jsx32(
|
|
6284
6354
|
"button",
|
|
6285
6355
|
{
|
|
6286
6356
|
"data-cv-tooltip": labels.copySelected,
|
|
@@ -6292,11 +6362,11 @@ function ConversationPane({
|
|
|
6292
6362
|
)
|
|
6293
6363
|
] })
|
|
6294
6364
|
] }) : null,
|
|
6295
|
-
sendFailure ? /* @__PURE__ */
|
|
6296
|
-
blocked ? /* @__PURE__ */
|
|
6365
|
+
sendFailure ? /* @__PURE__ */ jsx32("p", { role: "alert", className: "cv-workspace-alert", children: sendFailure }) : null,
|
|
6366
|
+
blocked ? /* @__PURE__ */ jsx32(WindowExpiredNotice, { disabled: busy, onSendTemplate: () => void handleSendTemplate() }) : botOwnsConversation ? (
|
|
6297
6367
|
// Responder com a conversa no bot atropelaria o fluxo automático no meio de uma pergunta.
|
|
6298
|
-
/* @__PURE__ */
|
|
6299
|
-
) : composer === "rich" ? /* @__PURE__ */
|
|
6368
|
+
/* @__PURE__ */ jsx32("p", { className: "cv-workspace-notice", children: labels.takeoverToReply })
|
|
6369
|
+
) : composer === "rich" ? /* @__PURE__ */ jsx32(
|
|
6300
6370
|
RichMessageComposer,
|
|
6301
6371
|
{
|
|
6302
6372
|
value: draft,
|
|
@@ -6319,7 +6389,7 @@ function ConversationPane({
|
|
|
6319
6389
|
isSending: busy || isSendingDraft,
|
|
6320
6390
|
hasQueuedAttachments: queue.length > 0,
|
|
6321
6391
|
...onRecordAudio ? {
|
|
6322
|
-
idleAction: /* @__PURE__ */
|
|
6392
|
+
idleAction: /* @__PURE__ */ jsx32(
|
|
6323
6393
|
AudioRecorderButton,
|
|
6324
6394
|
{
|
|
6325
6395
|
onRecorded: (file) => void runSend(() => onRecordAudio(file), labels.recordFailure),
|
|
@@ -6328,7 +6398,7 @@ function ConversationPane({
|
|
|
6328
6398
|
)
|
|
6329
6399
|
} : {},
|
|
6330
6400
|
...queue.length > 0 ? {
|
|
6331
|
-
attachmentsPreview: /* @__PURE__ */
|
|
6401
|
+
attachmentsPreview: /* @__PURE__ */ jsx32(
|
|
6332
6402
|
QueuedAttachmentsList,
|
|
6333
6403
|
{
|
|
6334
6404
|
items: queue,
|
|
@@ -6354,7 +6424,7 @@ function ConversationPane({
|
|
|
6354
6424
|
...composerVariables ? { variables: [...composerVariables] } : {},
|
|
6355
6425
|
...savedQuickReplies ? { savedQuickReplies } : {}
|
|
6356
6426
|
}
|
|
6357
|
-
) : /* @__PURE__ */
|
|
6427
|
+
) : /* @__PURE__ */ jsx32(
|
|
6358
6428
|
MessageComposer,
|
|
6359
6429
|
{
|
|
6360
6430
|
value: draft,
|
|
@@ -6372,7 +6442,7 @@ function ConversationPane({
|
|
|
6372
6442
|
}
|
|
6373
6443
|
|
|
6374
6444
|
// src/workspace/ConversationsInboxList.tsx
|
|
6375
|
-
import { jsx as
|
|
6445
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6376
6446
|
function ConversationsInboxList({
|
|
6377
6447
|
inbox,
|
|
6378
6448
|
labels,
|
|
@@ -6383,13 +6453,13 @@ function ConversationsInboxList({
|
|
|
6383
6453
|
onSendTemplateToSelected
|
|
6384
6454
|
}) {
|
|
6385
6455
|
const hasSelection = inbox.selectedIds.size > 0;
|
|
6386
|
-
return /* @__PURE__ */
|
|
6387
|
-
hasSelection ? /* @__PURE__ */
|
|
6388
|
-
/* @__PURE__ */
|
|
6389
|
-
/* @__PURE__ */
|
|
6390
|
-
/* @__PURE__ */
|
|
6391
|
-
onSendTemplateToSelected ? /* @__PURE__ */
|
|
6392
|
-
inbox.canFinalize ? /* @__PURE__ */
|
|
6456
|
+
return /* @__PURE__ */ jsxs29("aside", { className, children: [
|
|
6457
|
+
hasSelection ? /* @__PURE__ */ jsxs29("div", { className: "cv-workspace-bulk", children: [
|
|
6458
|
+
/* @__PURE__ */ jsx33("span", { className: "cv-workspace-bulk__count", children: labels.bulkSelected(inbox.selectedIds.size) }),
|
|
6459
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-bulk__actions", children: [
|
|
6460
|
+
/* @__PURE__ */ jsx33("button", { "data-cv-tooltip": labels.bulkClear, "aria-label": labels.bulkClear, type: "button", onClick: inbox.clearBulkSelection, children: labels.bulkClear }),
|
|
6461
|
+
onSendTemplateToSelected ? /* @__PURE__ */ jsx33("button", { "data-cv-tooltip": labels.bulkTemplate, "aria-label": labels.bulkTemplate, type: "button", onClick: onSendTemplateToSelected, disabled: inbox.busy, children: labels.bulkTemplate }) : null,
|
|
6462
|
+
inbox.canFinalize ? /* @__PURE__ */ jsx33(
|
|
6393
6463
|
"button",
|
|
6394
6464
|
{
|
|
6395
6465
|
"data-cv-tooltip": labels.bulkFinalize,
|
|
@@ -6407,8 +6477,8 @@ function ConversationsInboxList({
|
|
|
6407
6477
|
renderBulkActions?.(inbox)
|
|
6408
6478
|
] })
|
|
6409
6479
|
] }) : null,
|
|
6410
|
-
/* @__PURE__ */
|
|
6411
|
-
/* @__PURE__ */
|
|
6480
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-filters", children: [
|
|
6481
|
+
/* @__PURE__ */ jsx33(
|
|
6412
6482
|
"input",
|
|
6413
6483
|
{
|
|
6414
6484
|
type: "search",
|
|
@@ -6418,9 +6488,9 @@ function ConversationsInboxList({
|
|
|
6418
6488
|
className: "cv-workspace-search"
|
|
6419
6489
|
}
|
|
6420
6490
|
),
|
|
6421
|
-
/* @__PURE__ */
|
|
6422
|
-
/* @__PURE__ */
|
|
6423
|
-
WINDOW_FILTERS.map((filter) => /* @__PURE__ */
|
|
6491
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-chips", children: [
|
|
6492
|
+
/* @__PURE__ */ jsx33("span", { className: "cv-workspace-chips__legend", children: labels.windowLegend }),
|
|
6493
|
+
WINDOW_FILTERS.map((filter) => /* @__PURE__ */ jsx33(
|
|
6424
6494
|
"button",
|
|
6425
6495
|
{
|
|
6426
6496
|
type: "button",
|
|
@@ -6438,9 +6508,9 @@ function ConversationsInboxList({
|
|
|
6438
6508
|
filter.value
|
|
6439
6509
|
))
|
|
6440
6510
|
] }),
|
|
6441
|
-
inbox.channelFilters.length > 0 ? /* @__PURE__ */
|
|
6442
|
-
/* @__PURE__ */
|
|
6443
|
-
inbox.channelFilters.map((filter) => /* @__PURE__ */
|
|
6511
|
+
inbox.channelFilters.length > 0 ? /* @__PURE__ */ jsxs29("div", { className: "cv-workspace-chips", children: [
|
|
6512
|
+
/* @__PURE__ */ jsx33("span", { className: "cv-workspace-chips__legend", children: labels.channelLegend }),
|
|
6513
|
+
inbox.channelFilters.map((filter) => /* @__PURE__ */ jsxs29(
|
|
6444
6514
|
"button",
|
|
6445
6515
|
{
|
|
6446
6516
|
"data-cv-tooltip": filter.label,
|
|
@@ -6450,7 +6520,7 @@ function ConversationsInboxList({
|
|
|
6450
6520
|
"aria-pressed": inbox.channelFilter === filter.value,
|
|
6451
6521
|
className: `cv-workspace-chip${inbox.channelFilter === filter.value ? " cv-workspace-chip--on" : ""}`,
|
|
6452
6522
|
children: [
|
|
6453
|
-
filter.value === CHANNEL_FILTER_ALL ? null : /* @__PURE__ */
|
|
6523
|
+
filter.value === CHANNEL_FILTER_ALL ? null : /* @__PURE__ */ jsx33(ChannelIcon, { channel: filter.value }),
|
|
6454
6524
|
filter.label
|
|
6455
6525
|
]
|
|
6456
6526
|
},
|
|
@@ -6458,14 +6528,14 @@ function ConversationsInboxList({
|
|
|
6458
6528
|
))
|
|
6459
6529
|
] }) : null,
|
|
6460
6530
|
renderFilters?.(inbox),
|
|
6461
|
-
/* @__PURE__ */
|
|
6462
|
-
/* @__PURE__ */
|
|
6531
|
+
/* @__PURE__ */ jsxs29("label", { className: "cv-workspace-selectall", children: [
|
|
6532
|
+
/* @__PURE__ */ jsx33("input", { type: "checkbox", checked: inbox.allOnPageSelected, onChange: inbox.toggleSelectAllOnPage }),
|
|
6463
6533
|
labels.selectAll
|
|
6464
6534
|
] })
|
|
6465
6535
|
] }),
|
|
6466
|
-
/* @__PURE__ */
|
|
6536
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-rows", children: [
|
|
6467
6537
|
inbox.pageConversations.map(
|
|
6468
|
-
(conversation) => renderRow ? /* @__PURE__ */
|
|
6538
|
+
(conversation) => renderRow ? /* @__PURE__ */ jsx33("div", { children: renderRow(conversation) }, conversation.id) : /* @__PURE__ */ jsx33(
|
|
6469
6539
|
ConversationRow,
|
|
6470
6540
|
{
|
|
6471
6541
|
conversation,
|
|
@@ -6480,13 +6550,13 @@ function ConversationsInboxList({
|
|
|
6480
6550
|
conversation.id
|
|
6481
6551
|
)
|
|
6482
6552
|
),
|
|
6483
|
-
!inbox.loading && inbox.filteredCount === 0 ? /* @__PURE__ */
|
|
6553
|
+
!inbox.loading && inbox.filteredCount === 0 ? /* @__PURE__ */ jsx33("p", { className: "cv-workspace-empty", children: labels.emptyList }) : null
|
|
6484
6554
|
] }),
|
|
6485
|
-
/* @__PURE__ */
|
|
6486
|
-
/* @__PURE__ */
|
|
6487
|
-
/* @__PURE__ */
|
|
6488
|
-
/* @__PURE__ */
|
|
6489
|
-
/* @__PURE__ */
|
|
6555
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-pager", children: [
|
|
6556
|
+
/* @__PURE__ */ jsx33("span", { children: labels.rangeOf(inbox.firstOnPage, inbox.lastOnPage, inbox.filteredCount) }),
|
|
6557
|
+
/* @__PURE__ */ jsxs29("div", { className: "cv-workspace-pager__buttons", children: [
|
|
6558
|
+
/* @__PURE__ */ jsx33("button", { type: "button", onClick: () => inbox.goToPage(1), disabled: inbox.page === 1, "aria-label": PAGINATION_LABELS.first, "data-cv-tooltip": PAGINATION_LABELS.first, children: "\xAB" }),
|
|
6559
|
+
/* @__PURE__ */ jsx33(
|
|
6490
6560
|
"button",
|
|
6491
6561
|
{
|
|
6492
6562
|
type: "button",
|
|
@@ -6497,8 +6567,8 @@ function ConversationsInboxList({
|
|
|
6497
6567
|
children: "\u2039"
|
|
6498
6568
|
}
|
|
6499
6569
|
),
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6570
|
+
/* @__PURE__ */ jsx33("span", { children: labels.pageOf(inbox.page, inbox.pageCount) }),
|
|
6571
|
+
/* @__PURE__ */ jsx33(
|
|
6502
6572
|
"button",
|
|
6503
6573
|
{
|
|
6504
6574
|
type: "button",
|
|
@@ -6509,7 +6579,7 @@ function ConversationsInboxList({
|
|
|
6509
6579
|
children: "\u203A"
|
|
6510
6580
|
}
|
|
6511
6581
|
),
|
|
6512
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsx33(
|
|
6513
6583
|
"button",
|
|
6514
6584
|
{
|
|
6515
6585
|
type: "button",
|
|
@@ -6575,7 +6645,7 @@ var DEFAULT_CONVERSATIONS_WORKSPACE_LABELS = {
|
|
|
6575
6645
|
};
|
|
6576
6646
|
|
|
6577
6647
|
// src/workspace/useConversationsInbox.ts
|
|
6578
|
-
import { useCallback as
|
|
6648
|
+
import { useCallback as useCallback15, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef18, useState as useState25 } from "react";
|
|
6579
6649
|
var CONVERSATIONS_PER_PAGE = 50;
|
|
6580
6650
|
function defaultDescribeFailure(error) {
|
|
6581
6651
|
const status = error.status;
|
|
@@ -6593,14 +6663,14 @@ function useConversationsInbox(params = {}) {
|
|
|
6593
6663
|
const perPage = params.perPage ?? CONVERSATIONS_PER_PAGE;
|
|
6594
6664
|
const markReadOnOpen = params.markReadOnOpen ?? true;
|
|
6595
6665
|
const describeFailure = params.describeFailure ?? defaultDescribeFailure;
|
|
6596
|
-
const [waitingOnly, setWaitingOnly] =
|
|
6597
|
-
const [windowFilter, setWindowFilter] =
|
|
6598
|
-
const [channelFilter, setChannelFilter] =
|
|
6599
|
-
const [search, setSearch] =
|
|
6600
|
-
const [page, setPage] =
|
|
6601
|
-
const [selectedId, setSelectedId] =
|
|
6602
|
-
const [selectedIds, setSelectedIds] =
|
|
6603
|
-
const [busy, setBusy] =
|
|
6666
|
+
const [waitingOnly, setWaitingOnly] = useState25(false);
|
|
6667
|
+
const [windowFilter, setWindowFilter] = useState25(CONVERSATION_WINDOW.ALL);
|
|
6668
|
+
const [channelFilter, setChannelFilter] = useState25(CHANNEL_FILTER_ALL);
|
|
6669
|
+
const [search, setSearch] = useState25("");
|
|
6670
|
+
const [page, setPage] = useState25(1);
|
|
6671
|
+
const [selectedId, setSelectedId] = useState25(void 0);
|
|
6672
|
+
const [selectedIds, setSelectedIds] = useState25(/* @__PURE__ */ new Set());
|
|
6673
|
+
const [busy, setBusy] = useState25(false);
|
|
6604
6674
|
const { conversations, total, loading, error, refetch } = useConversationList({
|
|
6605
6675
|
...waitingOnly ? { waitingHuman: true } : {},
|
|
6606
6676
|
...search ? { search } : {},
|
|
@@ -6608,7 +6678,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6608
6678
|
...params.serverPaginated ? { page, limit: perPage } : {}
|
|
6609
6679
|
});
|
|
6610
6680
|
useGlobalRealtime(
|
|
6611
|
-
|
|
6681
|
+
useCallback15(() => {
|
|
6612
6682
|
void refetch();
|
|
6613
6683
|
}, [refetch])
|
|
6614
6684
|
);
|
|
@@ -6644,7 +6714,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6644
6714
|
void api.markRead(selectedId).then(() => refetch()).catch(() => {
|
|
6645
6715
|
});
|
|
6646
6716
|
}, [markReadOnOpen, selectedId, conversations, refetch, api]);
|
|
6647
|
-
const toggleSelected =
|
|
6717
|
+
const toggleSelected = useCallback15((conversationId) => {
|
|
6648
6718
|
setSelectedIds((current) => {
|
|
6649
6719
|
const next = new Set(current);
|
|
6650
6720
|
if (next.has(conversationId)) next.delete(conversationId);
|
|
@@ -6654,7 +6724,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6654
6724
|
}, []);
|
|
6655
6725
|
const pageIds = pageConversations.map((conversation) => conversation.id);
|
|
6656
6726
|
const allOnPageSelected = pageIds.length > 0 && pageIds.every((id) => selectedIds.has(id));
|
|
6657
|
-
const toggleSelectAllOnPage =
|
|
6727
|
+
const toggleSelectAllOnPage = useCallback15(() => {
|
|
6658
6728
|
setSelectedIds((current) => {
|
|
6659
6729
|
const next = new Set(current);
|
|
6660
6730
|
if (allOnPageSelected) pageIds.forEach((id) => next.delete(id));
|
|
@@ -6662,7 +6732,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6662
6732
|
return next;
|
|
6663
6733
|
});
|
|
6664
6734
|
}, [allOnPageSelected, pageIds]);
|
|
6665
|
-
const runOnSelection =
|
|
6735
|
+
const runOnSelection = useCallback15(
|
|
6666
6736
|
async (action) => {
|
|
6667
6737
|
setBusy(true);
|
|
6668
6738
|
try {
|
|
@@ -6675,7 +6745,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6675
6745
|
},
|
|
6676
6746
|
[selectedIds, refetch]
|
|
6677
6747
|
);
|
|
6678
|
-
const runConversationAction =
|
|
6748
|
+
const runConversationAction = useCallback15(
|
|
6679
6749
|
async (action, conversationId) => {
|
|
6680
6750
|
if (!action) return;
|
|
6681
6751
|
setBusy(true);
|
|
@@ -6757,7 +6827,7 @@ function useConversationsInbox(params = {}) {
|
|
|
6757
6827
|
}
|
|
6758
6828
|
|
|
6759
6829
|
// src/workspace/ConversationsWorkspace.tsx
|
|
6760
|
-
import { Fragment as Fragment8, jsx as
|
|
6830
|
+
import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6761
6831
|
function ConversationsWorkspace({
|
|
6762
6832
|
labels: labelsOverride,
|
|
6763
6833
|
filters,
|
|
@@ -6798,9 +6868,9 @@ function ConversationsWorkspace({
|
|
|
6798
6868
|
...markReadOnOpen === void 0 ? {} : { markReadOnOpen },
|
|
6799
6869
|
...serverPaginated ? { serverPaginated } : {}
|
|
6800
6870
|
});
|
|
6801
|
-
const [simulatorOpen, setSimulatorOpen] =
|
|
6802
|
-
const [templateModalOpen, setTemplateModalOpen] =
|
|
6803
|
-
const [openedFromLink, setOpenedFromLink] =
|
|
6871
|
+
const [simulatorOpen, setSimulatorOpen] = useState26(false);
|
|
6872
|
+
const [templateModalOpen, setTemplateModalOpen] = useState26(false);
|
|
6873
|
+
const [openedFromLink, setOpenedFromLink] = useState26(void 0);
|
|
6804
6874
|
useEffect20(() => {
|
|
6805
6875
|
const link = initialConversationId ?? initialWhatsappNumber;
|
|
6806
6876
|
if (!link || openedFromLink === link) return;
|
|
@@ -6833,50 +6903,50 @@ function ConversationsWorkspace({
|
|
|
6833
6903
|
...fromProduct,
|
|
6834
6904
|
{
|
|
6835
6905
|
key: "simulator",
|
|
6836
|
-
icon: simulator?.icon ?? /* @__PURE__ */
|
|
6906
|
+
icon: simulator?.icon ?? /* @__PURE__ */ jsx34(FlaskConical, { size: ICON_SIZE_ACTION }),
|
|
6837
6907
|
label: simulator?.label ?? "Simular cliente",
|
|
6838
6908
|
active: simulatorOpen,
|
|
6839
6909
|
run: () => setSimulatorOpen((open) => !open)
|
|
6840
6910
|
}
|
|
6841
6911
|
];
|
|
6842
6912
|
}, [selected, extraUtilitiesFor, simulatorEnabled, simulator, simulatorOpen]);
|
|
6843
|
-
return /* @__PURE__ */
|
|
6844
|
-
/* @__PURE__ */
|
|
6845
|
-
/* @__PURE__ */
|
|
6846
|
-
/* @__PURE__ */
|
|
6847
|
-
/* @__PURE__ */
|
|
6848
|
-
/* @__PURE__ */
|
|
6849
|
-
/* @__PURE__ */
|
|
6850
|
-
/* @__PURE__ */
|
|
6913
|
+
return /* @__PURE__ */ jsxs30("div", { className: `cv-workspace${className ? ` ${className}` : ""}`, children: [
|
|
6914
|
+
/* @__PURE__ */ jsx34(TooltipLayer, {}),
|
|
6915
|
+
/* @__PURE__ */ jsxs30("header", { className: "cv-workspace-header", children: [
|
|
6916
|
+
/* @__PURE__ */ jsxs30("div", { className: "cv-workspace-header__titles", children: [
|
|
6917
|
+
/* @__PURE__ */ jsx34("h1", { children: labels.title }),
|
|
6918
|
+
/* @__PURE__ */ jsxs30("p", { children: [
|
|
6919
|
+
/* @__PURE__ */ jsxs30("span", { "data-cv-tooltip": labels.conversations, className: "cv-stat", children: [
|
|
6920
|
+
/* @__PURE__ */ jsx34(MessagesSquare, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
6851
6921
|
" ",
|
|
6852
6922
|
inbox.totalCount,
|
|
6853
|
-
/* @__PURE__ */
|
|
6923
|
+
/* @__PURE__ */ jsxs30("span", { className: "cv-only-wide", children: [
|
|
6854
6924
|
" ",
|
|
6855
6925
|
labels.conversations
|
|
6856
6926
|
] })
|
|
6857
6927
|
] }),
|
|
6858
|
-
/* @__PURE__ */
|
|
6859
|
-
/* @__PURE__ */
|
|
6928
|
+
/* @__PURE__ */ jsxs30("span", { "data-cv-tooltip": labels.waiting, className: "cv-stat cv-workspace-header__waiting", children: [
|
|
6929
|
+
/* @__PURE__ */ jsx34(Hourglass2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
6860
6930
|
" ",
|
|
6861
6931
|
inbox.waitingCount,
|
|
6862
|
-
/* @__PURE__ */
|
|
6932
|
+
/* @__PURE__ */ jsxs30("span", { className: "cv-only-wide", children: [
|
|
6863
6933
|
" ",
|
|
6864
6934
|
labels.waiting
|
|
6865
6935
|
] })
|
|
6866
6936
|
] }),
|
|
6867
|
-
/* @__PURE__ */
|
|
6868
|
-
/* @__PURE__ */
|
|
6937
|
+
/* @__PURE__ */ jsxs30("span", { "data-cv-tooltip": labels.unread, className: "cv-stat", children: [
|
|
6938
|
+
/* @__PURE__ */ jsx34(Mail2, { size: ICON_SIZE_INLINE, "aria-hidden": "true" }),
|
|
6869
6939
|
" ",
|
|
6870
6940
|
inbox.unreadCount,
|
|
6871
|
-
/* @__PURE__ */
|
|
6941
|
+
/* @__PURE__ */ jsxs30("span", { className: "cv-only-wide", children: [
|
|
6872
6942
|
" ",
|
|
6873
6943
|
labels.unread
|
|
6874
6944
|
] })
|
|
6875
6945
|
] })
|
|
6876
6946
|
] })
|
|
6877
6947
|
] }),
|
|
6878
|
-
/* @__PURE__ */
|
|
6879
|
-
/* @__PURE__ */
|
|
6948
|
+
/* @__PURE__ */ jsxs30("div", { className: "cv-workspace-header__actions", children: [
|
|
6949
|
+
/* @__PURE__ */ jsxs30(
|
|
6880
6950
|
"button",
|
|
6881
6951
|
{
|
|
6882
6952
|
type: "button",
|
|
@@ -6886,12 +6956,12 @@ function ConversationsWorkspace({
|
|
|
6886
6956
|
"aria-label": labels.waitingOnly,
|
|
6887
6957
|
className: inbox.waitingOnly ? "cv-workspace-toggle cv-workspace-toggle--on" : "cv-workspace-toggle",
|
|
6888
6958
|
children: [
|
|
6889
|
-
/* @__PURE__ */
|
|
6890
|
-
/* @__PURE__ */
|
|
6959
|
+
/* @__PURE__ */ jsx34(Hourglass2, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
6960
|
+
/* @__PURE__ */ jsx34("span", { className: "cv-only-wide", children: labels.waitingOnly })
|
|
6891
6961
|
]
|
|
6892
6962
|
}
|
|
6893
6963
|
),
|
|
6894
|
-
/* @__PURE__ */
|
|
6964
|
+
/* @__PURE__ */ jsxs30(
|
|
6895
6965
|
"button",
|
|
6896
6966
|
{
|
|
6897
6967
|
type: "button",
|
|
@@ -6901,9 +6971,9 @@ function ConversationsWorkspace({
|
|
|
6901
6971
|
"aria-label": labels.markSelectedAsRead,
|
|
6902
6972
|
className: "cv-workspace-toggle",
|
|
6903
6973
|
children: [
|
|
6904
|
-
/* @__PURE__ */
|
|
6905
|
-
/* @__PURE__ */
|
|
6906
|
-
inbox.selectedIds.size > 0 ? /* @__PURE__ */
|
|
6974
|
+
/* @__PURE__ */ jsx34(Check2, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
6975
|
+
/* @__PURE__ */ jsx34("span", { className: "cv-only-wide", children: labels.markSelectedAsRead }),
|
|
6976
|
+
inbox.selectedIds.size > 0 ? /* @__PURE__ */ jsxs30("span", { children: [
|
|
6907
6977
|
"(",
|
|
6908
6978
|
inbox.selectedIds.size,
|
|
6909
6979
|
")"
|
|
@@ -6911,7 +6981,7 @@ function ConversationsWorkspace({
|
|
|
6911
6981
|
]
|
|
6912
6982
|
}
|
|
6913
6983
|
),
|
|
6914
|
-
inbox.canMarkAllRead && inbox.unreadCount > 0 ? /* @__PURE__ */
|
|
6984
|
+
inbox.canMarkAllRead && inbox.unreadCount > 0 ? /* @__PURE__ */ jsxs30(
|
|
6915
6985
|
"button",
|
|
6916
6986
|
{
|
|
6917
6987
|
type: "button",
|
|
@@ -6921,28 +6991,28 @@ function ConversationsWorkspace({
|
|
|
6921
6991
|
"aria-label": labels.markAllAsRead,
|
|
6922
6992
|
className: "cv-workspace-toggle",
|
|
6923
6993
|
children: [
|
|
6924
|
-
/* @__PURE__ */
|
|
6925
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx34(CheckCheck, { size: ICON_SIZE_ACTION, "aria-hidden": "true" }),
|
|
6995
|
+
/* @__PURE__ */ jsx34("span", { className: "cv-only-wide", children: labels.markAllAsRead })
|
|
6926
6996
|
]
|
|
6927
6997
|
}
|
|
6928
6998
|
) : null,
|
|
6929
6999
|
renderHeaderActions?.(inbox)
|
|
6930
7000
|
] })
|
|
6931
7001
|
] }),
|
|
6932
|
-
inbox.loadFailure ? /* @__PURE__ */
|
|
7002
|
+
inbox.loadFailure ? /* @__PURE__ */ jsxs30("p", { role: "alert", className: "cv-workspace-failure", children: [
|
|
6933
7003
|
inbox.loadFailure,
|
|
6934
|
-
signInHref ? /* @__PURE__ */
|
|
7004
|
+
signInHref ? /* @__PURE__ */ jsxs30(Fragment8, { children: [
|
|
6935
7005
|
" ",
|
|
6936
|
-
/* @__PURE__ */
|
|
7006
|
+
/* @__PURE__ */ jsx34("a", { href: signInHref, className: "cv-workspace-failure__link", children: labels.signIn })
|
|
6937
7007
|
] }) : null
|
|
6938
7008
|
] }) : null,
|
|
6939
|
-
/* @__PURE__ */
|
|
7009
|
+
/* @__PURE__ */ jsxs30(
|
|
6940
7010
|
"div",
|
|
6941
7011
|
{
|
|
6942
7012
|
className: `cv-workspace-grid${showSimulator ? " cv-workspace-grid--with-simulator" : ""}`,
|
|
6943
7013
|
"data-detail": selected ? "open" : "closed",
|
|
6944
7014
|
children: [
|
|
6945
|
-
/* @__PURE__ */
|
|
7015
|
+
/* @__PURE__ */ jsx34(
|
|
6946
7016
|
ConversationsInboxList,
|
|
6947
7017
|
{
|
|
6948
7018
|
inbox,
|
|
@@ -6954,7 +7024,7 @@ function ConversationsWorkspace({
|
|
|
6954
7024
|
...onSendTemplateToSelected ? { onSendTemplateToSelected: () => onSendTemplateToSelected(inbox) } : inbox.canListTemplates ? { onSendTemplateToSelected: () => setTemplateModalOpen(true) } : {}
|
|
6955
7025
|
}
|
|
6956
7026
|
),
|
|
6957
|
-
/* @__PURE__ */
|
|
7027
|
+
/* @__PURE__ */ jsx34("section", { className: "cv-workspace-detail", children: selected ? /* @__PURE__ */ jsx34(
|
|
6958
7028
|
ConversationPane,
|
|
6959
7029
|
{
|
|
6960
7030
|
conversation: selected,
|
|
@@ -6984,14 +7054,14 @@ function ConversationsWorkspace({
|
|
|
6984
7054
|
...renderAboveTranscript ? { renderAboveTranscript } : {},
|
|
6985
7055
|
...onAttach ? { onAttach: (file) => onAttach(selected, file) } : {}
|
|
6986
7056
|
}
|
|
6987
|
-
) : /* @__PURE__ */
|
|
7057
|
+
) : /* @__PURE__ */ jsx34("p", { className: "cv-workspace-empty", children: labels.emptyDetail }) }),
|
|
6988
7058
|
showSimulator && selected ? (
|
|
6989
7059
|
// `min-height:0` junto do `min-width:0`: sem isso a linha do grid cresce com o conteúdo do
|
|
6990
7060
|
// painel, o scroll interno nunca ativa e quem rola passa a ser a página inteira.
|
|
6991
|
-
/* @__PURE__ */
|
|
7061
|
+
/* @__PURE__ */ jsx34("div", { className: "cv-workspace-simulator", children: simulator?.render ? simulator.render({ conversationId: selected.id, channel, close: () => setSimulatorOpen(false) }) : simulatorClient && conversations ? (
|
|
6992
7062
|
// `key` pela conversa: trocar de contato sem remontar deixaria o transcript e o campo
|
|
6993
7063
|
// de texto do contato anterior na tela.
|
|
6994
|
-
/* @__PURE__ */
|
|
7064
|
+
/* @__PURE__ */ jsx34(
|
|
6995
7065
|
ConversationSimulatorPanel,
|
|
6996
7066
|
{
|
|
6997
7067
|
client: simulatorClient,
|
|
@@ -7012,7 +7082,7 @@ function ConversationsWorkspace({
|
|
|
7012
7082
|
]
|
|
7013
7083
|
}
|
|
7014
7084
|
),
|
|
7015
|
-
templateModalOpen ? /* @__PURE__ */
|
|
7085
|
+
templateModalOpen ? /* @__PURE__ */ jsx34(
|
|
7016
7086
|
BulkTemplateModal,
|
|
7017
7087
|
{
|
|
7018
7088
|
labels,
|