@adatechnology/conversations-ui 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/dist/{ConversationSimulatorPanel-DnXElfY8.d.ts → ConversationSimulatorPanel-CrfFjiWh.d.ts} +2 -268
- package/dist/{chunk-PJNR6UMN.js → chunk-CBYEHPX6.js} +1 -63
- package/dist/{chunk-HMCOTZAX.js → chunk-HOKNKXIT.js} +1 -1
- package/dist/{chunk-4P5KMWOI.js → chunk-JXJCPN34.js} +327 -522
- package/dist/chunk-MRVFFJEH.js +64 -0
- package/dist/chunk-RJMSM3YA.js +249 -0
- package/dist/chunk-WSFGNR5R.js +55 -0
- package/dist/flows/index.js +5 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +783 -807
- package/dist/participant/index.d.ts +162 -0
- package/dist/participant/index.js +1448 -0
- package/dist/preview/index.d.ts +4 -2
- package/dist/preview/index.js +4 -2
- package/dist/quickReply.types-B4gmZsSr.d.ts +274 -0
- package/dist/styles.css +591 -0
- package/package.json +9 -5
- package/src/ChannelIcon.tsx +2 -0
- package/src/MessageBubble.test.tsx +2 -2
- package/src/MessageText.test.tsx +59 -0
- package/src/MessageText.tsx +20 -12
- package/src/MessageTextCopiedBadge.tsx +7 -0
- package/src/StatusTicks.test.tsx +30 -0
- package/src/StatusTicks.tsx +24 -9
- package/src/buildOutput.test.ts +41 -0
- package/src/channelCapability.test.ts +17 -0
- package/src/conversationChannel.test.ts +30 -1
- package/src/conversationChannel.ts +19 -1
- package/src/participant/ParticipantAttachmentItem.tsx +77 -0
- package/src/participant/ParticipantComposer.test.tsx +97 -0
- package/src/participant/ParticipantComposer.tsx +167 -0
- package/src/participant/ParticipantConversations.test.tsx +90 -0
- package/src/participant/ParticipantConversations.tsx +42 -0
- package/src/participant/ParticipantConversationsScreen.tsx +67 -0
- package/src/participant/ParticipantInbox.test.tsx +147 -0
- package/src/participant/ParticipantInbox.tsx +168 -0
- package/src/participant/ParticipantLoadState.tsx +27 -0
- package/src/participant/ParticipantMessageBubble.test.tsx +165 -0
- package/src/participant/ParticipantMessageBubble.tsx +185 -0
- package/src/participant/ParticipantThread.test.tsx +132 -0
- package/src/participant/ParticipantThread.tsx +174 -0
- package/src/participant/ParticipantThreadScreen.tsx +135 -0
- package/src/participant/bindAttachmentUrlResolver.test.ts +25 -0
- package/src/participant/bindAttachmentUrlResolver.ts +7 -0
- package/src/participant/index.ts +25 -0
- package/src/participant/participant.types.ts +43 -0
- package/src/participant/participantApi.types.ts +59 -0
- package/src/participant/participantAttachmentUrl.test.ts +32 -0
- package/src/participant/participantAttachmentUrl.ts +10 -0
- package/src/participant/participantBubbleActions.test.ts +44 -0
- package/src/participant/participantBubbleActions.ts +40 -0
- package/src/participant/participantDrafts.test.ts +65 -0
- package/src/participant/participantDrafts.ts +50 -0
- package/src/participant/participantFileValidation.test.ts +86 -0
- package/src/participant/participantFileValidation.ts +72 -0
- package/src/participant/participantFixtures.test-helper.ts +41 -0
- package/src/participant/participantGrouping.test.ts +138 -0
- package/src/participant/participantGrouping.ts +77 -0
- package/src/participant/participantInboxState.test.ts +69 -0
- package/src/participant/participantInboxState.ts +74 -0
- package/src/participant/participantLabels.ts +86 -0
- package/src/participant/participantLoadView.test.ts +23 -0
- package/src/participant/participantLoadView.ts +21 -0
- package/src/participant/participantMessages.test.ts +128 -0
- package/src/participant/participantMessages.ts +73 -0
- package/src/participant/participantNewMessages.test.ts +54 -0
- package/src/participant/participantNewMessages.ts +29 -0
- package/src/participant/participantQuickReply.test.ts +23 -0
- package/src/participant/participantQuickReply.ts +6 -0
- package/src/participant/participantScroll.test.ts +69 -0
- package/src/participant/participantScroll.ts +43 -0
- package/src/participant/participantSendController.test.ts +201 -0
- package/src/participant/participantSendController.ts +134 -0
- package/src/participant/participantSendStates.ts +31 -0
- package/src/participant/participantTheme.ts +20 -0
- package/src/participant/participantThreadState.test.ts +75 -0
- package/src/participant/participantThreadState.ts +59 -0
- package/src/participant/shouldMarkRead.test.ts +24 -0
- package/src/participant/shouldMarkRead.ts +16 -0
- package/src/participant/useDocumentVisibility.ts +18 -0
- package/src/participant/useParticipantConversationView.ts +60 -0
- package/src/participant/useParticipantDraft.ts +45 -0
- package/src/participant/useParticipantInbox.ts +57 -0
- package/src/participant/useParticipantMarkRead.ts +26 -0
- package/src/participant/useParticipantRevalidation.ts +36 -0
- package/src/participant/useParticipantSend.ts +84 -0
- package/src/participant/useParticipantThread.ts +116 -0
- package/src/participant/useParticipantThreadScroll.ts +26 -0
- package/src/participant/useStickToBottom.ts +77 -0
- package/src/preview/ConversationSimulatorPanel.tsx +8 -0
- package/src/styles.css +160 -0
- package/src/types.ts +3 -1
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cn,
|
|
3
|
-
parseWhatsAppFormatting,
|
|
4
3
|
useIsDarkTheme
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MRVFFJEH.js";
|
|
5
|
+
import {
|
|
6
|
+
CONVERSATION_CHANNEL,
|
|
7
|
+
DEFAULT_CONVERSATION_CHANNEL,
|
|
8
|
+
StatusTicks,
|
|
9
|
+
channelCapabilityFor,
|
|
10
|
+
formatDateTime,
|
|
11
|
+
formatFileSize,
|
|
12
|
+
formatPhone,
|
|
13
|
+
formatTimestamp,
|
|
14
|
+
isSameDay
|
|
15
|
+
} from "./chunk-RJMSM3YA.js";
|
|
16
|
+
import {
|
|
17
|
+
parseWhatsAppFormatting
|
|
18
|
+
} from "./chunk-CBYEHPX6.js";
|
|
6
19
|
|
|
7
20
|
// src/ConversationLocalesProvider.tsx
|
|
8
21
|
import { createContext, useContext } from "react";
|
|
@@ -64,180 +77,10 @@ function useConversationLocales() {
|
|
|
64
77
|
return useContext(ConversationLocalesContext);
|
|
65
78
|
}
|
|
66
79
|
|
|
67
|
-
// src/lib/phone.ts
|
|
68
|
-
function formatPhone(number) {
|
|
69
|
-
const digits = number.replace(/\D/g, "");
|
|
70
|
-
if (digits.length === 13) {
|
|
71
|
-
return `+${digits.slice(0, 2)} (${digits.slice(2, 4)}) ${digits.slice(4, 9)}-${digits.slice(9, 13)}`;
|
|
72
|
-
}
|
|
73
|
-
if (digits.length === 12) {
|
|
74
|
-
return `+${digits.slice(0, 2)} (${digits.slice(2, 4)}) ${digits.slice(4, 8)}-${digits.slice(8, 12)}`;
|
|
75
|
-
}
|
|
76
|
-
if (digits.length === 11) {
|
|
77
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
|
|
78
|
-
}
|
|
79
|
-
if (digits.length === 10) {
|
|
80
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6, 10)}`;
|
|
81
|
-
}
|
|
82
|
-
return number;
|
|
83
|
-
}
|
|
84
|
-
var COUNTRY_FLAG_BY_DIAL_CODE = {
|
|
85
|
-
"55": "\u{1F1E7}\u{1F1F7}",
|
|
86
|
-
"351": "\u{1F1F5}\u{1F1F9}",
|
|
87
|
-
"34": "\u{1F1EA}\u{1F1F8}",
|
|
88
|
-
"54": "\u{1F1E6}\u{1F1F7}",
|
|
89
|
-
"56": "\u{1F1E8}\u{1F1F1}",
|
|
90
|
-
"57": "\u{1F1E8}\u{1F1F4}",
|
|
91
|
-
"52": "\u{1F1F2}\u{1F1FD}",
|
|
92
|
-
"598": "\u{1F1FA}\u{1F1FE}",
|
|
93
|
-
"595": "\u{1F1F5}\u{1F1FE}",
|
|
94
|
-
"44": "\u{1F1EC}\u{1F1E7}",
|
|
95
|
-
"49": "\u{1F1E9}\u{1F1EA}",
|
|
96
|
-
"39": "\u{1F1EE}\u{1F1F9}",
|
|
97
|
-
"33": "\u{1F1EB}\u{1F1F7}"
|
|
98
|
-
};
|
|
99
|
-
function phoneCountryFlag(number) {
|
|
100
|
-
const digits = number.replace(/\D/g, "");
|
|
101
|
-
for (const length of [3, 2, 1]) {
|
|
102
|
-
const flag = COUNTRY_FLAG_BY_DIAL_CODE[digits.slice(0, length)];
|
|
103
|
-
if (flag) return flag;
|
|
104
|
-
}
|
|
105
|
-
return "";
|
|
106
|
-
}
|
|
107
|
-
function phoneInitials(number) {
|
|
108
|
-
const digits = number.replace(/\D/g, "");
|
|
109
|
-
return digits.slice(-2);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// src/conversationChannel.ts
|
|
113
|
-
var CONVERSATION_CHANNEL = {
|
|
114
|
-
WHATSAPP: "whatsapp",
|
|
115
|
-
MESSENGER: "messenger",
|
|
116
|
-
INSTAGRAM: "instagram",
|
|
117
|
-
WEBCHAT: "webchat",
|
|
118
|
-
EMAIL: "email"
|
|
119
|
-
};
|
|
120
|
-
var DEFAULT_CONVERSATION_CHANNEL = CONVERSATION_CHANNEL.WHATSAPP;
|
|
121
|
-
var REOPEN_MECHANISM = {
|
|
122
|
-
TEMPLATE: "template",
|
|
123
|
-
TAG: "tag",
|
|
124
|
-
NONE: "none"
|
|
125
|
-
};
|
|
126
|
-
var HANDLE_KIND = {
|
|
127
|
-
PHONE: "phone",
|
|
128
|
-
USERNAME: "username",
|
|
129
|
-
SESSION: "session",
|
|
130
|
-
EMAIL: "email"
|
|
131
|
-
};
|
|
132
|
-
var CHANNEL_CAPABILITIES = {
|
|
133
|
-
[CONVERSATION_CHANNEL.WHATSAPP]: {
|
|
134
|
-
label: "WhatsApp",
|
|
135
|
-
icon: "\u{1F4AC}",
|
|
136
|
-
reopenMechanism: REOPEN_MECHANISM.TEMPLATE,
|
|
137
|
-
handleKind: HANDLE_KIND.PHONE
|
|
138
|
-
},
|
|
139
|
-
[CONVERSATION_CHANNEL.MESSENGER]: {
|
|
140
|
-
// Messenger também tem 24h, mas reabre com message tag — não com template aprovado.
|
|
141
|
-
label: "Messenger",
|
|
142
|
-
icon: "\u{1F4E8}",
|
|
143
|
-
reopenMechanism: REOPEN_MECHANISM.TAG,
|
|
144
|
-
handleKind: HANDLE_KIND.USERNAME
|
|
145
|
-
},
|
|
146
|
-
[CONVERSATION_CHANNEL.INSTAGRAM]: {
|
|
147
|
-
label: "Instagram",
|
|
148
|
-
icon: "\u{1F4F7}",
|
|
149
|
-
reopenMechanism: REOPEN_MECHANISM.TAG,
|
|
150
|
-
handleKind: HANDLE_KIND.USERNAME
|
|
151
|
-
},
|
|
152
|
-
[CONVERSATION_CHANNEL.WEBCHAT]: {
|
|
153
|
-
// Chat próprio: sem intermediário, sem janela. Bloquear o composer aqui seria inventar limite.
|
|
154
|
-
label: "Chat do site",
|
|
155
|
-
icon: "\u{1F310}",
|
|
156
|
-
reopenMechanism: REOPEN_MECHANISM.NONE,
|
|
157
|
-
handleKind: HANDLE_KIND.SESSION
|
|
158
|
-
},
|
|
159
|
-
[CONVERSATION_CHANNEL.EMAIL]: {
|
|
160
|
-
// RF10: e-mail entra no vocabulário; ele não reabre por template nem por tag — é só resposta.
|
|
161
|
-
label: "E-mail",
|
|
162
|
-
icon: "\u2709\uFE0F",
|
|
163
|
-
reopenMechanism: REOPEN_MECHANISM.NONE,
|
|
164
|
-
handleKind: HANDLE_KIND.EMAIL
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
function capabilitiesOf(channel) {
|
|
168
|
-
return CHANNEL_CAPABILITIES[channel ?? DEFAULT_CONVERSATION_CHANNEL];
|
|
169
|
-
}
|
|
170
|
-
var CHANNEL_FILTER_ALL = "all";
|
|
171
|
-
function channelFiltersFor(conversations) {
|
|
172
|
-
const present = new Set(
|
|
173
|
-
conversations.map((conversation) => conversation.channel ?? DEFAULT_CONVERSATION_CHANNEL)
|
|
174
|
-
);
|
|
175
|
-
if (present.size < 2) return [];
|
|
176
|
-
const ordered = Object.keys(CHANNEL_CAPABILITIES).filter((channel) => present.has(channel));
|
|
177
|
-
return [
|
|
178
|
-
{ value: CHANNEL_FILTER_ALL, label: "Todos" },
|
|
179
|
-
...ordered.map((channel) => ({ value: channel, label: CHANNEL_CAPABILITIES[channel].label }))
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
function formatContactHandle(params) {
|
|
183
|
-
const { handleKind } = capabilitiesOf(params.channel);
|
|
184
|
-
if (handleKind === HANDLE_KIND.PHONE) return formatPhone(params.handle);
|
|
185
|
-
if (handleKind === HANDLE_KIND.USERNAME) return params.handle.startsWith("@") ? params.handle : `@${params.handle}`;
|
|
186
|
-
if (handleKind === HANDLE_KIND.EMAIL) return params.handle;
|
|
187
|
-
return `Visitante ${params.handle.slice(-6)}`;
|
|
188
|
-
}
|
|
189
|
-
function contactFlag(params) {
|
|
190
|
-
return capabilitiesOf(params.channel).handleKind === HANDLE_KIND.PHONE ? phoneCountryFlag(params.handle) : "";
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// src/channelCapability.ts
|
|
194
|
-
import {
|
|
195
|
-
CHANNEL_CAPABILITIES as CORE_CHANNEL_CAPABILITIES,
|
|
196
|
-
CONVERSATION_CHANNEL as CORE_CONVERSATION_CHANNEL
|
|
197
|
-
} from "@adatechnology/conversation-contracts";
|
|
198
|
-
var CORE_CHANNELS = CORE_CONVERSATION_CHANNEL;
|
|
199
|
-
function isCoreChannel(channel) {
|
|
200
|
-
return CORE_CHANNELS.includes(channel);
|
|
201
|
-
}
|
|
202
|
-
var META_ONLY_CHANNEL_CAPABILITY = CORE_CHANNEL_CAPABILITIES.whatsapp;
|
|
203
|
-
function channelCapabilityFor(channel) {
|
|
204
|
-
const resolved = channel ?? DEFAULT_CONVERSATION_CHANNEL;
|
|
205
|
-
return isCoreChannel(resolved) ? CORE_CHANNEL_CAPABILITIES[resolved] : META_ONLY_CHANNEL_CAPABILITY;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// src/StatusTicks.tsx
|
|
209
|
-
import { AlertTriangle } from "lucide-react";
|
|
210
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
211
|
-
var STATUS_COLOR_CLASS = {
|
|
212
|
-
sent: "text-black/40 dark:text-white/40",
|
|
213
|
-
delivered: "text-black/40 dark:text-white/40",
|
|
214
|
-
read: "text-sky-500",
|
|
215
|
-
failed: "text-red-500"
|
|
216
|
-
};
|
|
217
|
-
function Ticks({ double }) {
|
|
218
|
-
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 20 12", width: "15", height: "9", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
219
|
-
double && /* @__PURE__ */ jsx2("path", { d: "M1 6.5L4.5 10L11 2", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
220
|
-
/* @__PURE__ */ jsx2(
|
|
221
|
-
"path",
|
|
222
|
-
{
|
|
223
|
-
d: double ? "M6 6.5L9.5 10L19 1" : "M1 6.5L5 10.5L14.5 1",
|
|
224
|
-
stroke: "currentColor",
|
|
225
|
-
strokeWidth: "1.6",
|
|
226
|
-
strokeLinecap: "round",
|
|
227
|
-
strokeLinejoin: "round"
|
|
228
|
-
}
|
|
229
|
-
)
|
|
230
|
-
] });
|
|
231
|
-
}
|
|
232
|
-
function StatusTicks({ status, title }) {
|
|
233
|
-
const colorClass = STATUS_COLOR_CLASS[status] ?? STATUS_COLOR_CLASS.sent;
|
|
234
|
-
return /* @__PURE__ */ jsx2("span", { className: `cursor-help leading-none flex items-center ${colorClass}`, "data-cv-tooltip": title, children: status === "failed" ? /* @__PURE__ */ jsx2(AlertTriangle, { size: 11 }) : /* @__PURE__ */ jsx2(Ticks, { double: status !== "sent" }) });
|
|
235
|
-
}
|
|
236
|
-
|
|
237
80
|
// src/AudioPlayer.tsx
|
|
238
81
|
import { useEffect, useRef, useState } from "react";
|
|
239
82
|
import { Pause, Play } from "lucide-react";
|
|
240
|
-
import { jsx as
|
|
83
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
241
84
|
var BARS = Array.from({ length: 30 }, (_, i) => {
|
|
242
85
|
const heights = [3, 5, 8, 12, 7, 10, 14, 9, 6, 11, 15, 8, 4, 13, 7, 10, 6, 12, 9, 5, 14, 8, 11, 6, 13, 7, 10, 5, 9, 4];
|
|
243
86
|
return heights[i % heights.length];
|
|
@@ -302,20 +145,20 @@ function AudioPlayer({ src, isMine = false }) {
|
|
|
302
145
|
const playBtn = isMine ? "bg-green-600 hover:bg-green-700 text-white" : "bg-gray-600 hover:bg-gray-700 text-white";
|
|
303
146
|
const activeBar = isMine ? "bg-green-700" : "bg-gray-700";
|
|
304
147
|
const inactiveBar = isMine ? "bg-green-300" : "bg-gray-300";
|
|
305
|
-
return /* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
148
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 w-full", style: { minWidth: "200px", maxWidth: "260px" }, children: [
|
|
149
|
+
/* @__PURE__ */ jsx2("audio", { ref: audioRef, src, preload: "metadata" }),
|
|
150
|
+
/* @__PURE__ */ jsx2(
|
|
308
151
|
"button",
|
|
309
152
|
{
|
|
310
153
|
"data-cv-tooltip": playing ? AUDIO_PLAYER_LABELS.pause : AUDIO_PLAYER_LABELS.play,
|
|
311
154
|
"aria-label": playing ? AUDIO_PLAYER_LABELS.pause : AUDIO_PLAYER_LABELS.play,
|
|
312
155
|
onClick: toggle,
|
|
313
156
|
className: `flex-shrink-0 w-9 h-9 rounded-full flex items-center justify-center transition-colors ${playBtn}`,
|
|
314
|
-
children: playing ? /* @__PURE__ */
|
|
157
|
+
children: playing ? /* @__PURE__ */ jsx2(Pause, { size: 16 }) : /* @__PURE__ */ jsx2(Play, { size: 16, className: "translate-x-0.5" })
|
|
315
158
|
}
|
|
316
159
|
),
|
|
317
|
-
/* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-1", children: [
|
|
161
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-end gap-0.5 h-8 cursor-pointer", onClick: seek, children: BARS.map((h, i) => /* @__PURE__ */ jsx2(
|
|
319
162
|
"div",
|
|
320
163
|
{
|
|
321
164
|
className: `flex-1 rounded-full transition-colors ${i < activeBars ? activeBar : inactiveBar}`,
|
|
@@ -323,7 +166,7 @@ function AudioPlayer({ src, isMine = false }) {
|
|
|
323
166
|
},
|
|
324
167
|
i
|
|
325
168
|
)) }),
|
|
326
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ jsx2("span", { className: "text-gray-400 tabular-nums text-xs", children: playing || current > 0 ? fmt(current) : fmt(duration) })
|
|
327
170
|
] })
|
|
328
171
|
] });
|
|
329
172
|
}
|
|
@@ -331,7 +174,7 @@ function AudioPlayer({ src, isMine = false }) {
|
|
|
331
174
|
// src/AudioTranscription.tsx
|
|
332
175
|
import { useCallback, useState as useState2 } from "react";
|
|
333
176
|
import { Check, Copy, FileText, Loader2, RefreshCw } from "lucide-react";
|
|
334
|
-
import { Fragment, jsx as
|
|
177
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
335
178
|
var COPIED_FEEDBACK_MS = 2e3;
|
|
336
179
|
var COLLAPSE_ABOVE_CHARS = 320;
|
|
337
180
|
var COLLAPSED_LINE_CLAMP = 4;
|
|
@@ -375,7 +218,7 @@ function AudioTranscription({ transcription, onTranscribe, isMine = false }) {
|
|
|
375
218
|
const dividerClass = isMine ? "border-black/10 dark:border-white/10" : "border-black/10 dark:border-white/10";
|
|
376
219
|
if (!status && !onTranscribe) return null;
|
|
377
220
|
if (!status || status === "pending" || status === "failed") {
|
|
378
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ jsx3("div", { className: `mt-1.5 border-t pt-1.5 ${dividerClass}`, children: /* @__PURE__ */ jsx3(
|
|
379
222
|
TranscribeButton,
|
|
380
223
|
{
|
|
381
224
|
label: resolveActionLabel({ status, hasRequestFailed, isTranscribing, locales }),
|
|
@@ -386,31 +229,31 @@ function AudioTranscription({ transcription, onTranscribe, isMine = false }) {
|
|
|
386
229
|
) });
|
|
387
230
|
}
|
|
388
231
|
if (status === "unsupported") {
|
|
389
|
-
return /* @__PURE__ */
|
|
232
|
+
return /* @__PURE__ */ jsx3("div", { className: `mt-1.5 border-t pt-1.5 ${dividerClass}`, children: /* @__PURE__ */ jsx3("p", { className: "text-xs italic text-gray-500 dark:text-gray-400", children: locales.unsupported }) });
|
|
390
233
|
}
|
|
391
|
-
return /* @__PURE__ */
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
hasText && /* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ jsxs2("div", { className: `mt-1.5 border-t pt-1.5 ${dividerClass}`, children: [
|
|
235
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-0.5 flex items-center gap-1.5", children: [
|
|
236
|
+
/* @__PURE__ */ jsx3(FileText, { size: 11, className: "flex-shrink-0 text-gray-500 dark:text-gray-400", "aria-hidden": true }),
|
|
237
|
+
/* @__PURE__ */ jsx3("span", { className: "text-[11px] font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400", children: locales.label }),
|
|
238
|
+
hasText && /* @__PURE__ */ jsx3(
|
|
396
239
|
"button",
|
|
397
240
|
{
|
|
398
241
|
onClick: handleCopy,
|
|
399
242
|
"data-cv-tooltip": locales.copy,
|
|
400
243
|
"aria-label": hasCopied ? locales.copied : locales.copy,
|
|
401
244
|
className: "ml-auto flex flex-shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-gray-500 transition-colors hover:bg-black/5 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-gray-200",
|
|
402
|
-
children: hasCopied ? /* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
] }) : /* @__PURE__ */
|
|
406
|
-
/* @__PURE__ */
|
|
407
|
-
/* @__PURE__ */
|
|
245
|
+
children: hasCopied ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
246
|
+
/* @__PURE__ */ jsx3(Check, { size: 11, "aria-hidden": true }),
|
|
247
|
+
/* @__PURE__ */ jsx3("span", { children: locales.copied })
|
|
248
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
249
|
+
/* @__PURE__ */ jsx3(Copy, { size: 11, "aria-hidden": true }),
|
|
250
|
+
/* @__PURE__ */ jsx3("span", { children: locales.copy })
|
|
408
251
|
] })
|
|
409
252
|
}
|
|
410
253
|
)
|
|
411
254
|
] }),
|
|
412
|
-
isSilent ? /* @__PURE__ */
|
|
413
|
-
/* @__PURE__ */
|
|
255
|
+
isSilent ? /* @__PURE__ */ jsx3("p", { className: "text-xs italic text-gray-500 dark:text-gray-400", children: locales.empty }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
256
|
+
/* @__PURE__ */ jsx3(
|
|
414
257
|
"p",
|
|
415
258
|
{
|
|
416
259
|
className: cn(
|
|
@@ -425,7 +268,7 @@ function AudioTranscription({ transcription, onTranscribe, isMine = false }) {
|
|
|
425
268
|
children: text
|
|
426
269
|
}
|
|
427
270
|
),
|
|
428
|
-
isLong && /* @__PURE__ */
|
|
271
|
+
isLong && /* @__PURE__ */ jsx3(
|
|
429
272
|
"button",
|
|
430
273
|
{
|
|
431
274
|
"data-cv-tooltip": isExpanded ? locales.showLess : locales.showMore,
|
|
@@ -436,7 +279,7 @@ function AudioTranscription({ transcription, onTranscribe, isMine = false }) {
|
|
|
436
279
|
}
|
|
437
280
|
)
|
|
438
281
|
] }),
|
|
439
|
-
onTranscribe && /* @__PURE__ */
|
|
282
|
+
onTranscribe && /* @__PURE__ */ jsxs2(
|
|
440
283
|
"button",
|
|
441
284
|
{
|
|
442
285
|
"data-cv-tooltip": isTranscribing ? locales.transcribing : locales.retry,
|
|
@@ -445,8 +288,8 @@ function AudioTranscription({ transcription, onTranscribe, isMine = false }) {
|
|
|
445
288
|
disabled: isTranscribing,
|
|
446
289
|
className: "mt-1 flex items-center gap-1 text-[11px] text-gray-400 opacity-0 transition-opacity hover:text-gray-600 focus:opacity-100 group-hover:opacity-100 disabled:opacity-50 dark:text-gray-500 dark:hover:text-gray-300",
|
|
447
290
|
children: [
|
|
448
|
-
isTranscribing ? /* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
291
|
+
isTranscribing ? /* @__PURE__ */ jsx3(Loader2, { size: 10, className: "animate-spin", "aria-hidden": true }) : /* @__PURE__ */ jsx3(RefreshCw, { size: 10, "aria-hidden": true }),
|
|
292
|
+
/* @__PURE__ */ jsx3("span", { children: isTranscribing ? locales.transcribing : locales.retry })
|
|
450
293
|
]
|
|
451
294
|
}
|
|
452
295
|
)
|
|
@@ -465,7 +308,7 @@ function TranscribeButton({
|
|
|
465
308
|
isDisabled,
|
|
466
309
|
onClick
|
|
467
310
|
}) {
|
|
468
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ jsxs2(
|
|
469
312
|
"button",
|
|
470
313
|
{
|
|
471
314
|
"data-cv-tooltip": label,
|
|
@@ -474,8 +317,8 @@ function TranscribeButton({
|
|
|
474
317
|
disabled: isBusy || isDisabled,
|
|
475
318
|
className: "flex items-center gap-1.5 rounded px-1.5 py-0.5 text-[11px] text-gray-500 transition-colors hover:bg-black/5 hover:text-gray-700 disabled:opacity-60 dark:text-gray-400 dark:hover:bg-white/10 dark:hover:text-gray-200",
|
|
476
319
|
children: [
|
|
477
|
-
isBusy ? /* @__PURE__ */
|
|
478
|
-
/* @__PURE__ */
|
|
320
|
+
isBusy ? /* @__PURE__ */ jsx3(Loader2, { size: 11, className: "animate-spin", "aria-hidden": true }) : /* @__PURE__ */ jsx3(FileText, { size: 11, "aria-hidden": true }),
|
|
321
|
+
/* @__PURE__ */ jsx3("span", { children: label })
|
|
479
322
|
]
|
|
480
323
|
}
|
|
481
324
|
);
|
|
@@ -492,7 +335,7 @@ import {
|
|
|
492
335
|
File as FileGeneric,
|
|
493
336
|
Presentation
|
|
494
337
|
} from "lucide-react";
|
|
495
|
-
import { jsx as
|
|
338
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
496
339
|
var IMAGE_STYLE = { Icon: FileImage, colorClass: "text-violet-500" };
|
|
497
340
|
var VIDEO_STYLE = { Icon: FileVideo, colorClass: "text-fuchsia-500" };
|
|
498
341
|
var AUDIO_STYLE = { Icon: FileAudio, colorClass: "text-amber-500" };
|
|
@@ -548,40 +391,12 @@ function FileIcon({ filename, mimeType, size = 20, className }) {
|
|
|
548
391
|
const extension = resolveFileIconExtension(filename, mimeType);
|
|
549
392
|
const style = EXTENSION_STYLE[extension] ?? { Icon: FileGeneric, colorClass: "text-gray-500" };
|
|
550
393
|
const { Icon, colorClass } = style;
|
|
551
|
-
return /* @__PURE__ */
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// src/lib/format.ts
|
|
555
|
-
function formatTimestamp(timestamp) {
|
|
556
|
-
try {
|
|
557
|
-
const date = new Date(timestamp);
|
|
558
|
-
const hours = date.getHours().toString().padStart(2, "0");
|
|
559
|
-
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
560
|
-
return `${hours}:${minutes}`;
|
|
561
|
-
} catch {
|
|
562
|
-
return timestamp;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
function formatDateTime(iso) {
|
|
566
|
-
const d = new Date(iso);
|
|
567
|
-
return d.toLocaleString("pt-BR", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit" });
|
|
568
|
-
}
|
|
569
|
-
function isSameDay(a, b) {
|
|
570
|
-
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
571
|
-
}
|
|
572
|
-
var FILE_SIZE_UNITS = ["B", "KB", "MB", "GB"];
|
|
573
|
-
function formatFileSize(bytes) {
|
|
574
|
-
if (!isFinite(bytes) || bytes < 0) return "";
|
|
575
|
-
if (bytes < 1) return "0 B";
|
|
576
|
-
const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), FILE_SIZE_UNITS.length - 1);
|
|
577
|
-
const value = bytes / 1024 ** exponent;
|
|
578
|
-
const formatted = exponent === 0 ? value.toString() : value.toFixed(value < 10 ? 1 : 0);
|
|
579
|
-
return `${formatted} ${FILE_SIZE_UNITS[exponent]}`;
|
|
394
|
+
return /* @__PURE__ */ jsx4(Icon, { size, className: cn(colorClass, className) });
|
|
580
395
|
}
|
|
581
396
|
|
|
582
397
|
// src/MediaRenderer.tsx
|
|
583
398
|
import { useState as useState3 } from "react";
|
|
584
|
-
import { jsx as
|
|
399
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
585
400
|
function documentTypeLabel(filename, mimeType) {
|
|
586
401
|
const extension = filename?.split(".").pop();
|
|
587
402
|
if (extension && extension.length <= 5 && extension !== filename) return extension.toUpperCase();
|
|
@@ -634,7 +449,7 @@ function MediaRenderer({
|
|
|
634
449
|
const src = eagerSrc ?? lazy.url;
|
|
635
450
|
const canLazyLoad = !eagerSrc && hasLazyRef(message) && Boolean(onResolveUrl);
|
|
636
451
|
function LazyMediaButton({ icon, label }) {
|
|
637
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ jsxs3(
|
|
638
453
|
"button",
|
|
639
454
|
{
|
|
640
455
|
"data-cv-tooltip": label,
|
|
@@ -643,8 +458,8 @@ function MediaRenderer({
|
|
|
643
458
|
disabled: lazy.loading,
|
|
644
459
|
className: "flex min-w-[180px] items-center gap-2 rounded-lg bg-black/5 px-2 py-1.5 text-left transition-colors hover:bg-black/10 disabled:opacity-60 dark:bg-white/10 dark:hover:bg-white/15",
|
|
645
460
|
children: [
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ jsx5("span", { className: "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full bg-gray-600 text-white", children: icon }),
|
|
462
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate text-xs text-gray-600 dark:text-gray-300", children: label })
|
|
648
463
|
]
|
|
649
464
|
}
|
|
650
465
|
);
|
|
@@ -653,44 +468,44 @@ function MediaRenderer({
|
|
|
653
468
|
case "image":
|
|
654
469
|
case "sticker": {
|
|
655
470
|
if (!src && canLazyLoad) {
|
|
656
|
-
return /* @__PURE__ */
|
|
471
|
+
return /* @__PURE__ */ jsx5(
|
|
657
472
|
LazyMediaButton,
|
|
658
473
|
{
|
|
659
|
-
icon: /* @__PURE__ */
|
|
660
|
-
/* @__PURE__ */
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
474
|
+
icon: /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
475
|
+
/* @__PURE__ */ jsx5("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
476
|
+
/* @__PURE__ */ jsx5("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
477
|
+
/* @__PURE__ */ jsx5("polyline", { points: "21 15 16 10 5 21" })
|
|
663
478
|
] }),
|
|
664
479
|
label: lazy.loading ? bubble.mediaLoading : lazy.error ? bubble.mediaRetry : bubble.viewImage
|
|
665
480
|
}
|
|
666
481
|
);
|
|
667
482
|
}
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
483
|
+
return /* @__PURE__ */ jsx5("div", { className: "min-w-[200px]", children: src ? /* @__PURE__ */ jsx5("img", { src, alt: message.caption ?? bubble.imageAlt, className: "w-full max-h-80 object-cover cursor-pointer hover:opacity-90 transition-opacity", onClick: () => onLightbox(src), loading: "lazy" }) : /* @__PURE__ */ jsx5("div", { className: "w-full h-40 bg-gray-200 flex items-center justify-center text-gray-400", children: /* @__PURE__ */ jsxs3("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
484
|
+
/* @__PURE__ */ jsx5("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
485
|
+
/* @__PURE__ */ jsx5("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
486
|
+
/* @__PURE__ */ jsx5("polyline", { points: "21 15 16 10 5 21" })
|
|
672
487
|
] }) }) });
|
|
673
488
|
}
|
|
674
489
|
case "video": {
|
|
675
490
|
if (!src && canLazyLoad) {
|
|
676
|
-
return /* @__PURE__ */
|
|
491
|
+
return /* @__PURE__ */ jsx5(
|
|
677
492
|
LazyMediaButton,
|
|
678
493
|
{
|
|
679
|
-
icon: /* @__PURE__ */
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
494
|
+
icon: /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
495
|
+
/* @__PURE__ */ jsx5("polygon", { points: "23 7 16 12 23 17 23 7" }),
|
|
496
|
+
/* @__PURE__ */ jsx5("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2", ry: "2" })
|
|
682
497
|
] }),
|
|
683
498
|
label: lazy.loading ? bubble.mediaLoading : lazy.error ? bubble.mediaRetry : bubble.viewVideo
|
|
684
499
|
}
|
|
685
500
|
);
|
|
686
501
|
}
|
|
687
|
-
return /* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
502
|
+
return /* @__PURE__ */ jsx5("div", { className: "min-w-[200px]", children: src ? /* @__PURE__ */ jsx5("video", { src, className: "w-full max-h-80 rounded-lg", controls: true, preload: "metadata", children: /* @__PURE__ */ jsx5("track", { kind: "captions" }) }) : /* @__PURE__ */ jsx5("div", { className: "w-full h-32 bg-gray-200 rounded-lg flex items-center justify-center text-gray-400", children: /* @__PURE__ */ jsxs3("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
503
|
+
/* @__PURE__ */ jsx5("polygon", { points: "23 7 16 12 23 17 23 7" }),
|
|
504
|
+
/* @__PURE__ */ jsx5("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2", ry: "2" })
|
|
690
505
|
] }) }) });
|
|
691
506
|
}
|
|
692
507
|
case "audio": {
|
|
693
|
-
const transcriptionBlock = /* @__PURE__ */
|
|
508
|
+
const transcriptionBlock = /* @__PURE__ */ jsx5(
|
|
694
509
|
AudioTranscription,
|
|
695
510
|
{
|
|
696
511
|
transcription: message.transcription,
|
|
@@ -699,36 +514,36 @@ function MediaRenderer({
|
|
|
699
514
|
}
|
|
700
515
|
);
|
|
701
516
|
if (!src && canLazyLoad) {
|
|
702
|
-
return /* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ jsxs3("div", { className: "min-w-[200px]", children: [
|
|
518
|
+
/* @__PURE__ */ jsx5(
|
|
704
519
|
LazyMediaButton,
|
|
705
520
|
{
|
|
706
|
-
icon: /* @__PURE__ */
|
|
521
|
+
icon: /* @__PURE__ */ jsx5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", className: "translate-x-0.5", children: /* @__PURE__ */ jsx5("polygon", { points: "5 3 19 12 5 21 5 3" }) }),
|
|
707
522
|
label: lazy.loading ? bubble.mediaLoading : lazy.error ? bubble.mediaRetry : bubble.listenAudio
|
|
708
523
|
}
|
|
709
524
|
),
|
|
710
525
|
transcriptionBlock
|
|
711
526
|
] });
|
|
712
527
|
}
|
|
713
|
-
return /* @__PURE__ */
|
|
714
|
-
src ? /* @__PURE__ */
|
|
528
|
+
return /* @__PURE__ */ jsxs3("div", { className: "min-w-[200px]", children: [
|
|
529
|
+
src ? /* @__PURE__ */ jsx5(AudioPlayer, { src, isMine: message.direction === "outbound" }) : /* @__PURE__ */ jsx5("div", { className: "h-12 bg-gray-200 rounded-lg flex items-center justify-center text-gray-400 text-xs", children: bubble.mediaUnavailable }),
|
|
715
530
|
transcriptionBlock
|
|
716
531
|
] });
|
|
717
532
|
}
|
|
718
533
|
case "document": {
|
|
719
534
|
const typeLabel = documentTypeLabel(message.filename, message.mimeType);
|
|
720
535
|
const sizeLabel = message.sizeBytes ? formatFileSize(message.sizeBytes) : null;
|
|
721
|
-
return /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
536
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("flex items-center gap-3 min-w-[200px]", className), children: [
|
|
537
|
+
/* @__PURE__ */ jsx5("div", { className: "w-10 h-10 bg-gray-200 rounded-lg flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx5(FileIcon, { filename: message.filename, mimeType: message.mimeType }) }),
|
|
538
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-1 min-w-0", children: [
|
|
539
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm font-medium truncate", children: message.filename ?? bubble.untitledDocument }),
|
|
540
|
+
/* @__PURE__ */ jsx5("p", { className: "truncate text-xs text-gray-500", children: sizeLabel ? `${typeLabel} \xB7 ${sizeLabel}` : typeLabel })
|
|
726
541
|
] }),
|
|
727
|
-
src ? /* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
-
] }) }) : canLazyLoad ? /* @__PURE__ */
|
|
542
|
+
src ? /* @__PURE__ */ jsx5("a", { href: src, download: message.filename, className: "w-8 h-8 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 flex-shrink-0 transition-colors", "aria-label": bubble.downloadFile, children: /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "text-gray-600", children: [
|
|
543
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
544
|
+
/* @__PURE__ */ jsx5("polyline", { points: "7 10 12 15 17 10" }),
|
|
545
|
+
/* @__PURE__ */ jsx5("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
546
|
+
] }) }) : canLazyLoad ? /* @__PURE__ */ jsx5(
|
|
732
547
|
"button",
|
|
733
548
|
{
|
|
734
549
|
"data-cv-tooltip": bubble.downloadFile,
|
|
@@ -736,14 +551,14 @@ function MediaRenderer({
|
|
|
736
551
|
disabled: lazy.loading,
|
|
737
552
|
className: "w-8 h-8 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 flex-shrink-0 transition-colors disabled:opacity-50",
|
|
738
553
|
"aria-label": bubble.downloadFile,
|
|
739
|
-
children: /* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
554
|
+
children: /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "text-gray-600", children: [
|
|
555
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
556
|
+
/* @__PURE__ */ jsx5("polyline", { points: "7 10 12 15 17 10" }),
|
|
557
|
+
/* @__PURE__ */ jsx5("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
743
558
|
] })
|
|
744
559
|
}
|
|
745
560
|
) : null,
|
|
746
|
-
lazy.error && /* @__PURE__ */
|
|
561
|
+
lazy.error && /* @__PURE__ */ jsx5("span", { className: "text-xs text-red-500 flex-shrink-0", children: bubble.mediaError })
|
|
747
562
|
] });
|
|
748
563
|
}
|
|
749
564
|
default:
|
|
@@ -752,7 +567,7 @@ function MediaRenderer({
|
|
|
752
567
|
}
|
|
753
568
|
|
|
754
569
|
// src/Lightbox.tsx
|
|
755
|
-
import { jsx as
|
|
570
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
756
571
|
var DEFAULT_LIGHTBOX_LABELS = {
|
|
757
572
|
imageAlt: "Imagem",
|
|
758
573
|
close: "Fechar"
|
|
@@ -760,16 +575,16 @@ var DEFAULT_LIGHTBOX_LABELS = {
|
|
|
760
575
|
function Lightbox({ imageUrl, caption, onClose, labels }) {
|
|
761
576
|
const imageAltLabel = labels?.imageAlt ?? DEFAULT_LIGHTBOX_LABELS.imageAlt;
|
|
762
577
|
const closeLabel = labels?.close ?? DEFAULT_LIGHTBOX_LABELS.close;
|
|
763
|
-
return /* @__PURE__ */
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
caption && /* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
578
|
+
return /* @__PURE__ */ jsx6("div", { className: "fixed inset-0 z-50 bg-black/85 flex items-center justify-center p-4", onClick: onClose, children: /* @__PURE__ */ jsxs4("div", { className: "max-w-[90vw] max-h-[90vh] flex flex-col items-center", onClick: (e) => e.stopPropagation(), children: [
|
|
579
|
+
/* @__PURE__ */ jsx6("img", { src: imageUrl, alt: caption ?? imageAltLabel, className: "max-w-full max-h-[80vh] object-contain rounded-lg" }),
|
|
580
|
+
caption && /* @__PURE__ */ jsx6("p", { className: "text-white text-sm mt-3 text-center", children: caption }),
|
|
581
|
+
/* @__PURE__ */ jsx6("button", { "data-cv-tooltip": closeLabel, "aria-label": closeLabel, onClick: onClose, className: "mt-4 px-4 py-2 bg-white/20 text-white rounded-lg hover:bg-white/30 transition-colors", children: closeLabel })
|
|
767
582
|
] }) });
|
|
768
583
|
}
|
|
769
584
|
|
|
770
585
|
// src/InteractiveMessage.tsx
|
|
771
586
|
import { useState as useState4 } from "react";
|
|
772
|
-
import { jsx as
|
|
587
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
773
588
|
var FORMATTING_CLASSES = "[&_strong]:font-bold [&_em]:italic [&_del]:line-through";
|
|
774
589
|
var DEFAULT_INTERACTIVE_MESSAGE_LABELS = {
|
|
775
590
|
openList: "Ver op\xE7\xF5es"
|
|
@@ -787,17 +602,17 @@ function InteractiveMessage({ payload, onSelect, labels, className }) {
|
|
|
787
602
|
const sections = payload.action?.sections ?? [];
|
|
788
603
|
const hasRows = collectRows(payload).length > 0;
|
|
789
604
|
const isInteractable = onSelect !== void 0;
|
|
790
|
-
return /* @__PURE__ */
|
|
791
|
-
payload.header?.text ? /* @__PURE__ */
|
|
792
|
-
payload.body?.text ? /* @__PURE__ */
|
|
605
|
+
return /* @__PURE__ */ jsxs5("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
606
|
+
payload.header?.text ? /* @__PURE__ */ jsx7("div", { className: cn("text-sm font-semibold text-gray-900 dark:text-gray-100", FORMATTING_CLASSES), children: parseWhatsAppFormatting(payload.header.text) }) : null,
|
|
607
|
+
payload.body?.text ? /* @__PURE__ */ jsx7(
|
|
793
608
|
"div",
|
|
794
609
|
{
|
|
795
610
|
className: cn("whitespace-pre-wrap break-words text-sm text-gray-900 dark:text-gray-100", FORMATTING_CLASSES),
|
|
796
611
|
children: parseWhatsAppFormatting(payload.body.text)
|
|
797
612
|
}
|
|
798
613
|
) : null,
|
|
799
|
-
payload.footer?.text ? /* @__PURE__ */
|
|
800
|
-
buttons.length > 0 ? /* @__PURE__ */
|
|
614
|
+
payload.footer?.text ? /* @__PURE__ */ jsx7("div", { className: cn("text-xs text-gray-500 dark:text-gray-400", FORMATTING_CLASSES), children: parseWhatsAppFormatting(payload.footer.text) }) : null,
|
|
615
|
+
buttons.length > 0 ? /* @__PURE__ */ jsx7("div", { className: "mt-1 flex flex-col gap-1 border-t border-gray-200 pt-1 dark:border-gray-700", children: buttons.map((button) => /* @__PURE__ */ jsx7(
|
|
801
616
|
"button",
|
|
802
617
|
{
|
|
803
618
|
"data-cv-tooltip": button.title,
|
|
@@ -810,8 +625,8 @@ function InteractiveMessage({ payload, onSelect, labels, className }) {
|
|
|
810
625
|
},
|
|
811
626
|
button.id
|
|
812
627
|
)) }) : null,
|
|
813
|
-
hasRows ? /* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */
|
|
628
|
+
hasRows ? /* @__PURE__ */ jsxs5("div", { className: "mt-1 border-t border-gray-200 pt-1 dark:border-gray-700", children: [
|
|
629
|
+
/* @__PURE__ */ jsxs5(
|
|
815
630
|
"button",
|
|
816
631
|
{
|
|
817
632
|
"data-cv-tooltip": payload.action?.button ?? openListLabel,
|
|
@@ -826,9 +641,9 @@ function InteractiveMessage({ payload, onSelect, labels, className }) {
|
|
|
826
641
|
]
|
|
827
642
|
}
|
|
828
643
|
),
|
|
829
|
-
isListOpen ? /* @__PURE__ */
|
|
830
|
-
section.title ? /* @__PURE__ */
|
|
831
|
-
(section.rows ?? []).map((row) => /* @__PURE__ */
|
|
644
|
+
isListOpen ? /* @__PURE__ */ jsx7("div", { className: "mt-1 flex flex-col gap-1", children: sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs5("div", { className: "flex flex-col", children: [
|
|
645
|
+
section.title ? /* @__PURE__ */ jsx7("p", { className: "px-3 py-1 text-xs font-semibold uppercase text-gray-500 dark:text-gray-400", children: section.title }) : null,
|
|
646
|
+
(section.rows ?? []).map((row) => /* @__PURE__ */ jsxs5(
|
|
832
647
|
"button",
|
|
833
648
|
{
|
|
834
649
|
"data-cv-tooltip": row.title,
|
|
@@ -838,8 +653,8 @@ function InteractiveMessage({ payload, onSelect, labels, className }) {
|
|
|
838
653
|
onClick: () => onSelect?.({ kind: "list", option: row }),
|
|
839
654
|
className: "rounded-md px-3 py-1.5 text-left text-sm text-gray-900 transition-colors enabled:hover:bg-gray-100 disabled:cursor-default dark:text-gray-100 dark:enabled:hover:bg-gray-700",
|
|
840
655
|
children: [
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
row.description ? /* @__PURE__ */
|
|
656
|
+
/* @__PURE__ */ jsx7("span", { className: "block", children: row.title }),
|
|
657
|
+
row.description ? /* @__PURE__ */ jsx7("span", { className: "block text-xs text-gray-500 dark:text-gray-400", children: row.description }) : null
|
|
843
658
|
]
|
|
844
659
|
},
|
|
845
660
|
row.id
|
|
@@ -863,7 +678,7 @@ function createMediaUrlResolver(api) {
|
|
|
863
678
|
|
|
864
679
|
// src/providers/ConversationsProvider.tsx
|
|
865
680
|
import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
|
|
866
|
-
import { jsx as
|
|
681
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
867
682
|
var ConversationsContext = createContext2(null);
|
|
868
683
|
function ConversationsProvider({
|
|
869
684
|
api,
|
|
@@ -871,7 +686,7 @@ function ConversationsProvider({
|
|
|
871
686
|
children
|
|
872
687
|
}) {
|
|
873
688
|
const value = useMemo(() => ({ api, sse }), [api, sse]);
|
|
874
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ jsx8(ConversationsContext.Provider, { value, children });
|
|
875
690
|
}
|
|
876
691
|
function useConversations() {
|
|
877
692
|
return useContext2(ConversationsContext);
|
|
@@ -880,7 +695,7 @@ function useConversations() {
|
|
|
880
695
|
// src/MessageBubble.tsx
|
|
881
696
|
import { useMemo as useMemo2, useState as useState5 } from "react";
|
|
882
697
|
import { Check as Check2 } from "lucide-react";
|
|
883
|
-
import { Fragment as Fragment2, jsx as
|
|
698
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
884
699
|
var BUBBLE_COLOR = {
|
|
885
700
|
agent: "bg-[#d9fdd3] dark:bg-[#005c4b]",
|
|
886
701
|
bot: "bg-[#d7f0ec] dark:bg-[#0a3d3a]",
|
|
@@ -927,7 +742,7 @@ function MessageBubble({
|
|
|
927
742
|
const displayName = message.sender === "agent" && senderName ? senderName : bubble[message.sender] ?? message.sender;
|
|
928
743
|
const tooltipText = displayStatus === "read" && message.readAt ? `${bubble.readAt}${formatDateTime(message.readAt)}` : displayStatus === "failed" ? bubble.windowExpired : void 0;
|
|
929
744
|
const tailCornerClass = isFirstInGroup ? isMine ? "rounded-tr-md" : "rounded-tl-md" : "";
|
|
930
|
-
const checkbox = /* @__PURE__ */
|
|
745
|
+
const checkbox = /* @__PURE__ */ jsx9(
|
|
931
746
|
"button",
|
|
932
747
|
{
|
|
933
748
|
onClick: (e) => {
|
|
@@ -941,10 +756,10 @@ function MessageBubble({
|
|
|
941
756
|
${isSelected ? "bg-teal-600 border-teal-600" : "bg-white/80 dark:bg-black/40 border-black/20 dark:border-white/30"}
|
|
942
757
|
${isSelecting ? "opacity-100" : "opacity-0 group-hover:opacity-100"}
|
|
943
758
|
`,
|
|
944
|
-
children: isSelected && /* @__PURE__ */
|
|
759
|
+
children: isSelected && /* @__PURE__ */ jsx9(Check2, { size: 12, className: "text-white", strokeWidth: 3 })
|
|
945
760
|
}
|
|
946
761
|
);
|
|
947
|
-
return /* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ jsxs6(
|
|
948
763
|
"div",
|
|
949
764
|
{
|
|
950
765
|
className: cn(
|
|
@@ -955,7 +770,7 @@ function MessageBubble({
|
|
|
955
770
|
),
|
|
956
771
|
children: [
|
|
957
772
|
isMine && checkbox,
|
|
958
|
-
/* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ jsxs6(
|
|
959
774
|
"div",
|
|
960
775
|
{
|
|
961
776
|
onClick: isSelecting ? onToggleSelect : void 0,
|
|
@@ -968,20 +783,20 @@ function MessageBubble({
|
|
|
968
783
|
relative
|
|
969
784
|
`,
|
|
970
785
|
children: [
|
|
971
|
-
isMine && isFirstInGroup && (message.sender === "bot" || message.sender === "agent" && senderName) && /* @__PURE__ */
|
|
972
|
-
message.moderation?.isOffensive && /* @__PURE__ */
|
|
786
|
+
isMine && isFirstInGroup && (message.sender === "bot" || message.sender === "agent" && senderName) && /* @__PURE__ */ jsx9("div", { className: "text-xs font-semibold mb-0.5 text-teal-700 dark:text-teal-400", children: displayName }),
|
|
787
|
+
message.moderation?.isOffensive && /* @__PURE__ */ jsxs6(
|
|
973
788
|
"div",
|
|
974
789
|
{
|
|
975
790
|
className: "mb-1 inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",
|
|
976
791
|
"data-cv-tooltip": message.moderation.terms.length > 0 ? message.moderation.terms.join(", ") : void 0,
|
|
977
792
|
children: [
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": true, children: "\u26A0\uFE0F" }),
|
|
794
|
+
/* @__PURE__ */ jsx9("span", { children: bubble.moderationFlagged })
|
|
980
795
|
]
|
|
981
796
|
}
|
|
982
797
|
),
|
|
983
|
-
isMedia ? /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
798
|
+
isMedia ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
799
|
+
/* @__PURE__ */ jsx9(
|
|
985
800
|
MediaRenderer,
|
|
986
801
|
{
|
|
987
802
|
message,
|
|
@@ -990,30 +805,30 @@ function MessageBubble({
|
|
|
990
805
|
...requestTranscription ? { onTranscribeAudio: requestTranscription } : {}
|
|
991
806
|
}
|
|
992
807
|
),
|
|
993
|
-
mediaCaption ? /* @__PURE__ */
|
|
808
|
+
mediaCaption ? /* @__PURE__ */ jsx9("div", { className: "mt-1 text-sm text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words leading-[19px]", children: parseWhatsAppFormatting(mediaCaption) }) : null
|
|
994
809
|
] }) : isInteractive && message.payload ? (
|
|
995
810
|
// O texto da mensagem interativa mora dentro do payload (`body.text`), e `content` guarda
|
|
996
811
|
// só uma cópia achatada para busca — renderizar `content` aqui duplicaria o corpo.
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
) : /* @__PURE__ */
|
|
999
|
-
isTemplate && /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ jsx9(InteractiveMessage, { payload: message.payload, onSelect: onInteractiveSelect })
|
|
813
|
+
) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
814
|
+
isTemplate && /* @__PURE__ */ jsxs6("p", { className: "text-xs text-gray-500 dark:text-gray-400 flex items-center gap-1 mb-0.5", children: [
|
|
815
|
+
/* @__PURE__ */ jsx9("span", { children: "\u{1F4E8}" }),
|
|
816
|
+
/* @__PURE__ */ jsxs6("span", { className: "font-medium", children: [
|
|
1002
817
|
bubble.templateLabel,
|
|
1003
818
|
message.templateName ? ` \u2014 ${message.templateName}` : ""
|
|
1004
819
|
] })
|
|
1005
820
|
] }),
|
|
1006
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ jsx9("div", { className: "text-sm text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words leading-[19px]", children: parseWhatsAppFormatting(message.content ?? "") })
|
|
1007
822
|
] }),
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
isMine && displayStatus && /* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-end gap-1 mt-0.5 select-none", children: [
|
|
824
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs text-black/40 dark:text-white/40 font-medium", children: formatTimestamp(message.timestamp) }),
|
|
825
|
+
isMine && displayStatus && /* @__PURE__ */ jsx9(StatusTicks, { status: displayStatus, title: tooltipText })
|
|
1011
826
|
] })
|
|
1012
827
|
]
|
|
1013
828
|
}
|
|
1014
829
|
),
|
|
1015
830
|
!isMine && checkbox,
|
|
1016
|
-
lightboxSrc && /* @__PURE__ */
|
|
831
|
+
lightboxSrc && /* @__PURE__ */ jsx9(Lightbox, { imageUrl: lightboxSrc, onClose: () => setLightboxSrc(null) })
|
|
1017
832
|
]
|
|
1018
833
|
}
|
|
1019
834
|
);
|
|
@@ -1021,7 +836,7 @@ function MessageBubble({
|
|
|
1021
836
|
|
|
1022
837
|
// src/Wallpaper.tsx
|
|
1023
838
|
import { forwardRef } from "react";
|
|
1024
|
-
import { jsx as
|
|
839
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1025
840
|
function doodlePattern(strokeColor, opacity) {
|
|
1026
841
|
const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><g fill='none' stroke='${strokeColor}' stroke-width='1.2' opacity='${opacity}'><circle cx='15' cy='15' r='3'/><path d='M40 10 q5 8 0 16 q-5 -8 0 -16z'/><circle cx='70' cy='28' r='2'/><path d='M18 55 l6 6 m-6 0 l6 -6'/><circle cx='55' cy='68' r='2.5'/><path d='M85 58 q6 6 0 12 q-6 -6 0 -12z'/><circle cx='8' cy='85' r='2'/><path d='M65 90 l5 5 m-5 0 l5 -5'/></g></svg>`;
|
|
1027
842
|
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
@@ -1041,7 +856,7 @@ var DARK_WALLPAPER = {
|
|
|
1041
856
|
var ConversationWallpaper = forwardRef(
|
|
1042
857
|
function ConversationWallpaper2({ children, className, style, onScroll }, ref) {
|
|
1043
858
|
const isDark = useIsDarkTheme();
|
|
1044
|
-
return /* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ jsx10(
|
|
1045
860
|
"div",
|
|
1046
861
|
{
|
|
1047
862
|
ref,
|
|
@@ -1210,7 +1025,7 @@ function searchEmojis(query) {
|
|
|
1210
1025
|
|
|
1211
1026
|
// src/EmojiPicker.tsx
|
|
1212
1027
|
import { useState as useState6, useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
1213
|
-
import { jsx as
|
|
1028
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1214
1029
|
var DEFAULT_EMOJI_PICKER_LABELS = {
|
|
1215
1030
|
search: "Buscar emoji",
|
|
1216
1031
|
noResults: "Nenhum emoji encontrado"
|
|
@@ -1231,8 +1046,8 @@ var EmojiPicker = ({ onSelect, labels, className = "" }) => {
|
|
|
1231
1046
|
() => isSearching ? searchEmojis(query) : EMOJI_CATEGORIES[activeCategory].entries,
|
|
1232
1047
|
[isSearching, query, activeCategory]
|
|
1233
1048
|
);
|
|
1234
|
-
return /* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ jsxs7("div", { className: `bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden ${className}`, children: [
|
|
1050
|
+
/* @__PURE__ */ jsx11("div", { className: "p-2 border-b border-gray-200", children: /* @__PURE__ */ jsx11(
|
|
1236
1051
|
"input",
|
|
1237
1052
|
{
|
|
1238
1053
|
type: "search",
|
|
@@ -1243,7 +1058,7 @@ var EmojiPicker = ({ onSelect, labels, className = "" }) => {
|
|
|
1243
1058
|
className: "w-full rounded-md border border-gray-200 px-2 py-1.5 text-sm outline-none focus:border-blue-500"
|
|
1244
1059
|
}
|
|
1245
1060
|
) }),
|
|
1246
|
-
isSearching ? null : /* @__PURE__ */
|
|
1061
|
+
isSearching ? null : /* @__PURE__ */ jsx11("div", { className: "flex border-b border-gray-200 overflow-x-auto", children: EMOJI_CATEGORIES.map((category, index) => /* @__PURE__ */ jsxs7(
|
|
1247
1062
|
"button",
|
|
1248
1063
|
{
|
|
1249
1064
|
"data-cv-tooltip": category.name,
|
|
@@ -1258,7 +1073,7 @@ var EmojiPicker = ({ onSelect, labels, className = "" }) => {
|
|
|
1258
1073
|
},
|
|
1259
1074
|
category.name
|
|
1260
1075
|
)) }),
|
|
1261
|
-
visibleEntries.length === 0 ? /* @__PURE__ */
|
|
1076
|
+
visibleEntries.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "px-3 py-6 text-center text-sm text-gray-500", children: noResultsLabel }) : /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-10 gap-0.5 p-2 max-h-[240px] overflow-y-auto", children: visibleEntries.map((entry) => /* @__PURE__ */ jsx11(
|
|
1262
1077
|
"button",
|
|
1263
1078
|
{
|
|
1264
1079
|
onClick: () => handleSelect(entry.emoji),
|
|
@@ -1274,7 +1089,7 @@ var EmojiPicker = ({ onSelect, labels, className = "" }) => {
|
|
|
1274
1089
|
|
|
1275
1090
|
// src/AudioRecorderButton.tsx
|
|
1276
1091
|
import { useCallback as useCallback3, useEffect as useEffect2, useId, useRef as useRef2, useState as useState7 } from "react";
|
|
1277
|
-
import { jsx as
|
|
1092
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1278
1093
|
var DEFAULT_AUDIO_RECORDER_BUTTON_LABELS = {
|
|
1279
1094
|
start: "Gravar \xE1udio",
|
|
1280
1095
|
stop: "Parar grava\xE7\xE3o",
|
|
@@ -1375,16 +1190,16 @@ function AudioRecorderButton({
|
|
|
1375
1190
|
/* O painel de revisão flutua sobre o botão em vez de ocupar espaço na barra: o microfone mora
|
|
1376
1191
|
na caixa do botão de enviar, e empurrar o composer para cima a cada gravação faria a
|
|
1377
1192
|
conversa saltar. */
|
|
1378
|
-
/* @__PURE__ */
|
|
1379
|
-
pending && /* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative flex-shrink-0", children: [
|
|
1194
|
+
pending && /* @__PURE__ */ jsxs8(
|
|
1380
1195
|
"div",
|
|
1381
1196
|
{
|
|
1382
1197
|
role: "group",
|
|
1383
1198
|
"aria-label": labelOf("review"),
|
|
1384
1199
|
className: "absolute bottom-full right-0 z-20 mb-2 flex w-[calc(100vw-2rem)] max-w-[20rem] flex-wrap items-center justify-end gap-2 rounded-xl border border-gray-200 bg-white p-2 shadow-lg dark:border-gray-700 dark:bg-gray-800",
|
|
1385
1200
|
children: [
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ jsx12("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx12(AudioPlayer, { src: pending.objectURL }) }),
|
|
1202
|
+
/* @__PURE__ */ jsx12(
|
|
1388
1203
|
"button",
|
|
1389
1204
|
{
|
|
1390
1205
|
type: "button",
|
|
@@ -1392,13 +1207,13 @@ function AudioRecorderButton({
|
|
|
1392
1207
|
"data-cv-tooltip": labelOf("discard"),
|
|
1393
1208
|
"aria-label": labelOf("discard"),
|
|
1394
1209
|
className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-red-500 dark:hover:bg-gray-700",
|
|
1395
|
-
children: /* @__PURE__ */
|
|
1396
|
-
/* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1210
|
+
children: /* @__PURE__ */ jsxs8("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
1211
|
+
/* @__PURE__ */ jsx12("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1212
|
+
/* @__PURE__ */ jsx12("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1398
1213
|
] })
|
|
1399
1214
|
}
|
|
1400
1215
|
),
|
|
1401
|
-
/* @__PURE__ */
|
|
1216
|
+
/* @__PURE__ */ jsx12(
|
|
1402
1217
|
"button",
|
|
1403
1218
|
{
|
|
1404
1219
|
type: "button",
|
|
@@ -1406,13 +1221,13 @@ function AudioRecorderButton({
|
|
|
1406
1221
|
"data-cv-tooltip": labelOf("send"),
|
|
1407
1222
|
"aria-label": labelOf("send"),
|
|
1408
1223
|
className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white transition-colors hover:bg-emerald-600",
|
|
1409
|
-
children: /* @__PURE__ */
|
|
1224
|
+
children: /* @__PURE__ */ jsx12("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx12("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) })
|
|
1410
1225
|
}
|
|
1411
1226
|
)
|
|
1412
1227
|
]
|
|
1413
1228
|
}
|
|
1414
1229
|
),
|
|
1415
|
-
/* @__PURE__ */
|
|
1230
|
+
/* @__PURE__ */ jsx12(
|
|
1416
1231
|
"button",
|
|
1417
1232
|
{
|
|
1418
1233
|
type: "button",
|
|
@@ -1423,14 +1238,14 @@ function AudioRecorderButton({
|
|
|
1423
1238
|
"aria-describedby": showDisabledHint ? disabledHintId : void 0,
|
|
1424
1239
|
"aria-pressed": isRecording,
|
|
1425
1240
|
className: `flex h-10 w-10 items-center justify-center rounded-full transition-colors disabled:opacity-50 ${isRecording ? "animate-pulse bg-red-500 text-white ring-4 ring-red-500/30 hover:bg-red-600" : "text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,
|
|
1426
|
-
children: isRecording ? /* @__PURE__ */
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
/* @__PURE__ */
|
|
1429
|
-
/* @__PURE__ */
|
|
1241
|
+
children: isRecording ? /* @__PURE__ */ jsx12("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx12("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) }) : /* @__PURE__ */ jsxs8("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
1242
|
+
/* @__PURE__ */ jsx12("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z" }),
|
|
1243
|
+
/* @__PURE__ */ jsx12("path", { d: "M19 11a7 7 0 0 1-14 0" }),
|
|
1244
|
+
/* @__PURE__ */ jsx12("line", { x1: "12", y1: "18", x2: "12", y2: "22" })
|
|
1430
1245
|
] })
|
|
1431
1246
|
}
|
|
1432
1247
|
),
|
|
1433
|
-
showDisabledHint && /* @__PURE__ */
|
|
1248
|
+
showDisabledHint && /* @__PURE__ */ jsx12("span", { id: disabledHintId, className: "sr-only", children: disabledHint })
|
|
1434
1249
|
] })
|
|
1435
1250
|
);
|
|
1436
1251
|
}
|
|
@@ -1525,7 +1340,7 @@ var DEFAULT_QUICK_REPLIES_WORKSPACE_LABELS = {
|
|
|
1525
1340
|
};
|
|
1526
1341
|
|
|
1527
1342
|
// src/quickReplies/QuickRepliesPicker.tsx
|
|
1528
|
-
import { jsx as
|
|
1343
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1529
1344
|
var LOADING_SKELETON_ROWS = 4;
|
|
1530
1345
|
function QuickRepliesPicker({
|
|
1531
1346
|
id,
|
|
@@ -1548,8 +1363,8 @@ function QuickRepliesPicker({
|
|
|
1548
1363
|
if (ownSearch) searchInputRef.current?.focus();
|
|
1549
1364
|
}, []);
|
|
1550
1365
|
const activeOptionId = items.length > 0 ? `${id}-option-${highlightedIndex}` : void 0;
|
|
1551
|
-
return /* @__PURE__ */
|
|
1552
|
-
ownSearch ? /* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ jsxs9("div", { className, children: [
|
|
1367
|
+
ownSearch ? /* @__PURE__ */ jsx13(
|
|
1553
1368
|
"input",
|
|
1554
1369
|
{
|
|
1555
1370
|
ref: searchInputRef,
|
|
@@ -1566,25 +1381,25 @@ function QuickRepliesPicker({
|
|
|
1566
1381
|
className: "mb-1 w-72 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm outline-none focus:border-gray-400 dark:border-gray-700 dark:bg-gray-900"
|
|
1567
1382
|
}
|
|
1568
1383
|
) : null,
|
|
1569
|
-
/* @__PURE__ */
|
|
1384
|
+
/* @__PURE__ */ jsxs9(
|
|
1570
1385
|
"ul",
|
|
1571
1386
|
{
|
|
1572
1387
|
role: "listbox",
|
|
1573
1388
|
id,
|
|
1574
1389
|
className: "max-h-64 w-72 overflow-y-auto rounded-lg border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",
|
|
1575
1390
|
children: [
|
|
1576
|
-
isLoading ? /* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
Array.from({ length: LOADING_SKELETON_ROWS }).map((_, index) => /* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1391
|
+
isLoading ? /* @__PURE__ */ jsxs9("li", { "aria-busy": "true", "aria-live": "polite", children: [
|
|
1392
|
+
/* @__PURE__ */ jsx13("span", { className: "sr-only", children: text.loading }),
|
|
1393
|
+
Array.from({ length: LOADING_SKELETON_ROWS }).map((_, index) => /* @__PURE__ */ jsxs9("span", { className: "flex flex-col gap-1 px-3 py-2", children: [
|
|
1394
|
+
/* @__PURE__ */ jsx13("span", { className: "cv-skeleton-line", style: { width: "60%", height: "0.75rem" } }),
|
|
1395
|
+
/* @__PURE__ */ jsx13("span", { className: "cv-skeleton-line", style: { width: "85%", height: "0.625rem" } })
|
|
1581
1396
|
] }, index))
|
|
1582
1397
|
] }) : null,
|
|
1583
|
-
!isLoading && hasError ? /* @__PURE__ */
|
|
1584
|
-
!isLoading && !hasError && items.length === 0 ? /* @__PURE__ */
|
|
1398
|
+
!isLoading && hasError ? /* @__PURE__ */ jsx13("li", { role: "alert", className: "px-3 py-2 text-sm text-red-600 dark:text-red-400", children: text.error }) : null,
|
|
1399
|
+
!isLoading && !hasError && items.length === 0 ? /* @__PURE__ */ jsx13("li", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: search.trim() ? text.noResults : text.empty }) : null,
|
|
1585
1400
|
!isLoading && !hasError ? items.map((quickReply, index) => {
|
|
1586
1401
|
const resolvedBody = applyQuickReplyVariables(quickReply.body, variables);
|
|
1587
|
-
return /* @__PURE__ */
|
|
1402
|
+
return /* @__PURE__ */ jsxs9(
|
|
1588
1403
|
"li",
|
|
1589
1404
|
{
|
|
1590
1405
|
id: `${id}-option-${index}`,
|
|
@@ -1600,15 +1415,15 @@ function QuickRepliesPicker({
|
|
|
1600
1415
|
onSelect(quickReply);
|
|
1601
1416
|
},
|
|
1602
1417
|
children: [
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-2", children: [
|
|
1419
|
+
/* @__PURE__ */ jsxs9("span", { className: "font-mono text-xs text-gray-400", children: [
|
|
1605
1420
|
"/",
|
|
1606
1421
|
quickReply.shortcut
|
|
1607
1422
|
] }),
|
|
1608
|
-
/* @__PURE__ */
|
|
1609
|
-
(segment, segmentIndex) => segment.isMatch ? /* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate font-medium", children: highlightMatch(quickReply.title, search).map(
|
|
1424
|
+
(segment, segmentIndex) => segment.isMatch ? /* @__PURE__ */ jsx13("mark", { className: "rounded-sm bg-yellow-200 dark:bg-yellow-700/60", children: segment.text }, segmentIndex) : /* @__PURE__ */ jsx13("span", { children: segment.text }, segmentIndex)
|
|
1610
1425
|
) }),
|
|
1611
|
-
quickReply.attachments && quickReply.attachments.length > 0 ? /* @__PURE__ */
|
|
1426
|
+
quickReply.attachments && quickReply.attachments.length > 0 ? /* @__PURE__ */ jsxs9(
|
|
1612
1427
|
"span",
|
|
1613
1428
|
{
|
|
1614
1429
|
className: cn(
|
|
@@ -1617,15 +1432,15 @@ function QuickRepliesPicker({
|
|
|
1617
1432
|
),
|
|
1618
1433
|
title: hasAttachmentsCapability ? void 0 : text.attachmentsUnavailable,
|
|
1619
1434
|
children: [
|
|
1620
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ jsx13(Paperclip, { "aria-hidden": "true", className: "h-3 w-3" }),
|
|
1621
1436
|
text.attachmentsCount(quickReply.attachments.length)
|
|
1622
1437
|
]
|
|
1623
1438
|
}
|
|
1624
1439
|
) : null
|
|
1625
1440
|
] }),
|
|
1626
|
-
quickReply.attachments && quickReply.attachments.length > 0 && !hasAttachmentsCapability ? /* @__PURE__ */
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
(segment, segmentIndex) => segment.isMatch ? /* @__PURE__ */
|
|
1441
|
+
quickReply.attachments && quickReply.attachments.length > 0 && !hasAttachmentsCapability ? /* @__PURE__ */ jsx13("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: text.attachmentsUnavailable }) : null,
|
|
1442
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate text-xs text-gray-500 dark:text-gray-400", children: highlightMatch(resolvedBody, search).map(
|
|
1443
|
+
(segment, segmentIndex) => segment.isMatch ? /* @__PURE__ */ jsx13("mark", { className: "rounded-sm bg-yellow-200 dark:bg-yellow-700/60", children: segment.text }, segmentIndex) : /* @__PURE__ */ jsx13("span", { children: segment.text }, segmentIndex)
|
|
1629
1444
|
) })
|
|
1630
1445
|
]
|
|
1631
1446
|
},
|
|
@@ -1739,7 +1554,7 @@ function replaceQuickReplyShortcut({
|
|
|
1739
1554
|
}
|
|
1740
1555
|
|
|
1741
1556
|
// src/MessageComposer.tsx
|
|
1742
|
-
import { Fragment as Fragment3, jsx as
|
|
1557
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1743
1558
|
function applyQuickReplyVariables(template, variables = {}) {
|
|
1744
1559
|
return template.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (_, chave) => variables[chave] ?? "");
|
|
1745
1560
|
}
|
|
@@ -1985,7 +1800,7 @@ var MessageComposer = ({
|
|
|
1985
1800
|
return next;
|
|
1986
1801
|
});
|
|
1987
1802
|
}, []);
|
|
1988
|
-
const effectiveIdleAction = idleAction ?? (onAttach ? /* @__PURE__ */
|
|
1803
|
+
const effectiveIdleAction = idleAction ?? (onAttach ? /* @__PURE__ */ jsx14(
|
|
1989
1804
|
AudioRecorderButton,
|
|
1990
1805
|
{
|
|
1991
1806
|
onRecorded: (file) => onAttach(file),
|
|
@@ -1999,15 +1814,15 @@ var MessageComposer = ({
|
|
|
1999
1814
|
/* A barra é a superfície (cinza, largura cheia, sem raio) e o campo dentro é que arredonda —
|
|
2000
1815
|
ordem do WhatsApp. Invertido, o pill arredondado ia até a borda da tela e os cantos
|
|
2001
1816
|
descobriam o fundo branco da página, que lia como defeito. */
|
|
2002
|
-
/* @__PURE__ */
|
|
2003
|
-
quickReplies && quickReplies.length > 0 && /* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsxs10("div", { className: cn(COMPOSER_BAR_CLASS, className), children: [
|
|
1818
|
+
quickReplies && quickReplies.length > 0 && /* @__PURE__ */ jsx14(
|
|
2004
1819
|
"div",
|
|
2005
1820
|
{
|
|
2006
1821
|
className: cn(
|
|
2007
1822
|
"mb-2 flex flex-nowrap gap-1 overflow-x-auto px-1 sm:flex-wrap sm:overflow-x-visible [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2008
1823
|
classNames?.quickReplies
|
|
2009
1824
|
),
|
|
2010
|
-
children: quickReplies.map((quickReply) => /* @__PURE__ */
|
|
1825
|
+
children: quickReplies.map((quickReply) => /* @__PURE__ */ jsx14(
|
|
2011
1826
|
"button",
|
|
2012
1827
|
{
|
|
2013
1828
|
"data-cv-tooltip": quickReply.label,
|
|
@@ -2024,12 +1839,12 @@ var MessageComposer = ({
|
|
|
2024
1839
|
))
|
|
2025
1840
|
}
|
|
2026
1841
|
),
|
|
2027
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
2028
|
-
a.previewUrl ? /* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
1842
|
+
attachments.length > 0 && /* @__PURE__ */ jsx14("div", { className: "flex gap-2 px-1 pb-2 overflow-x-auto", children: attachments.map((a, i) => /* @__PURE__ */ jsxs10("div", { className: "relative flex-shrink-0", children: [
|
|
1843
|
+
a.previewUrl ? /* @__PURE__ */ jsx14("img", { src: a.previewUrl, alt: "", className: "w-16 h-16 object-cover rounded-lg border border-gray-200" }) : /* @__PURE__ */ jsx14("div", { className: "w-16 h-16 bg-gray-100 rounded-lg border border-gray-200 flex items-center justify-center", children: /* @__PURE__ */ jsxs10("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", children: [
|
|
1844
|
+
/* @__PURE__ */ jsx14("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1845
|
+
/* @__PURE__ */ jsx14("polyline", { points: "14 2 14 8 20 8" })
|
|
2031
1846
|
] }) }),
|
|
2032
|
-
/* @__PURE__ */
|
|
1847
|
+
/* @__PURE__ */ jsx14(
|
|
2033
1848
|
"button",
|
|
2034
1849
|
{
|
|
2035
1850
|
"data-cv-tooltip": removeAttachmentLabel,
|
|
@@ -2040,27 +1855,27 @@ var MessageComposer = ({
|
|
|
2040
1855
|
}
|
|
2041
1856
|
)
|
|
2042
1857
|
] }, i)) }),
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
showEmojiButton && /* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex items-end gap-1.5 rounded-xl bg-white px-3 py-2", classNames?.field), children: [
|
|
1859
|
+
showEmojiButton && /* @__PURE__ */ jsxs10("div", { className: "relative flex-shrink-0", children: [
|
|
1860
|
+
/* @__PURE__ */ jsx14(
|
|
2046
1861
|
"button",
|
|
2047
1862
|
{
|
|
2048
1863
|
"data-cv-tooltip": emojiLabel,
|
|
2049
1864
|
onClick: () => setShowEmoji((v) => !v),
|
|
2050
1865
|
className: "w-9 h-9 flex items-center justify-center rounded-full text-gray-500 hover:bg-gray-200 transition-colors",
|
|
2051
1866
|
"aria-label": emojiLabel,
|
|
2052
|
-
children: /* @__PURE__ */
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
1867
|
+
children: /* @__PURE__ */ jsxs10("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1868
|
+
/* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1869
|
+
/* @__PURE__ */ jsx14("path", { d: "M8 14s1.5 2 4 2 4-2 4-2" }),
|
|
1870
|
+
/* @__PURE__ */ jsx14("circle", { cx: "9", cy: "9", r: "0.5", fill: "currentColor" }),
|
|
1871
|
+
/* @__PURE__ */ jsx14("circle", { cx: "15", cy: "9", r: "0.5", fill: "currentColor" })
|
|
2057
1872
|
] })
|
|
2058
1873
|
}
|
|
2059
1874
|
),
|
|
2060
|
-
showEmoji && /* @__PURE__ */
|
|
1875
|
+
showEmoji && /* @__PURE__ */ jsx14("div", { className: "absolute bottom-full left-0 mb-2 z-10", children: /* @__PURE__ */ jsx14(EmojiPicker, { onSelect: handleEmojiSelect }) })
|
|
2061
1876
|
] }),
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
1877
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative flex-1", children: [
|
|
1878
|
+
/* @__PURE__ */ jsx14(
|
|
2064
1879
|
"textarea",
|
|
2065
1880
|
{
|
|
2066
1881
|
ref: textareaRef,
|
|
@@ -2085,7 +1900,7 @@ var MessageComposer = ({
|
|
|
2085
1900
|
style: { fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" }
|
|
2086
1901
|
}
|
|
2087
1902
|
),
|
|
2088
|
-
isQuickRepliesOpen && /* @__PURE__ */
|
|
1903
|
+
isQuickRepliesOpen && /* @__PURE__ */ jsx14("div", { ref: quickRepliesPopoverRef, className: "absolute bottom-full left-0 mb-2 z-10", children: /* @__PURE__ */ jsx14(
|
|
2089
1904
|
QuickRepliesPicker,
|
|
2090
1905
|
{
|
|
2091
1906
|
id: quickRepliesListboxId,
|
|
@@ -2109,8 +1924,8 @@ var MessageComposer = ({
|
|
|
2109
1924
|
quickRepliesMode
|
|
2110
1925
|
) })
|
|
2111
1926
|
] }),
|
|
2112
|
-
showQuickRepliesButton && /* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
1927
|
+
showQuickRepliesButton && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1928
|
+
/* @__PURE__ */ jsx14(
|
|
2114
1929
|
"button",
|
|
2115
1930
|
{
|
|
2116
1931
|
ref: quickRepliesTriggerRef,
|
|
@@ -2121,13 +1936,13 @@ var MessageComposer = ({
|
|
|
2121
1936
|
"aria-describedby": quickRepliesAllowed ? void 0 : quickRepliesHintId,
|
|
2122
1937
|
onClick: openQuickRepliesViaButton,
|
|
2123
1938
|
className: "w-9 h-9 flex items-center justify-center rounded-full text-gray-500 hover:bg-gray-200 flex-shrink-0 transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",
|
|
2124
|
-
children: /* @__PURE__ */
|
|
1939
|
+
children: /* @__PURE__ */ jsx14("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx14("polygon", { points: "13 2 3 14 12 14 11 22 21 10 12 10 13 2" }) })
|
|
2125
1940
|
}
|
|
2126
1941
|
),
|
|
2127
|
-
!quickRepliesAllowed && /* @__PURE__ */
|
|
1942
|
+
!quickRepliesAllowed && /* @__PURE__ */ jsx14("span", { id: quickRepliesHintId, className: "sr-only", children: quickRepliesDisabledHintLabel })
|
|
2128
1943
|
] }),
|
|
2129
|
-
showAttachButton && /* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
1944
|
+
showAttachButton && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1945
|
+
/* @__PURE__ */ jsx14(
|
|
2131
1946
|
"input",
|
|
2132
1947
|
{
|
|
2133
1948
|
ref: fileInputRef,
|
|
@@ -2138,7 +1953,7 @@ var MessageComposer = ({
|
|
|
2138
1953
|
className: "hidden"
|
|
2139
1954
|
}
|
|
2140
1955
|
),
|
|
2141
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx14(
|
|
2142
1957
|
"button",
|
|
2143
1958
|
{
|
|
2144
1959
|
disabled: !attachmentsAllowed,
|
|
@@ -2147,12 +1962,12 @@ var MessageComposer = ({
|
|
|
2147
1962
|
"aria-describedby": attachmentsAllowed ? void 0 : attachHintId,
|
|
2148
1963
|
className: "w-9 h-9 flex items-center justify-center rounded-full text-gray-500 hover:bg-gray-200 flex-shrink-0 transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",
|
|
2149
1964
|
"aria-label": attachLabel,
|
|
2150
|
-
children: /* @__PURE__ */
|
|
1965
|
+
children: /* @__PURE__ */ jsx14("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx14("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" }) })
|
|
2151
1966
|
}
|
|
2152
1967
|
),
|
|
2153
|
-
!attachmentsAllowed && /* @__PURE__ */
|
|
1968
|
+
!attachmentsAllowed && /* @__PURE__ */ jsx14("span", { id: attachHintId, className: "sr-only", children: attachDisabledHintLabel })
|
|
2154
1969
|
] }),
|
|
2155
|
-
!canSend && effectiveIdleAction ? /* @__PURE__ */
|
|
1970
|
+
!canSend && effectiveIdleAction ? /* @__PURE__ */ jsx14("div", { className: "flex-shrink-0", children: effectiveIdleAction }) : /* @__PURE__ */ jsx14(
|
|
2156
1971
|
"button",
|
|
2157
1972
|
{
|
|
2158
1973
|
"data-cv-tooltip": sendLabel,
|
|
@@ -2160,11 +1975,11 @@ var MessageComposer = ({
|
|
|
2160
1975
|
disabled: !canSend || disabled,
|
|
2161
1976
|
className: `w-10 h-10 flex items-center justify-center rounded-full flex-shrink-0 transition-all ${canSend && !disabled ? "bg-[#00a884] text-white hover:bg-[#06cf9c] shadow-sm" : "bg-gray-200 text-gray-400 cursor-not-allowed"}`,
|
|
2162
1977
|
"aria-label": sendLabel,
|
|
2163
|
-
children: /* @__PURE__ */
|
|
1978
|
+
children: /* @__PURE__ */ jsx14("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx14("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) })
|
|
2164
1979
|
}
|
|
2165
1980
|
)
|
|
2166
1981
|
] }),
|
|
2167
|
-
remaining !== null && /* @__PURE__ */
|
|
1982
|
+
remaining !== null && /* @__PURE__ */ jsx14("div", { className: "flex justify-end mt-1 pr-1", children: /* @__PURE__ */ jsx14("span", { className: `text-xs ${remaining < 20 ? "text-red-500" : "text-gray-400"}`, children: remaining }) })
|
|
2168
1983
|
] })
|
|
2169
1984
|
);
|
|
2170
1985
|
};
|
|
@@ -2226,10 +2041,10 @@ function highlightMatch(text, search) {
|
|
|
2226
2041
|
}
|
|
2227
2042
|
|
|
2228
2043
|
// src/DateDivider.tsx
|
|
2229
|
-
import { jsx as
|
|
2044
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2230
2045
|
function DateDivider({ iso, className, classNames }) {
|
|
2231
2046
|
const { dateDivider } = useConversationLocales();
|
|
2232
|
-
return /* @__PURE__ */
|
|
2047
|
+
return /* @__PURE__ */ jsx15("div", { className: cn("flex justify-center sticky top-0 z-10 my-2 pointer-events-none", classNames?.root, className), children: /* @__PURE__ */ jsx15(
|
|
2233
2048
|
"span",
|
|
2234
2049
|
{
|
|
2235
2050
|
className: cn(
|
|
@@ -2317,7 +2132,7 @@ var PAGINATION_LABELS = {
|
|
|
2317
2132
|
};
|
|
2318
2133
|
|
|
2319
2134
|
// src/ConversationDocumentsPanel.tsx
|
|
2320
|
-
import { jsx as
|
|
2135
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2321
2136
|
var DOCUMENT_SOURCE_FILTER = {
|
|
2322
2137
|
ALL: "all",
|
|
2323
2138
|
CUSTOMER: "customer",
|
|
@@ -2413,10 +2228,10 @@ function ConversationDocumentsPanel({
|
|
|
2413
2228
|
}
|
|
2414
2229
|
}
|
|
2415
2230
|
if (!open) return null;
|
|
2416
|
-
return /* @__PURE__ */
|
|
2417
|
-
/* @__PURE__ */
|
|
2418
|
-
/* @__PURE__ */
|
|
2419
|
-
/* @__PURE__ */
|
|
2231
|
+
return /* @__PURE__ */ jsx16("div", { className: cn("border-b", classNames?.root, className), children: /* @__PURE__ */ jsxs11("section", { className: cn("px-4 py-3", classNames?.body), children: [
|
|
2232
|
+
/* @__PURE__ */ jsx16("p", { className: cn("mb-2 text-sm font-medium", classNames?.title), children: labels.title }),
|
|
2233
|
+
/* @__PURE__ */ jsxs11("div", { className: cn("mb-2 flex flex-wrap items-center gap-2 border-b pb-2", classNames?.filters), children: [
|
|
2234
|
+
/* @__PURE__ */ jsx16(
|
|
2420
2235
|
"input",
|
|
2421
2236
|
{
|
|
2422
2237
|
type: "search",
|
|
@@ -2427,7 +2242,7 @@ function ConversationDocumentsPanel({
|
|
|
2427
2242
|
className: cn("w-full rounded-md border px-3 py-2 text-sm sm:w-52", classNames?.search)
|
|
2428
2243
|
}
|
|
2429
2244
|
),
|
|
2430
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ jsxs11(
|
|
2431
2246
|
"select",
|
|
2432
2247
|
{
|
|
2433
2248
|
value: sourceFilter,
|
|
@@ -2435,13 +2250,13 @@ function ConversationDocumentsPanel({
|
|
|
2435
2250
|
"aria-label": labels.sourceFilterAll,
|
|
2436
2251
|
className: cn("w-full rounded-md border px-2 py-2 text-sm sm:w-36", classNames?.sourceSelect),
|
|
2437
2252
|
children: [
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
/* @__PURE__ */
|
|
2253
|
+
/* @__PURE__ */ jsx16("option", { value: DOCUMENT_SOURCE_FILTER.ALL, children: labels.sourceFilterAll }),
|
|
2254
|
+
/* @__PURE__ */ jsx16("option", { value: DOCUMENT_SOURCE_FILTER.CUSTOMER, children: labels.sourceFilterCustomer }),
|
|
2255
|
+
/* @__PURE__ */ jsx16("option", { value: DOCUMENT_SOURCE_FILTER.TEAM, children: labels.sourceFilterTeam })
|
|
2441
2256
|
]
|
|
2442
2257
|
}
|
|
2443
2258
|
),
|
|
2444
|
-
/* @__PURE__ */
|
|
2259
|
+
/* @__PURE__ */ jsxs11(
|
|
2445
2260
|
"button",
|
|
2446
2261
|
{
|
|
2447
2262
|
"data-cv-tooltip": sortDirection === "desc" ? labels.sortMostRecent : labels.sortOldest,
|
|
@@ -2450,12 +2265,12 @@ function ConversationDocumentsPanel({
|
|
|
2450
2265
|
onClick: () => applyFilter(() => setSortDirection(sortDirection === "desc" ? "asc" : "desc")),
|
|
2451
2266
|
className: cn("cv-header-action inline-flex items-center gap-1", classNames?.sortButton),
|
|
2452
2267
|
children: [
|
|
2453
|
-
/* @__PURE__ */
|
|
2268
|
+
/* @__PURE__ */ jsx16(ArrowUpDown, { size: 14 }),
|
|
2454
2269
|
sortDirection === "desc" ? labels.sortMostRecent : labels.sortOldest
|
|
2455
2270
|
]
|
|
2456
2271
|
}
|
|
2457
2272
|
),
|
|
2458
|
-
hasFilters ? /* @__PURE__ */
|
|
2273
|
+
hasFilters ? /* @__PURE__ */ jsx16(
|
|
2459
2274
|
"button",
|
|
2460
2275
|
{
|
|
2461
2276
|
"data-cv-tooltip": labels.clearFilters,
|
|
@@ -2471,12 +2286,12 @@ function ConversationDocumentsPanel({
|
|
|
2471
2286
|
}
|
|
2472
2287
|
) : null
|
|
2473
2288
|
] }),
|
|
2474
|
-
loading ? /* @__PURE__ */
|
|
2475
|
-
error ? /* @__PURE__ */
|
|
2476
|
-
!loading && !error && documents.length === 0 ? /* @__PURE__ */
|
|
2477
|
-
canArchive && documents.length > 0 ? /* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2289
|
+
loading ? /* @__PURE__ */ jsx16("p", { className: cn("text-xs text-gray-500", classNames?.status), children: labels.loading }) : null,
|
|
2290
|
+
error ? /* @__PURE__ */ jsx16("p", { role: "alert", className: cn("text-xs text-red-600 dark:text-red-400", classNames?.status), children: labels.failure }) : null,
|
|
2291
|
+
!loading && !error && documents.length === 0 ? /* @__PURE__ */ jsx16("p", { className: cn("text-xs text-gray-500", classNames?.status), children: hasFilters ? labels.noResults : labels.empty }) : null,
|
|
2292
|
+
canArchive && documents.length > 0 ? /* @__PURE__ */ jsxs11("div", { className: cn("mb-2 flex flex-wrap items-center gap-3 text-xs", classNames?.selectionBar), children: [
|
|
2293
|
+
/* @__PURE__ */ jsxs11("label", { className: "inline-flex items-center gap-1.5", children: [
|
|
2294
|
+
/* @__PURE__ */ jsx16(
|
|
2480
2295
|
"input",
|
|
2481
2296
|
{
|
|
2482
2297
|
type: "checkbox",
|
|
@@ -2487,13 +2302,13 @@ function ConversationDocumentsPanel({
|
|
|
2487
2302
|
),
|
|
2488
2303
|
labels.selectAll
|
|
2489
2304
|
] }),
|
|
2490
|
-
selectedIds.length > 0 ? /* @__PURE__ */
|
|
2491
|
-
archiveError ? /* @__PURE__ */
|
|
2305
|
+
selectedIds.length > 0 ? /* @__PURE__ */ jsx16("button", { "data-cv-tooltip": labels.downloadSelected(selectedIds.length), "aria-label": labels.downloadSelected(selectedIds.length), type: "button", onClick: () => void handleDownloadSelected(), className: "cv-header-action", children: labels.downloadSelected(selectedIds.length) }) : null,
|
|
2306
|
+
archiveError ? /* @__PURE__ */ jsx16("span", { role: "alert", className: "text-red-600 dark:text-red-400", children: labels.archiveFailed }) : null
|
|
2492
2307
|
] }) : null,
|
|
2493
|
-
/* @__PURE__ */
|
|
2308
|
+
/* @__PURE__ */ jsx16("ul", { className: cn("space-y-2", classNames?.list), children: documents.map((document2) => {
|
|
2494
2309
|
const isFromCustomer = !TEAM_SOURCES.has(document2.source);
|
|
2495
2310
|
const SourceIcon = isFromCustomer ? Users : Bot;
|
|
2496
|
-
return /* @__PURE__ */
|
|
2311
|
+
return /* @__PURE__ */ jsxs11(
|
|
2497
2312
|
"li",
|
|
2498
2313
|
{
|
|
2499
2314
|
className: cn(
|
|
@@ -2501,8 +2316,8 @@ function ConversationDocumentsPanel({
|
|
|
2501
2316
|
classNames?.item
|
|
2502
2317
|
),
|
|
2503
2318
|
children: [
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
canArchive ? /* @__PURE__ */
|
|
2319
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
2320
|
+
canArchive ? /* @__PURE__ */ jsx16(
|
|
2506
2321
|
"input",
|
|
2507
2322
|
{
|
|
2508
2323
|
type: "checkbox",
|
|
@@ -2512,9 +2327,9 @@ function ConversationDocumentsPanel({
|
|
|
2512
2327
|
className: cn("shrink-0", classNames?.checkbox)
|
|
2513
2328
|
}
|
|
2514
2329
|
) : null,
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2330
|
+
/* @__PURE__ */ jsx16(FileIcon, { filename: document2.filename, mimeType: document2.mimeType }),
|
|
2331
|
+
/* @__PURE__ */ jsxs11("div", { className: "min-w-0 flex-1", children: [
|
|
2332
|
+
/* @__PURE__ */ jsxs11(
|
|
2518
2333
|
"div",
|
|
2519
2334
|
{
|
|
2520
2335
|
className: cn(
|
|
@@ -2523,12 +2338,12 @@ function ConversationDocumentsPanel({
|
|
|
2523
2338
|
classNames?.sourceBadge
|
|
2524
2339
|
),
|
|
2525
2340
|
children: [
|
|
2526
|
-
/* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ jsx16(SourceIcon, { size: 11 }),
|
|
2527
2342
|
isFromCustomer ? labels.sourceFilterCustomer : labels.sourceFilterTeam
|
|
2528
2343
|
]
|
|
2529
2344
|
}
|
|
2530
2345
|
),
|
|
2531
|
-
/* @__PURE__ */
|
|
2346
|
+
/* @__PURE__ */ jsx16(
|
|
2532
2347
|
"div",
|
|
2533
2348
|
{
|
|
2534
2349
|
className: cn("truncate text-sm font-medium", classNames?.filename),
|
|
@@ -2536,15 +2351,15 @@ function ConversationDocumentsPanel({
|
|
|
2536
2351
|
children: document2.filename
|
|
2537
2352
|
}
|
|
2538
2353
|
),
|
|
2539
|
-
/* @__PURE__ */
|
|
2354
|
+
/* @__PURE__ */ jsxs11("div", { className: cn("text-xs text-gray-500 dark:text-gray-400", classNames?.meta), children: [
|
|
2540
2355
|
formatDateTime(document2.linkedAt),
|
|
2541
2356
|
" \xB7 ",
|
|
2542
2357
|
formatFileSize(document2.sizeBytes)
|
|
2543
2358
|
] })
|
|
2544
2359
|
] })
|
|
2545
2360
|
] }),
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2361
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex shrink-0 gap-1", children: [
|
|
2362
|
+
/* @__PURE__ */ jsx16(
|
|
2548
2363
|
"button",
|
|
2549
2364
|
{
|
|
2550
2365
|
type: "button",
|
|
@@ -2552,10 +2367,10 @@ function ConversationDocumentsPanel({
|
|
|
2552
2367
|
"data-cv-tooltip": labels.view,
|
|
2553
2368
|
"aria-label": `${labels.view}: ${document2.filename}`,
|
|
2554
2369
|
className: cn("cv-header-icon", classNames?.viewButton),
|
|
2555
|
-
children: /* @__PURE__ */
|
|
2370
|
+
children: /* @__PURE__ */ jsx16(Eye, { size: 14 })
|
|
2556
2371
|
}
|
|
2557
2372
|
),
|
|
2558
|
-
/* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ jsx16(
|
|
2559
2374
|
"button",
|
|
2560
2375
|
{
|
|
2561
2376
|
type: "button",
|
|
@@ -2563,7 +2378,7 @@ function ConversationDocumentsPanel({
|
|
|
2563
2378
|
"data-cv-tooltip": labels.download,
|
|
2564
2379
|
"aria-label": `${labels.download}: ${document2.filename}`,
|
|
2565
2380
|
className: cn("cv-header-icon", classNames?.downloadButton),
|
|
2566
|
-
children: /* @__PURE__ */
|
|
2381
|
+
children: /* @__PURE__ */ jsx16(Download, { size: 14 })
|
|
2567
2382
|
}
|
|
2568
2383
|
)
|
|
2569
2384
|
] })
|
|
@@ -2572,7 +2387,7 @@ function ConversationDocumentsPanel({
|
|
|
2572
2387
|
document2.id
|
|
2573
2388
|
);
|
|
2574
2389
|
}) }),
|
|
2575
|
-
total > perPage ? /* @__PURE__ */
|
|
2390
|
+
total > perPage ? /* @__PURE__ */ jsxs11(
|
|
2576
2391
|
"div",
|
|
2577
2392
|
{
|
|
2578
2393
|
className: cn(
|
|
@@ -2580,9 +2395,9 @@ function ConversationDocumentsPanel({
|
|
|
2580
2395
|
classNames?.pagination
|
|
2581
2396
|
),
|
|
2582
2397
|
children: [
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2585
|
-
/* @__PURE__ */
|
|
2398
|
+
/* @__PURE__ */ jsx16("span", { className: "text-gray-400", children: labels.total(total) }),
|
|
2399
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2400
|
+
/* @__PURE__ */ jsx16(
|
|
2586
2401
|
"button",
|
|
2587
2402
|
{
|
|
2588
2403
|
type: "button",
|
|
@@ -2594,8 +2409,8 @@ function ConversationDocumentsPanel({
|
|
|
2594
2409
|
children: "\u2039"
|
|
2595
2410
|
}
|
|
2596
2411
|
),
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ jsx16("span", { className: "text-gray-500", children: labels.page(page, lastPage) }),
|
|
2413
|
+
/* @__PURE__ */ jsx16(
|
|
2599
2414
|
"button",
|
|
2600
2415
|
{
|
|
2601
2416
|
type: "button",
|
|
@@ -2617,7 +2432,7 @@ function ConversationDocumentsPanel({
|
|
|
2617
2432
|
// src/DocumentsLibrary.tsx
|
|
2618
2433
|
import { useEffect as useEffect7, useRef as useRef7, useState as useState12 } from "react";
|
|
2619
2434
|
import { ArrowUpDown as ArrowUpDown2, Bot as Bot2, Download as Download2, Eye as Eye2, MessageSquare, Upload, Users as Users2 } from "lucide-react";
|
|
2620
|
-
import { Fragment as Fragment4, jsx as
|
|
2435
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2621
2436
|
var DEFAULT_DOCUMENTS_LIBRARY_LABELS = {
|
|
2622
2437
|
title: "Documentos",
|
|
2623
2438
|
searchPlaceholder: "Buscar por nome do arquivo ou telefone",
|
|
@@ -2712,10 +2527,10 @@ function DocumentsLibrary({
|
|
|
2712
2527
|
}
|
|
2713
2528
|
}
|
|
2714
2529
|
if (!fetchAll) return null;
|
|
2715
|
-
return /* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2530
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("space-y-3", classNames?.root, className), children: [
|
|
2531
|
+
/* @__PURE__ */ jsx17("h2", { className: cn("text-lg font-semibold", classNames?.title), children: labels.title }),
|
|
2532
|
+
/* @__PURE__ */ jsxs12("div", { className: cn("flex flex-wrap items-center gap-2", classNames?.filters), children: [
|
|
2533
|
+
/* @__PURE__ */ jsx17(
|
|
2719
2534
|
"input",
|
|
2720
2535
|
{
|
|
2721
2536
|
type: "search",
|
|
@@ -2726,7 +2541,7 @@ function DocumentsLibrary({
|
|
|
2726
2541
|
className: cn("w-full rounded-md border px-3 py-2 text-sm sm:w-64", classNames?.search)
|
|
2727
2542
|
}
|
|
2728
2543
|
),
|
|
2729
|
-
/* @__PURE__ */
|
|
2544
|
+
/* @__PURE__ */ jsxs12(
|
|
2730
2545
|
"select",
|
|
2731
2546
|
{
|
|
2732
2547
|
value: sourceFilter,
|
|
@@ -2734,13 +2549,13 @@ function DocumentsLibrary({
|
|
|
2734
2549
|
"aria-label": labels.sourceFilterAll,
|
|
2735
2550
|
className: cn("w-full rounded-md border px-2 py-2 text-sm sm:w-40", classNames?.sourceSelect),
|
|
2736
2551
|
children: [
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
2552
|
+
/* @__PURE__ */ jsx17("option", { value: DOCUMENT_SOURCE_FILTER.ALL, children: labels.sourceFilterAll }),
|
|
2553
|
+
/* @__PURE__ */ jsx17("option", { value: DOCUMENT_SOURCE_FILTER.CUSTOMER, children: labels.sourceFilterCustomer }),
|
|
2554
|
+
/* @__PURE__ */ jsx17("option", { value: DOCUMENT_SOURCE_FILTER.TEAM, children: labels.sourceFilterTeam })
|
|
2740
2555
|
]
|
|
2741
2556
|
}
|
|
2742
2557
|
),
|
|
2743
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ jsxs12(
|
|
2744
2559
|
"button",
|
|
2745
2560
|
{
|
|
2746
2561
|
"data-cv-tooltip": sortDirection === "desc" ? labels.sortMostRecent : labels.sortOldest,
|
|
@@ -2749,12 +2564,12 @@ function DocumentsLibrary({
|
|
|
2749
2564
|
onClick: () => applyFilter(() => setSortDirection(sortDirection === "desc" ? "asc" : "desc")),
|
|
2750
2565
|
className: cn("cv-header-action inline-flex items-center gap-1", classNames?.sortButton),
|
|
2751
2566
|
children: [
|
|
2752
|
-
/* @__PURE__ */
|
|
2567
|
+
/* @__PURE__ */ jsx17(ArrowUpDown2, { size: 14 }),
|
|
2753
2568
|
sortDirection === "desc" ? labels.sortMostRecent : labels.sortOldest
|
|
2754
2569
|
]
|
|
2755
2570
|
}
|
|
2756
2571
|
),
|
|
2757
|
-
hasFilters ? /* @__PURE__ */
|
|
2572
|
+
hasFilters ? /* @__PURE__ */ jsx17(
|
|
2758
2573
|
"button",
|
|
2759
2574
|
{
|
|
2760
2575
|
"data-cv-tooltip": labels.clearFilters,
|
|
@@ -2769,8 +2584,8 @@ function DocumentsLibrary({
|
|
|
2769
2584
|
children: labels.clearFilters
|
|
2770
2585
|
}
|
|
2771
2586
|
) : null,
|
|
2772
|
-
uploadDocument ? /* @__PURE__ */
|
|
2773
|
-
/* @__PURE__ */
|
|
2587
|
+
uploadDocument ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2588
|
+
/* @__PURE__ */ jsx17(
|
|
2774
2589
|
"input",
|
|
2775
2590
|
{
|
|
2776
2591
|
ref: fileInputRef,
|
|
@@ -2783,7 +2598,7 @@ function DocumentsLibrary({
|
|
|
2783
2598
|
}
|
|
2784
2599
|
}
|
|
2785
2600
|
),
|
|
2786
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsxs12(
|
|
2787
2602
|
"button",
|
|
2788
2603
|
{
|
|
2789
2604
|
"data-cv-tooltip": labels.upload,
|
|
@@ -2793,21 +2608,21 @@ function DocumentsLibrary({
|
|
|
2793
2608
|
disabled: uploading,
|
|
2794
2609
|
className: "cv-header-action ml-auto inline-flex items-center gap-1 disabled:opacity-40",
|
|
2795
2610
|
children: [
|
|
2796
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ jsx17(Upload, { size: 14, "aria-hidden": "true" }),
|
|
2797
2612
|
labels.upload
|
|
2798
2613
|
]
|
|
2799
2614
|
}
|
|
2800
2615
|
)
|
|
2801
2616
|
] }) : null
|
|
2802
2617
|
] }),
|
|
2803
|
-
loading ? /* @__PURE__ */
|
|
2804
|
-
failed ? /* @__PURE__ */
|
|
2805
|
-
uploadFailed ? /* @__PURE__ */
|
|
2806
|
-
!loading && !failed && documents.length === 0 ? /* @__PURE__ */
|
|
2807
|
-
/* @__PURE__ */
|
|
2618
|
+
loading ? /* @__PURE__ */ jsx17("p", { className: cn("text-sm text-gray-500", classNames?.status), children: labels.loading }) : null,
|
|
2619
|
+
failed ? /* @__PURE__ */ jsx17("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.failure }) : null,
|
|
2620
|
+
uploadFailed ? /* @__PURE__ */ jsx17("p", { role: "alert", className: cn("text-sm text-red-600 dark:text-red-400", classNames?.status), children: labels.uploadError }) : null,
|
|
2621
|
+
!loading && !failed && documents.length === 0 ? /* @__PURE__ */ jsx17("p", { className: cn("text-sm text-gray-500", classNames?.status), children: hasFilters ? labels.noResults : labels.empty }) : null,
|
|
2622
|
+
/* @__PURE__ */ jsx17("ul", { className: cn("space-y-2", classNames?.list), children: documents.map((document2) => {
|
|
2808
2623
|
const isFromCustomer = !TEAM_SOURCES2.has(document2.source);
|
|
2809
2624
|
const SourceIcon = isFromCustomer ? Users2 : Bot2;
|
|
2810
|
-
return /* @__PURE__ */
|
|
2625
|
+
return /* @__PURE__ */ jsxs12(
|
|
2811
2626
|
"li",
|
|
2812
2627
|
{
|
|
2813
2628
|
className: cn(
|
|
@@ -2815,23 +2630,23 @@ function DocumentsLibrary({
|
|
|
2815
2630
|
classNames?.item
|
|
2816
2631
|
),
|
|
2817
2632
|
children: [
|
|
2818
|
-
/* @__PURE__ */
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
2634
|
+
/* @__PURE__ */ jsx17(FileIcon, { filename: document2.filename, mimeType: document2.mimeType }),
|
|
2635
|
+
/* @__PURE__ */ jsxs12("div", { className: "min-w-0 flex-1", children: [
|
|
2636
|
+
/* @__PURE__ */ jsx17("div", { className: cn("truncate text-sm font-medium", classNames?.filename), "data-cv-tooltip": document2.filename, children: document2.filename }),
|
|
2637
|
+
/* @__PURE__ */ jsxs12("div", { className: cn("flex flex-wrap items-center gap-x-2 text-xs text-gray-500", classNames?.meta), children: [
|
|
2638
|
+
/* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1", children: [
|
|
2639
|
+
/* @__PURE__ */ jsx17(SourceIcon, { size: 11 }),
|
|
2825
2640
|
isFromCustomer ? labels.sourceFilterCustomer : labels.sourceFilterTeam
|
|
2826
2641
|
] }),
|
|
2827
|
-
/* @__PURE__ */
|
|
2828
|
-
/* @__PURE__ */
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ jsx17("span", { children: "\xB7" }),
|
|
2643
|
+
/* @__PURE__ */ jsx17("span", { children: formatDateTime(document2.linkedAt) }),
|
|
2644
|
+
/* @__PURE__ */ jsx17("span", { children: "\xB7" }),
|
|
2645
|
+
/* @__PURE__ */ jsx17("span", { children: formatFileSize(document2.sizeBytes) })
|
|
2831
2646
|
] })
|
|
2832
2647
|
] })
|
|
2833
2648
|
] }),
|
|
2834
|
-
onOpenConversation ? /* @__PURE__ */
|
|
2649
|
+
onOpenConversation ? /* @__PURE__ */ jsxs12(
|
|
2835
2650
|
"button",
|
|
2836
2651
|
{
|
|
2837
2652
|
type: "button",
|
|
@@ -2840,13 +2655,13 @@ function DocumentsLibrary({
|
|
|
2840
2655
|
"aria-label": labels.openConversation,
|
|
2841
2656
|
className: cn("cv-header-action inline-flex shrink-0 items-center gap-1", classNames?.conversationLink),
|
|
2842
2657
|
children: [
|
|
2843
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ jsx17(MessageSquare, { size: 12 }),
|
|
2844
2659
|
formatPhone(document2.conversationId)
|
|
2845
2660
|
]
|
|
2846
2661
|
}
|
|
2847
|
-
) : /* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2662
|
+
) : /* @__PURE__ */ jsx17("span", { className: cn("shrink-0 text-xs text-gray-500", classNames?.conversationLink), children: formatPhone(document2.conversationId) }),
|
|
2663
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex shrink-0 gap-1", children: [
|
|
2664
|
+
/* @__PURE__ */ jsx17(
|
|
2850
2665
|
"button",
|
|
2851
2666
|
{
|
|
2852
2667
|
type: "button",
|
|
@@ -2854,10 +2669,10 @@ function DocumentsLibrary({
|
|
|
2854
2669
|
"data-cv-tooltip": labels.view,
|
|
2855
2670
|
"aria-label": `${labels.view}: ${document2.filename}`,
|
|
2856
2671
|
className: "cv-header-icon",
|
|
2857
|
-
children: /* @__PURE__ */
|
|
2672
|
+
children: /* @__PURE__ */ jsx17(Eye2, { size: 14 })
|
|
2858
2673
|
}
|
|
2859
2674
|
),
|
|
2860
|
-
/* @__PURE__ */
|
|
2675
|
+
/* @__PURE__ */ jsx17(
|
|
2861
2676
|
"button",
|
|
2862
2677
|
{
|
|
2863
2678
|
type: "button",
|
|
@@ -2865,7 +2680,7 @@ function DocumentsLibrary({
|
|
|
2865
2680
|
"data-cv-tooltip": labels.download,
|
|
2866
2681
|
"aria-label": `${labels.download}: ${document2.filename}`,
|
|
2867
2682
|
className: "cv-header-icon",
|
|
2868
|
-
children: /* @__PURE__ */
|
|
2683
|
+
children: /* @__PURE__ */ jsx17(Download2, { size: 14 })
|
|
2869
2684
|
}
|
|
2870
2685
|
)
|
|
2871
2686
|
] })
|
|
@@ -2874,10 +2689,10 @@ function DocumentsLibrary({
|
|
|
2874
2689
|
`${document2.conversationId}:${document2.id}`
|
|
2875
2690
|
);
|
|
2876
2691
|
}) }),
|
|
2877
|
-
total > perPage ? /* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
2880
|
-
/* @__PURE__ */
|
|
2692
|
+
total > perPage ? /* @__PURE__ */ jsxs12("div", { className: cn("flex items-center justify-between border-t pt-2 text-xs dark:border-gray-700", classNames?.pagination), children: [
|
|
2693
|
+
/* @__PURE__ */ jsx17("span", { className: "text-gray-400", children: labels.total(total) }),
|
|
2694
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2695
|
+
/* @__PURE__ */ jsx17(
|
|
2881
2696
|
"button",
|
|
2882
2697
|
{
|
|
2883
2698
|
"data-cv-tooltip": PAGINATION_LABELS.previous,
|
|
@@ -2889,8 +2704,8 @@ function DocumentsLibrary({
|
|
|
2889
2704
|
children: "\u2039"
|
|
2890
2705
|
}
|
|
2891
2706
|
),
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ jsx17("span", { className: "text-gray-500", children: labels.page(page, lastPage) }),
|
|
2708
|
+
/* @__PURE__ */ jsx17(
|
|
2894
2709
|
"button",
|
|
2895
2710
|
{
|
|
2896
2711
|
"data-cv-tooltip": PAGINATION_LABELS.next,
|
|
@@ -2955,7 +2770,7 @@ function toConversationSimulatorClient({
|
|
|
2955
2770
|
|
|
2956
2771
|
// src/preview/ConversationPreview.tsx
|
|
2957
2772
|
import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo4, useRef as useRef8, useState as useState13 } from "react";
|
|
2958
|
-
import { jsx as
|
|
2773
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2959
2774
|
function mediaTypeOf(mimeType) {
|
|
2960
2775
|
return mediaKindOf(mimeType);
|
|
2961
2776
|
}
|
|
@@ -3105,11 +2920,11 @@ function ConversationPreview({
|
|
|
3105
2920
|
setFailure(error instanceof Error ? error.message : "Falha ao enviar o arquivo.");
|
|
3106
2921
|
}
|
|
3107
2922
|
}
|
|
3108
|
-
return /* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3110
|
-
rendered.map(({ message, isFirstInGroup, showDateDivider }) => /* @__PURE__ */
|
|
3111
|
-
showDateDivider ? /* @__PURE__ */
|
|
3112
|
-
/* @__PURE__ */
|
|
2923
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
2924
|
+
/* @__PURE__ */ jsxs13(ConversationWallpaper, { className: "flex-1 min-h-0 overflow-y-auto px-4 py-3", children: [
|
|
2925
|
+
rendered.map(({ message, isFirstInGroup, showDateDivider }) => /* @__PURE__ */ jsxs13("div", { children: [
|
|
2926
|
+
showDateDivider ? /* @__PURE__ */ jsx18(DateDivider, { iso: message.timestamp }) : null,
|
|
2927
|
+
/* @__PURE__ */ jsx18(
|
|
3113
2928
|
MessageBubble,
|
|
3114
2929
|
{
|
|
3115
2930
|
message,
|
|
@@ -3119,17 +2934,17 @@ function ConversationPreview({
|
|
|
3119
2934
|
}
|
|
3120
2935
|
)
|
|
3121
2936
|
] }, message.id)),
|
|
3122
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx18("div", { ref: bottomRef })
|
|
3123
2938
|
] }),
|
|
3124
|
-
failure ? /* @__PURE__ */
|
|
3125
|
-
loadFailure ? /* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
2939
|
+
failure ? /* @__PURE__ */ jsx18("p", { role: "alert", className: "px-4 py-2 text-sm text-red-600 dark:text-red-400", children: failure }) : null,
|
|
2940
|
+
loadFailure ? /* @__PURE__ */ jsx18("p", { role: "status", className: "px-4 py-2 text-sm text-amber-700 dark:text-amber-400", children: loadFailure }) : null,
|
|
2941
|
+
/* @__PURE__ */ jsx18(
|
|
3127
2942
|
MessageComposer,
|
|
3128
2943
|
{
|
|
3129
2944
|
onSend: (text) => void handleSend(text),
|
|
3130
2945
|
onAttach: canAttachFile ? (file) => void handleAttach(file) : void 0,
|
|
3131
2946
|
placeholder: isRecording ? "Gravando\u2026 toque no quadrado para ouvir" : placeholder ?? "Escreva como o cliente\u2026",
|
|
3132
|
-
idleAction: canRecordAudio ? /* @__PURE__ */
|
|
2947
|
+
idleAction: canRecordAudio ? /* @__PURE__ */ jsx18(
|
|
3133
2948
|
AudioRecorderButton,
|
|
3134
2949
|
{
|
|
3135
2950
|
onRecorded: (file) => void handleAttach(file),
|
|
@@ -3143,7 +2958,7 @@ function ConversationPreview({
|
|
|
3143
2958
|
}
|
|
3144
2959
|
|
|
3145
2960
|
// src/preview/ConversationSimulatorPanel.tsx
|
|
3146
|
-
import { jsx as
|
|
2961
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3147
2962
|
var DEFAULT_CONVERSATION_SIMULATOR_PANEL_LABELS = {
|
|
3148
2963
|
title: "Simulador do cliente",
|
|
3149
2964
|
destinationHint: "entrega no webhook real",
|
|
@@ -3163,6 +2978,14 @@ var SIMULATOR_PANEL_CHANNEL_WORDING = {
|
|
|
3163
2978
|
destinationHint: DEFAULT_CONVERSATION_SIMULATOR_PANEL_LABELS.destinationHint,
|
|
3164
2979
|
placeholder: DEFAULT_CONVERSATION_SIMULATOR_PANEL_LABELS.placeholder
|
|
3165
2980
|
},
|
|
2981
|
+
[CONVERSATION_CHANNEL.APP]: {
|
|
2982
|
+
destinationHint: "entrega no app do contratante",
|
|
2983
|
+
placeholder: "Escreva como quem usa o app\u2026"
|
|
2984
|
+
},
|
|
2985
|
+
[CONVERSATION_CHANNEL.PORTAL]: {
|
|
2986
|
+
destinationHint: "entrega no portal do contratante",
|
|
2987
|
+
placeholder: "Escreva como quem usa o portal\u2026"
|
|
2988
|
+
},
|
|
3166
2989
|
[CONVERSATION_CHANNEL.WEBCHAT]: {
|
|
3167
2990
|
destinationHint: "entrega na API do chat do site",
|
|
3168
2991
|
placeholder: "Escreva como o visitante\u2026"
|
|
@@ -3189,45 +3012,27 @@ function ConversationSimulatorPanel({
|
|
|
3189
3012
|
}) {
|
|
3190
3013
|
const text = { ...simulatorPanelLabelsOf(channel), ...labels };
|
|
3191
3014
|
const subtitle = [displayHandle ?? displayNumber ?? previewProps.conversationId, text.destinationHint].join(" \xB7 ");
|
|
3192
|
-
return /* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3015
|
+
return /* @__PURE__ */ jsxs14("aside", { className: "cv-simulator-panel", "aria-label": text.title, children: [
|
|
3016
|
+
/* @__PURE__ */ jsxs14("header", { className: "cv-simulator-panel__header", children: [
|
|
3017
|
+
/* @__PURE__ */ jsxs14("div", { className: "cv-simulator-panel__heading", children: [
|
|
3018
|
+
/* @__PURE__ */ jsx19("h2", { className: "cv-simulator-panel__title", children: text.title }),
|
|
3019
|
+
/* @__PURE__ */ jsx19("p", { className: "cv-simulator-panel__subtitle", children: subtitle })
|
|
3197
3020
|
] }),
|
|
3198
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsxs14("div", { className: "cv-simulator-panel__actions", children: [
|
|
3199
3022
|
headerActions,
|
|
3200
|
-
/* @__PURE__ */
|
|
3023
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: onClose, "data-cv-tooltip": text.close, "aria-label": text.close, className: "cv-simulator-panel__close", children: /* @__PURE__ */ jsx19("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx19("path", { d: "M18 6 6 18M6 6l12 12" }) }) })
|
|
3201
3024
|
] })
|
|
3202
3025
|
] }),
|
|
3203
|
-
/* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ jsx19("div", { className: "cv-simulator-panel__body", children: /* @__PURE__ */ jsx19(ConversationPreview, { ...previewProps, placeholder: text.placeholder }) })
|
|
3204
3027
|
] });
|
|
3205
3028
|
}
|
|
3206
3029
|
|
|
3207
3030
|
export {
|
|
3208
3031
|
ConversationLocalesProvider,
|
|
3209
3032
|
useConversationLocales,
|
|
3210
|
-
formatPhone,
|
|
3211
|
-
phoneInitials,
|
|
3212
|
-
CONVERSATION_CHANNEL,
|
|
3213
|
-
DEFAULT_CONVERSATION_CHANNEL,
|
|
3214
|
-
REOPEN_MECHANISM,
|
|
3215
|
-
HANDLE_KIND,
|
|
3216
|
-
CHANNEL_CAPABILITIES,
|
|
3217
|
-
capabilitiesOf,
|
|
3218
|
-
CHANNEL_FILTER_ALL,
|
|
3219
|
-
channelFiltersFor,
|
|
3220
|
-
formatContactHandle,
|
|
3221
|
-
contactFlag,
|
|
3222
|
-
channelCapabilityFor,
|
|
3223
|
-
StatusTicks,
|
|
3224
3033
|
AudioPlayer,
|
|
3225
3034
|
AudioTranscription,
|
|
3226
3035
|
FileIcon,
|
|
3227
|
-
formatTimestamp,
|
|
3228
|
-
formatDateTime,
|
|
3229
|
-
isSameDay,
|
|
3230
|
-
formatFileSize,
|
|
3231
3036
|
documentTypeLabel,
|
|
3232
3037
|
MediaRenderer,
|
|
3233
3038
|
DEFAULT_LIGHTBOX_LABELS,
|