@adatechnology/conversations-ui 0.1.0-rc.11 → 0.1.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3RKFU46R.js → chunk-QFEESERN.js} +198 -107
- package/dist/index.d.ts +79 -3
- package/dist/index.js +696 -435
- package/dist/preview/index.d.ts +3 -37
- package/dist/preview/index.js +36 -124
- package/dist/{types-B5C1DLu1.d.ts → types-C_dqJ83O.d.ts} +42 -1
- package/package.json +1 -1
- package/src/RichMessageComposer.test.tsx +83 -0
- package/src/RichMessageComposer.tsx +379 -0
- package/src/{preview/audioRecorderFormat.test.ts → audioRecorderFormat.test.ts} +1 -1
- package/src/index.ts +15 -0
- package/src/preview/ConversationPreview.tsx +1 -1
- package/src/preview/index.ts +2 -2
- /package/src/{preview/AudioRecorderButton.tsx → AudioRecorderButton.tsx} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AudioPlayer,
|
|
3
|
+
AudioRecorderButton,
|
|
3
4
|
ConversationDocumentsPanel,
|
|
4
5
|
ConversationLocalesProvider,
|
|
5
6
|
ConversationWallpaper,
|
|
6
7
|
ConversationsProvider,
|
|
7
8
|
DEFAULT_ACCEPTED_FILE_TYPES,
|
|
9
|
+
DEFAULT_AUDIO_RECORDER_BUTTON_LABELS,
|
|
8
10
|
DEFAULT_CONVERSATION_DOCUMENTS_LABELS,
|
|
9
11
|
DEFAULT_DOCUMENTS_LIBRARY_LABELS,
|
|
10
12
|
DEFAULT_EMOJI_PICKER_LABELS,
|
|
11
13
|
DEFAULT_INTERACTIVE_MESSAGE_LABELS,
|
|
12
14
|
DEFAULT_LIGHTBOX_LABELS,
|
|
15
|
+
DEFAULT_MAX_RECORDING_MILLISECONDS,
|
|
13
16
|
DEFAULT_MESSAGE_COMPOSER_LABELS,
|
|
14
17
|
DOCUMENT_SOURCE_FILTER,
|
|
15
18
|
DateDivider,
|
|
@@ -41,7 +44,7 @@ import {
|
|
|
41
44
|
useConversationDocuments,
|
|
42
45
|
useConversationLocales,
|
|
43
46
|
useConversations
|
|
44
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-QFEESERN.js";
|
|
45
48
|
import {
|
|
46
49
|
htmlToWA,
|
|
47
50
|
parseWhatsAppFormatting,
|
|
@@ -51,128 +54,14 @@ import {
|
|
|
51
54
|
waToHTMLInline
|
|
52
55
|
} from "./chunk-2AYDBWNE.js";
|
|
53
56
|
|
|
54
|
-
// src/
|
|
55
|
-
import { useRef } from "react";
|
|
56
|
-
import { Bold, Italic, Strikethrough } from "lucide-react";
|
|
57
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
58
|
-
var DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS = {
|
|
59
|
-
bold: "Negrito",
|
|
60
|
-
boldHint: "Negrito (*texto*)",
|
|
61
|
-
italic: "It\xE1lico",
|
|
62
|
-
italicHint: "It\xE1lico (_texto_)",
|
|
63
|
-
strikethrough: "Tachado",
|
|
64
|
-
strikethroughHint: "Tachado (~texto~)",
|
|
65
|
-
insertPlaceholder: (token) => `Inserir ${token}`
|
|
66
|
-
};
|
|
67
|
-
var INLINE_TOKEN = /(\*[^*\n]+\*|_[^_\n]+_|~[^~\n]+~|`[^`\n]+`|\{[a-zA-Z_]+\})/g;
|
|
68
|
-
function renderLine(line, lineKey) {
|
|
69
|
-
const nodes = [];
|
|
70
|
-
let lastIndex = 0;
|
|
71
|
-
let match;
|
|
72
|
-
let tokenIndex = 0;
|
|
73
|
-
INLINE_TOKEN.lastIndex = 0;
|
|
74
|
-
while ((match = INLINE_TOKEN.exec(line)) !== null) {
|
|
75
|
-
if (match.index > lastIndex) nodes.push(line.slice(lastIndex, match.index));
|
|
76
|
-
const token = match[0];
|
|
77
|
-
const key = `${lineKey}-${tokenIndex++}`;
|
|
78
|
-
if (token.startsWith("*")) nodes.push(/* @__PURE__ */ jsx("strong", { children: token.slice(1, -1) }, key));
|
|
79
|
-
else if (token.startsWith("_")) nodes.push(/* @__PURE__ */ jsx("em", { children: token.slice(1, -1) }, key));
|
|
80
|
-
else if (token.startsWith("~")) nodes.push(/* @__PURE__ */ jsx("s", { children: token.slice(1, -1) }, key));
|
|
81
|
-
else if (token.startsWith("`")) nodes.push(/* @__PURE__ */ jsx("code", { className: "font-mono text-[0.85em]", children: token.slice(1, -1) }, key));
|
|
82
|
-
else nodes.push(/* @__PURE__ */ jsx("span", { className: "rounded bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 px-1", children: token }, key));
|
|
83
|
-
lastIndex = INLINE_TOKEN.lastIndex;
|
|
84
|
-
}
|
|
85
|
-
if (lastIndex < line.length) nodes.push(line.slice(lastIndex));
|
|
86
|
-
return nodes;
|
|
87
|
-
}
|
|
88
|
-
function renderWhatsApp(text) {
|
|
89
|
-
const lines = text.split("\n");
|
|
90
|
-
return lines.map((line, index) => /* @__PURE__ */ jsxs("span", { children: [
|
|
91
|
-
renderLine(line, `ln-${index}`),
|
|
92
|
-
index < lines.length - 1 ? /* @__PURE__ */ jsx("br", {}) : null
|
|
93
|
-
] }, `ln-${index}`));
|
|
94
|
-
}
|
|
95
|
-
function WhatsAppMessageEditor({
|
|
96
|
-
value,
|
|
97
|
-
onChange,
|
|
98
|
-
placeholder,
|
|
99
|
-
placeholders = [],
|
|
100
|
-
rows = 4,
|
|
101
|
-
previewLabel = "Pr\xE9via (como aparece no WhatsApp)",
|
|
102
|
-
emptyPreviewText = "Sua mensagem aparecer\xE1 aqui\u2026",
|
|
103
|
-
labels
|
|
104
|
-
}) {
|
|
105
|
-
const editorLabels = { ...DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS, ...labels };
|
|
106
|
-
const textareaRef = useRef(null);
|
|
107
|
-
function wrapSelection(marker) {
|
|
108
|
-
const textarea = textareaRef.current;
|
|
109
|
-
if (!textarea) return;
|
|
110
|
-
const start = textarea.selectionStart;
|
|
111
|
-
const end = textarea.selectionEnd;
|
|
112
|
-
const selected = value.slice(start, end) || "texto";
|
|
113
|
-
const next = value.slice(0, start) + marker + selected + marker + value.slice(end);
|
|
114
|
-
onChange(next);
|
|
115
|
-
requestAnimationFrame(() => {
|
|
116
|
-
textarea.focus();
|
|
117
|
-
textarea.setSelectionRange(start + marker.length, start + marker.length + selected.length);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function insertAtCursor(snippet) {
|
|
121
|
-
const textarea = textareaRef.current;
|
|
122
|
-
if (!textarea) return;
|
|
123
|
-
const start = textarea.selectionStart;
|
|
124
|
-
const end = textarea.selectionEnd;
|
|
125
|
-
const next = value.slice(0, start) + snippet + value.slice(end);
|
|
126
|
-
onChange(next);
|
|
127
|
-
requestAnimationFrame(() => {
|
|
128
|
-
textarea.focus();
|
|
129
|
-
const caret = start + snippet.length;
|
|
130
|
-
textarea.setSelectionRange(caret, caret);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
const toolbarButtonClass = "inline-flex items-center justify-center h-8 w-8 rounded-lg border border-gray-200 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors";
|
|
134
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
135
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5 mb-2", children: [
|
|
136
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => wrapSelection("*"), className: toolbarButtonClass, title: editorLabels.boldHint, "aria-label": editorLabels.bold, children: /* @__PURE__ */ jsx(Bold, { size: 15 }) }),
|
|
137
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => wrapSelection("_"), className: toolbarButtonClass, title: editorLabels.italicHint, "aria-label": editorLabels.italic, children: /* @__PURE__ */ jsx(Italic, { size: 15 }) }),
|
|
138
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => wrapSelection("~"), className: toolbarButtonClass, title: editorLabels.strikethroughHint, "aria-label": editorLabels.strikethrough, children: /* @__PURE__ */ jsx(Strikethrough, { size: 15 }) }),
|
|
139
|
-
placeholders.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
140
|
-
/* @__PURE__ */ jsx("span", { className: "mx-1 h-5 w-px bg-gray-200 dark:bg-gray-600" }),
|
|
141
|
-
placeholders.map((token) => /* @__PURE__ */ jsx(
|
|
142
|
-
"button",
|
|
143
|
-
{
|
|
144
|
-
type: "button",
|
|
145
|
-
onClick: () => insertAtCursor(token),
|
|
146
|
-
className: "inline-flex items-center h-8 px-2 rounded-lg border border-gray-200 dark:border-gray-600 text-xs text-blue-600 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/40 transition-colors",
|
|
147
|
-
title: editorLabels.insertPlaceholder(token),
|
|
148
|
-
children: token
|
|
149
|
-
},
|
|
150
|
-
token
|
|
151
|
-
))
|
|
152
|
-
] })
|
|
153
|
-
] }),
|
|
154
|
-
/* @__PURE__ */ jsx(
|
|
155
|
-
"textarea",
|
|
156
|
-
{
|
|
157
|
-
ref: textareaRef,
|
|
158
|
-
value,
|
|
159
|
-
onChange: (event) => onChange(event.target.value),
|
|
160
|
-
placeholder,
|
|
161
|
-
rows,
|
|
162
|
-
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all placeholder:text-gray-400 dark:placeholder:text-gray-500 resize-y"
|
|
163
|
-
}
|
|
164
|
-
),
|
|
165
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
166
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400 mb-1", children: previewLabel }),
|
|
167
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-xl bg-[#e5ded8] dark:bg-gray-900 p-3", children: /* @__PURE__ */ jsx("div", { className: "inline-block max-w-full rounded-lg rounded-tl-none bg-white dark:bg-gray-800 shadow-sm px-3 py-2 text-sm text-gray-800 dark:text-gray-100 whitespace-pre-wrap break-words", children: value.trim() ? renderWhatsApp(value) : /* @__PURE__ */ jsx("span", { className: "text-gray-400 dark:text-gray-500", children: emptyPreviewText }) }) })
|
|
168
|
-
] })
|
|
169
|
-
] });
|
|
170
|
-
}
|
|
57
|
+
// src/RichMessageComposer.tsx
|
|
58
|
+
import { forwardRef, useCallback, useEffect as useEffect2, useImperativeHandle, useRef as useRef2, useState as useState2 } from "react";
|
|
59
|
+
import { Bold, Italic, Strikethrough, Code, Paperclip, SendHorizonal, Braces } from "lucide-react";
|
|
171
60
|
|
|
172
61
|
// src/SimpleEmojiPicker.tsx
|
|
173
|
-
import { useEffect, useRef
|
|
62
|
+
import { useEffect, useRef, useState } from "react";
|
|
174
63
|
import { Smile } from "lucide-react";
|
|
175
|
-
import { jsx
|
|
64
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
176
65
|
var EMOJIS = [
|
|
177
66
|
"\u{1F600}",
|
|
178
67
|
"\u{1F602}",
|
|
@@ -257,7 +146,7 @@ var EMOJIS = [
|
|
|
257
146
|
];
|
|
258
147
|
function SimpleEmojiPicker({ onSelect, label = "Emojis", pickerWidth = "280px", pickerMaxHeight = "220px" }) {
|
|
259
148
|
const [open, setOpen] = useState(false);
|
|
260
|
-
const containerRef =
|
|
149
|
+
const containerRef = useRef(null);
|
|
261
150
|
useEffect(() => {
|
|
262
151
|
if (!open) return;
|
|
263
152
|
const handleClickOutside = (e) => {
|
|
@@ -268,23 +157,23 @@ function SimpleEmojiPicker({ onSelect, label = "Emojis", pickerWidth = "280px",
|
|
|
268
157
|
document.addEventListener("mousedown", handleClickOutside);
|
|
269
158
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
270
159
|
}, [open]);
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative flex-shrink-0", children: [
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
273
162
|
"button",
|
|
274
163
|
{
|
|
275
164
|
type: "button",
|
|
276
165
|
onClick: () => setOpen((v) => !v),
|
|
277
166
|
className: "w-7 h-7 flex items-center justify-center rounded-lg text-gray-400 dark:text-gray-500 hover:text-teal-600 dark:hover:text-teal-400 hover:bg-teal-50 dark:hover:bg-teal-900/30 transition-colors",
|
|
278
167
|
title: label,
|
|
279
|
-
children: /* @__PURE__ */
|
|
168
|
+
children: /* @__PURE__ */ jsx(Smile, { size: 15 })
|
|
280
169
|
}
|
|
281
170
|
),
|
|
282
|
-
open && /* @__PURE__ */
|
|
171
|
+
open && /* @__PURE__ */ jsx("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-xl shadow-xl p-2 z-50", children: /* @__PURE__ */ jsx(
|
|
283
172
|
"div",
|
|
284
173
|
{
|
|
285
174
|
className: "grid grid-cols-10 gap-0.5 overflow-y-auto",
|
|
286
175
|
style: { width: pickerWidth, maxHeight: pickerMaxHeight },
|
|
287
|
-
children: EMOJIS.map((emoji) => /* @__PURE__ */
|
|
176
|
+
children: EMOJIS.map((emoji) => /* @__PURE__ */ jsx(
|
|
288
177
|
"button",
|
|
289
178
|
{
|
|
290
179
|
type: "button",
|
|
@@ -302,8 +191,374 @@ function SimpleEmojiPicker({ onSelect, label = "Emojis", pickerWidth = "280px",
|
|
|
302
191
|
] });
|
|
303
192
|
}
|
|
304
193
|
|
|
194
|
+
// src/RichMessageComposer.tsx
|
|
195
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
196
|
+
var RICH_COMPOSER_ACTION = {
|
|
197
|
+
BOLD: "bold",
|
|
198
|
+
ITALIC: "italic",
|
|
199
|
+
STRIKETHROUGH: "strikethrough",
|
|
200
|
+
MONOSPACE: "monospace",
|
|
201
|
+
EMOJI: "emoji",
|
|
202
|
+
ATTACH: "attach",
|
|
203
|
+
VARIABLES: "variables"
|
|
204
|
+
};
|
|
205
|
+
var DEFAULT_RICH_COMPOSER_TOOLTIPS = {
|
|
206
|
+
bold: "Negrito",
|
|
207
|
+
italic: "It\xE1lico",
|
|
208
|
+
strikethrough: "Tachado",
|
|
209
|
+
monospace: "Monoespa\xE7ado",
|
|
210
|
+
emoji: "Emojis",
|
|
211
|
+
attach: "Anexar arquivo",
|
|
212
|
+
send: "Enviar",
|
|
213
|
+
variables: "Vari\xE1veis dispon\xEDveis"
|
|
214
|
+
};
|
|
215
|
+
var FORMATTING_ELEMENT = {
|
|
216
|
+
bold: "strong",
|
|
217
|
+
italic: "em",
|
|
218
|
+
strikethrough: "del",
|
|
219
|
+
monospace: "code"
|
|
220
|
+
};
|
|
221
|
+
var MONOSPACE_CLASS = "bg-black/5 dark:bg-white/10 rounded px-0.5 font-mono text-sm";
|
|
222
|
+
var RichMessageComposer = forwardRef(function RichMessageComposer2({
|
|
223
|
+
value,
|
|
224
|
+
onChange,
|
|
225
|
+
onSend,
|
|
226
|
+
onAttachFiles,
|
|
227
|
+
quickReplies,
|
|
228
|
+
variables,
|
|
229
|
+
toolbar,
|
|
230
|
+
tooltips,
|
|
231
|
+
placeholder,
|
|
232
|
+
disabled = false,
|
|
233
|
+
isSending = false,
|
|
234
|
+
idleAction,
|
|
235
|
+
attachmentsPreview,
|
|
236
|
+
acceptedFileTypes = DEFAULT_ACCEPTED_FILE_TYPES,
|
|
237
|
+
className
|
|
238
|
+
}, ref) {
|
|
239
|
+
const editorRef = useRef2(null);
|
|
240
|
+
const fileInputRef = useRef2(null);
|
|
241
|
+
const variablesRef = useRef2(null);
|
|
242
|
+
const [isVariablesOpen, setIsVariablesOpen] = useState2(false);
|
|
243
|
+
useEffect2(() => {
|
|
244
|
+
if (!isVariablesOpen) return;
|
|
245
|
+
const closeOnOutsideClick = (event) => {
|
|
246
|
+
if (!variablesRef.current?.contains(event.target)) setIsVariablesOpen(false);
|
|
247
|
+
};
|
|
248
|
+
document.addEventListener("mousedown", closeOnOutsideClick);
|
|
249
|
+
return () => document.removeEventListener("mousedown", closeOnOutsideClick);
|
|
250
|
+
}, [isVariablesOpen]);
|
|
251
|
+
const tooltipOf = (action) => tooltips?.[action] ?? DEFAULT_RICH_COMPOSER_TOOLTIPS[action];
|
|
252
|
+
const shows = (action) => toolbar?.[action] !== false;
|
|
253
|
+
const replaceContent = useCallback((text) => {
|
|
254
|
+
const editor = editorRef.current;
|
|
255
|
+
if (!editor) return;
|
|
256
|
+
editor.innerHTML = waToHTML(text);
|
|
257
|
+
onChange(htmlToWA(editor.innerHTML));
|
|
258
|
+
editor.focus();
|
|
259
|
+
}, [onChange]);
|
|
260
|
+
useImperativeHandle(ref, () => ({
|
|
261
|
+
setContent: replaceContent,
|
|
262
|
+
clear: () => {
|
|
263
|
+
const editor = editorRef.current;
|
|
264
|
+
if (!editor) return;
|
|
265
|
+
editor.innerHTML = "";
|
|
266
|
+
onChange("");
|
|
267
|
+
},
|
|
268
|
+
focus: () => editorRef.current?.focus()
|
|
269
|
+
}), [onChange, replaceContent]);
|
|
270
|
+
const currentRange = useCallback(() => {
|
|
271
|
+
const editor = editorRef.current;
|
|
272
|
+
if (!editor) return void 0;
|
|
273
|
+
editor.focus();
|
|
274
|
+
const selection = window.getSelection();
|
|
275
|
+
if (!selection?.rangeCount || !editor.contains(selection.anchorNode)) return void 0;
|
|
276
|
+
return selection.getRangeAt(0);
|
|
277
|
+
}, []);
|
|
278
|
+
const commitRange = useCallback((range, node) => {
|
|
279
|
+
const selection = window.getSelection();
|
|
280
|
+
range.setStartAfter(node);
|
|
281
|
+
range.collapse(true);
|
|
282
|
+
selection?.removeAllRanges();
|
|
283
|
+
selection?.addRange(range);
|
|
284
|
+
onChange(htmlToWA(editorRef.current?.innerHTML ?? ""));
|
|
285
|
+
}, [onChange]);
|
|
286
|
+
const insertAtCursor = useCallback((fragment) => {
|
|
287
|
+
const range = currentRange();
|
|
288
|
+
if (!range) return;
|
|
289
|
+
range.deleteContents();
|
|
290
|
+
const textNode = document.createTextNode(fragment);
|
|
291
|
+
range.insertNode(textNode);
|
|
292
|
+
commitRange(range, textNode);
|
|
293
|
+
}, [commitRange, currentRange]);
|
|
294
|
+
const wrapSelection = useCallback((action) => {
|
|
295
|
+
const range = currentRange();
|
|
296
|
+
const selectedText = range?.toString();
|
|
297
|
+
if (!range || !selectedText) return;
|
|
298
|
+
range.deleteContents();
|
|
299
|
+
const wrapper = document.createElement(FORMATTING_ELEMENT[action]);
|
|
300
|
+
if (action === "monospace") wrapper.className = MONOSPACE_CLASS;
|
|
301
|
+
wrapper.textContent = selectedText;
|
|
302
|
+
range.insertNode(wrapper);
|
|
303
|
+
commitRange(range, wrapper);
|
|
304
|
+
}, [commitRange, currentRange]);
|
|
305
|
+
const handleInput = useCallback((event) => {
|
|
306
|
+
onChange(htmlToWA(event.currentTarget.innerHTML));
|
|
307
|
+
}, [onChange]);
|
|
308
|
+
const handleKeyDown = useCallback((event) => {
|
|
309
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
310
|
+
event.preventDefault();
|
|
311
|
+
if (!disabled) onSend();
|
|
312
|
+
}
|
|
313
|
+
}, [disabled, onSend]);
|
|
314
|
+
const handleFileChange = useCallback((event) => {
|
|
315
|
+
if (event.target.files?.length) onAttachFiles?.(event.target.files);
|
|
316
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
317
|
+
}, [onAttachFiles]);
|
|
318
|
+
const canSend = value.trim().length > 0;
|
|
319
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col", className), children: [
|
|
320
|
+
attachmentsPreview,
|
|
321
|
+
quickReplies?.length ? (
|
|
322
|
+
/* Uma linha rolável no celular, quebrando em várias no desktop: empilhar os chips no
|
|
323
|
+
celular come a altura da conversa, que é o que o operador precisa ver. */
|
|
324
|
+
/* @__PURE__ */ jsx2("div", { className: "mb-2 flex flex-nowrap gap-1 overflow-x-auto sm:flex-wrap sm:overflow-x-visible [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: quickReplies.map((quickReply) => /* @__PURE__ */ jsx2(
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
type: "button",
|
|
328
|
+
title: quickReply.tooltip,
|
|
329
|
+
onClick: () => replaceContent(quickReply.text),
|
|
330
|
+
className: "whitespace-nowrap rounded-full border border-gray-200 bg-white px-2 py-1 text-xs text-gray-600 transition-colors hover:border-teal-200 hover:bg-teal-50 hover:text-teal-700 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:border-teal-800 dark:hover:bg-teal-950/40 dark:hover:text-teal-400",
|
|
331
|
+
children: quickReply.label
|
|
332
|
+
},
|
|
333
|
+
quickReply.id
|
|
334
|
+
)) })
|
|
335
|
+
) : null,
|
|
336
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-end gap-2", children: [
|
|
337
|
+
/* @__PURE__ */ jsx2("div", { className: "mb-0.5 hidden items-center gap-0.5 sm:flex", children: [
|
|
338
|
+
[RICH_COMPOSER_ACTION.BOLD, Bold],
|
|
339
|
+
[RICH_COMPOSER_ACTION.ITALIC, Italic],
|
|
340
|
+
[RICH_COMPOSER_ACTION.STRIKETHROUGH, Strikethrough],
|
|
341
|
+
[RICH_COMPOSER_ACTION.MONOSPACE, Code]
|
|
342
|
+
].filter(([action]) => shows(action)).map(([action, Icon]) => /* @__PURE__ */ jsx2(
|
|
343
|
+
"button",
|
|
344
|
+
{
|
|
345
|
+
type: "button",
|
|
346
|
+
onClick: () => wrapSelection(action),
|
|
347
|
+
title: tooltipOf(action),
|
|
348
|
+
"aria-label": tooltipOf(action),
|
|
349
|
+
className: "flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-teal-50 hover:text-teal-600 dark:text-gray-500 dark:hover:bg-teal-900/30 dark:hover:text-teal-400",
|
|
350
|
+
children: /* @__PURE__ */ jsx2(Icon, { size: 15 })
|
|
351
|
+
},
|
|
352
|
+
action
|
|
353
|
+
)) }),
|
|
354
|
+
shows(RICH_COMPOSER_ACTION.EMOJI) ? /* @__PURE__ */ jsx2(SimpleEmojiPicker, { onSelect: insertAtCursor, label: tooltipOf("emoji") }) : null,
|
|
355
|
+
variables?.length && shows(RICH_COMPOSER_ACTION.VARIABLES) ? /* @__PURE__ */ jsxs2("div", { ref: variablesRef, className: "relative", children: [
|
|
356
|
+
/* @__PURE__ */ jsx2(
|
|
357
|
+
"button",
|
|
358
|
+
{
|
|
359
|
+
type: "button",
|
|
360
|
+
onClick: () => setIsVariablesOpen((open) => !open),
|
|
361
|
+
title: tooltipOf("variables"),
|
|
362
|
+
"aria-label": tooltipOf("variables"),
|
|
363
|
+
"aria-expanded": isVariablesOpen,
|
|
364
|
+
className: "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-teal-50 hover:text-teal-600 dark:text-gray-500 dark:hover:bg-teal-900/30 dark:hover:text-teal-400",
|
|
365
|
+
children: /* @__PURE__ */ jsx2(Braces, { size: 18 })
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
isVariablesOpen ? /* @__PURE__ */ jsx2("div", { className: "absolute bottom-full left-0 z-20 mb-2 max-h-56 w-64 overflow-y-auto rounded-xl border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-800", children: variables.map((variable) => /* @__PURE__ */ jsxs2(
|
|
369
|
+
"button",
|
|
370
|
+
{
|
|
371
|
+
type: "button",
|
|
372
|
+
title: variable.tooltip ?? variable.value,
|
|
373
|
+
onClick: () => {
|
|
374
|
+
insertAtCursor(variable.value);
|
|
375
|
+
setIsVariablesOpen(false);
|
|
376
|
+
},
|
|
377
|
+
className: "flex w-full flex-col items-start px-3 py-1.5 text-left hover:bg-teal-50 dark:hover:bg-teal-950/40",
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ jsx2("span", { className: "text-sm text-gray-800 dark:text-gray-100", children: variable.label }),
|
|
380
|
+
/* @__PURE__ */ jsx2("span", { className: "font-mono text-xs text-gray-400 dark:text-gray-500", children: variable.value })
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
variable.id
|
|
384
|
+
)) }) : null
|
|
385
|
+
] }) : null,
|
|
386
|
+
onAttachFiles && shows(RICH_COMPOSER_ACTION.ATTACH) ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
387
|
+
/* @__PURE__ */ jsx2(
|
|
388
|
+
"input",
|
|
389
|
+
{
|
|
390
|
+
ref: fileInputRef,
|
|
391
|
+
type: "file",
|
|
392
|
+
multiple: true,
|
|
393
|
+
accept: acceptedFileTypes,
|
|
394
|
+
onChange: handleFileChange,
|
|
395
|
+
className: "hidden"
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
/* @__PURE__ */ jsx2(
|
|
399
|
+
"button",
|
|
400
|
+
{
|
|
401
|
+
type: "button",
|
|
402
|
+
onClick: () => fileInputRef.current?.click(),
|
|
403
|
+
title: tooltipOf("attach"),
|
|
404
|
+
"aria-label": tooltipOf("attach"),
|
|
405
|
+
className: "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-teal-50 hover:text-teal-600 dark:text-gray-500 dark:hover:bg-teal-900/30 dark:hover:text-teal-400",
|
|
406
|
+
children: /* @__PURE__ */ jsx2(Paperclip, { size: 18 })
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
] }) : null,
|
|
410
|
+
/* @__PURE__ */ jsx2(
|
|
411
|
+
"div",
|
|
412
|
+
{
|
|
413
|
+
ref: editorRef,
|
|
414
|
+
contentEditable: !disabled,
|
|
415
|
+
suppressContentEditableWarning: true,
|
|
416
|
+
role: "textbox",
|
|
417
|
+
"aria-multiline": "true",
|
|
418
|
+
"aria-label": placeholder,
|
|
419
|
+
"data-placeholder": placeholder,
|
|
420
|
+
onInput: handleInput,
|
|
421
|
+
onKeyDown: handleKeyDown,
|
|
422
|
+
style: { minHeight: "36px", maxHeight: "120px" },
|
|
423
|
+
className: "flex-1 min-w-[180px] overflow-y-auto rounded-2xl border border-gray-200 bg-gray-50 px-4 py-2 text-sm text-gray-800 transition-all focus:border-transparent focus:outline-none focus:ring-2 focus:ring-teal-300 dark:border-gray-700 dark:bg-gray-700 dark:text-gray-100 empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400 dark:empty:before:text-gray-500 before:pointer-events-none [&_strong]:font-semibold [&_em]:italic [&_del]:line-through [&_code]:rounded [&_code]:bg-black/5 [&_code]:px-0.5 [&_code]:font-mono [&_code]:text-sm dark:[&_code]:bg-white/10"
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
!canSend && idleAction ? /* @__PURE__ */ jsx2("div", { className: "flex-shrink-0", children: idleAction }) : /* @__PURE__ */ jsx2(
|
|
427
|
+
"button",
|
|
428
|
+
{
|
|
429
|
+
type: "button",
|
|
430
|
+
onClick: onSend,
|
|
431
|
+
disabled: disabled || isSending || !canSend,
|
|
432
|
+
title: tooltipOf("send"),
|
|
433
|
+
"aria-label": tooltipOf("send"),
|
|
434
|
+
className: "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full bg-teal-600 text-white transition-colors hover:bg-teal-700 disabled:cursor-not-allowed disabled:opacity-40",
|
|
435
|
+
children: isSending ? /* @__PURE__ */ jsx2("span", { className: "text-xs", children: "\u23F3" }) : /* @__PURE__ */ jsx2(SendHorizonal, { size: 16 })
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] })
|
|
439
|
+
] });
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
// src/WhatsAppMessageEditor.tsx
|
|
443
|
+
import { useRef as useRef3 } from "react";
|
|
444
|
+
import { Bold as Bold2, Italic as Italic2, Strikethrough as Strikethrough2 } from "lucide-react";
|
|
445
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
446
|
+
var DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS = {
|
|
447
|
+
bold: "Negrito",
|
|
448
|
+
boldHint: "Negrito (*texto*)",
|
|
449
|
+
italic: "It\xE1lico",
|
|
450
|
+
italicHint: "It\xE1lico (_texto_)",
|
|
451
|
+
strikethrough: "Tachado",
|
|
452
|
+
strikethroughHint: "Tachado (~texto~)",
|
|
453
|
+
insertPlaceholder: (token) => `Inserir ${token}`
|
|
454
|
+
};
|
|
455
|
+
var INLINE_TOKEN = /(\*[^*\n]+\*|_[^_\n]+_|~[^~\n]+~|`[^`\n]+`|\{[a-zA-Z_]+\})/g;
|
|
456
|
+
function renderLine(line, lineKey) {
|
|
457
|
+
const nodes = [];
|
|
458
|
+
let lastIndex = 0;
|
|
459
|
+
let match;
|
|
460
|
+
let tokenIndex = 0;
|
|
461
|
+
INLINE_TOKEN.lastIndex = 0;
|
|
462
|
+
while ((match = INLINE_TOKEN.exec(line)) !== null) {
|
|
463
|
+
if (match.index > lastIndex) nodes.push(line.slice(lastIndex, match.index));
|
|
464
|
+
const token = match[0];
|
|
465
|
+
const key = `${lineKey}-${tokenIndex++}`;
|
|
466
|
+
if (token.startsWith("*")) nodes.push(/* @__PURE__ */ jsx3("strong", { children: token.slice(1, -1) }, key));
|
|
467
|
+
else if (token.startsWith("_")) nodes.push(/* @__PURE__ */ jsx3("em", { children: token.slice(1, -1) }, key));
|
|
468
|
+
else if (token.startsWith("~")) nodes.push(/* @__PURE__ */ jsx3("s", { children: token.slice(1, -1) }, key));
|
|
469
|
+
else if (token.startsWith("`")) nodes.push(/* @__PURE__ */ jsx3("code", { className: "font-mono text-[0.85em]", children: token.slice(1, -1) }, key));
|
|
470
|
+
else nodes.push(/* @__PURE__ */ jsx3("span", { className: "rounded bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 px-1", children: token }, key));
|
|
471
|
+
lastIndex = INLINE_TOKEN.lastIndex;
|
|
472
|
+
}
|
|
473
|
+
if (lastIndex < line.length) nodes.push(line.slice(lastIndex));
|
|
474
|
+
return nodes;
|
|
475
|
+
}
|
|
476
|
+
function renderWhatsApp(text) {
|
|
477
|
+
const lines = text.split("\n");
|
|
478
|
+
return lines.map((line, index) => /* @__PURE__ */ jsxs3("span", { children: [
|
|
479
|
+
renderLine(line, `ln-${index}`),
|
|
480
|
+
index < lines.length - 1 ? /* @__PURE__ */ jsx3("br", {}) : null
|
|
481
|
+
] }, `ln-${index}`));
|
|
482
|
+
}
|
|
483
|
+
function WhatsAppMessageEditor({
|
|
484
|
+
value,
|
|
485
|
+
onChange,
|
|
486
|
+
placeholder,
|
|
487
|
+
placeholders = [],
|
|
488
|
+
rows = 4,
|
|
489
|
+
previewLabel = "Pr\xE9via (como aparece no WhatsApp)",
|
|
490
|
+
emptyPreviewText = "Sua mensagem aparecer\xE1 aqui\u2026",
|
|
491
|
+
labels
|
|
492
|
+
}) {
|
|
493
|
+
const editorLabels = { ...DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS, ...labels };
|
|
494
|
+
const textareaRef = useRef3(null);
|
|
495
|
+
function wrapSelection(marker) {
|
|
496
|
+
const textarea = textareaRef.current;
|
|
497
|
+
if (!textarea) return;
|
|
498
|
+
const start = textarea.selectionStart;
|
|
499
|
+
const end = textarea.selectionEnd;
|
|
500
|
+
const selected = value.slice(start, end) || "texto";
|
|
501
|
+
const next = value.slice(0, start) + marker + selected + marker + value.slice(end);
|
|
502
|
+
onChange(next);
|
|
503
|
+
requestAnimationFrame(() => {
|
|
504
|
+
textarea.focus();
|
|
505
|
+
textarea.setSelectionRange(start + marker.length, start + marker.length + selected.length);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function insertAtCursor(snippet) {
|
|
509
|
+
const textarea = textareaRef.current;
|
|
510
|
+
if (!textarea) return;
|
|
511
|
+
const start = textarea.selectionStart;
|
|
512
|
+
const end = textarea.selectionEnd;
|
|
513
|
+
const next = value.slice(0, start) + snippet + value.slice(end);
|
|
514
|
+
onChange(next);
|
|
515
|
+
requestAnimationFrame(() => {
|
|
516
|
+
textarea.focus();
|
|
517
|
+
const caret = start + snippet.length;
|
|
518
|
+
textarea.setSelectionRange(caret, caret);
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
const toolbarButtonClass = "inline-flex items-center justify-center h-8 w-8 rounded-lg border border-gray-200 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors";
|
|
522
|
+
return /* @__PURE__ */ jsxs3("div", { children: [
|
|
523
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-1.5 mb-2", children: [
|
|
524
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: () => wrapSelection("*"), className: toolbarButtonClass, title: editorLabels.boldHint, "aria-label": editorLabels.bold, children: /* @__PURE__ */ jsx3(Bold2, { size: 15 }) }),
|
|
525
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: () => wrapSelection("_"), className: toolbarButtonClass, title: editorLabels.italicHint, "aria-label": editorLabels.italic, children: /* @__PURE__ */ jsx3(Italic2, { size: 15 }) }),
|
|
526
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: () => wrapSelection("~"), className: toolbarButtonClass, title: editorLabels.strikethroughHint, "aria-label": editorLabels.strikethrough, children: /* @__PURE__ */ jsx3(Strikethrough2, { size: 15 }) }),
|
|
527
|
+
placeholders.length > 0 && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
528
|
+
/* @__PURE__ */ jsx3("span", { className: "mx-1 h-5 w-px bg-gray-200 dark:bg-gray-600" }),
|
|
529
|
+
placeholders.map((token) => /* @__PURE__ */ jsx3(
|
|
530
|
+
"button",
|
|
531
|
+
{
|
|
532
|
+
type: "button",
|
|
533
|
+
onClick: () => insertAtCursor(token),
|
|
534
|
+
className: "inline-flex items-center h-8 px-2 rounded-lg border border-gray-200 dark:border-gray-600 text-xs text-blue-600 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/40 transition-colors",
|
|
535
|
+
title: editorLabels.insertPlaceholder(token),
|
|
536
|
+
children: token
|
|
537
|
+
},
|
|
538
|
+
token
|
|
539
|
+
))
|
|
540
|
+
] })
|
|
541
|
+
] }),
|
|
542
|
+
/* @__PURE__ */ jsx3(
|
|
543
|
+
"textarea",
|
|
544
|
+
{
|
|
545
|
+
ref: textareaRef,
|
|
546
|
+
value,
|
|
547
|
+
onChange: (event) => onChange(event.target.value),
|
|
548
|
+
placeholder,
|
|
549
|
+
rows,
|
|
550
|
+
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all placeholder:text-gray-400 dark:placeholder:text-gray-500 resize-y"
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
/* @__PURE__ */ jsxs3("div", { className: "mt-2", children: [
|
|
554
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs text-gray-500 dark:text-gray-400 mb-1", children: previewLabel }),
|
|
555
|
+
/* @__PURE__ */ jsx3("div", { className: "rounded-xl bg-[#e5ded8] dark:bg-gray-900 p-3", children: /* @__PURE__ */ jsx3("div", { className: "inline-block max-w-full rounded-lg rounded-tl-none bg-white dark:bg-gray-800 shadow-sm px-3 py-2 text-sm text-gray-800 dark:text-gray-100 whitespace-pre-wrap break-words", children: value.trim() ? renderWhatsApp(value) : /* @__PURE__ */ jsx3("span", { className: "text-gray-400 dark:text-gray-500", children: emptyPreviewText }) }) })
|
|
556
|
+
] })
|
|
557
|
+
] });
|
|
558
|
+
}
|
|
559
|
+
|
|
305
560
|
// src/Avatar.tsx
|
|
306
|
-
import { jsx as
|
|
561
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
307
562
|
var DEFAULT_AVATAR_LABELS = {
|
|
308
563
|
unnamedContact: "Contato sem nome"
|
|
309
564
|
};
|
|
@@ -336,7 +591,7 @@ function Avatar({ name, avatarUrl, size = "md", className = "", labels }) {
|
|
|
336
591
|
const sizeClass = sizeClasses[size];
|
|
337
592
|
const unnamedContactLabel = labels?.unnamedContact ?? DEFAULT_AVATAR_LABELS.unnamedContact;
|
|
338
593
|
if (avatarUrl) {
|
|
339
|
-
return /* @__PURE__ */
|
|
594
|
+
return /* @__PURE__ */ jsx4(
|
|
340
595
|
"img",
|
|
341
596
|
{
|
|
342
597
|
src: avatarUrl,
|
|
@@ -347,17 +602,17 @@ function Avatar({ name, avatarUrl, size = "md", className = "", labels }) {
|
|
|
347
602
|
}
|
|
348
603
|
const bgColor = getBgColor(name);
|
|
349
604
|
if (!name) {
|
|
350
|
-
return /* @__PURE__ */
|
|
605
|
+
return /* @__PURE__ */ jsx4(
|
|
351
606
|
"div",
|
|
352
607
|
{
|
|
353
608
|
className: `${sizeClass} ${bgColor} rounded-full flex items-center justify-center text-white flex-shrink-0 ${className}`,
|
|
354
609
|
role: "img",
|
|
355
610
|
"aria-label": unnamedContactLabel,
|
|
356
|
-
children: /* @__PURE__ */
|
|
611
|
+
children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", className: "h-[60%] w-[60%]", "aria-hidden": true, children: /* @__PURE__ */ jsx4("path", { d: "M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Z" }) })
|
|
357
612
|
}
|
|
358
613
|
);
|
|
359
614
|
}
|
|
360
|
-
return /* @__PURE__ */
|
|
615
|
+
return /* @__PURE__ */ jsx4(
|
|
361
616
|
"div",
|
|
362
617
|
{
|
|
363
618
|
className: `${sizeClass} ${bgColor} rounded-full flex items-center justify-center text-white font-semibold flex-shrink-0 ${className}`,
|
|
@@ -450,7 +705,7 @@ function contactFlag(params) {
|
|
|
450
705
|
}
|
|
451
706
|
|
|
452
707
|
// src/ConversationListItem.tsx
|
|
453
|
-
import { jsx as
|
|
708
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
454
709
|
var DEFAULT_CONVERSATION_LIST_ITEM_LABELS = {
|
|
455
710
|
expiredWindow: "Janela expirada",
|
|
456
711
|
warningWindow: "Janela pr\xF3xima do fim"
|
|
@@ -533,7 +788,7 @@ var ConversationListItem = ({
|
|
|
533
788
|
onClick?.();
|
|
534
789
|
onSelect?.(conversation.id);
|
|
535
790
|
};
|
|
536
|
-
return /* @__PURE__ */
|
|
791
|
+
return /* @__PURE__ */ jsxs4(
|
|
537
792
|
"button",
|
|
538
793
|
{
|
|
539
794
|
onClick: handleClick,
|
|
@@ -542,34 +797,34 @@ var ConversationListItem = ({
|
|
|
542
797
|
backgroundColor: isActive && highlightActive ? "#f0f2f5" : "transparent"
|
|
543
798
|
},
|
|
544
799
|
children: [
|
|
545
|
-
/* @__PURE__ */
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
conversation.waitingHuman && /* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative flex-shrink-0", children: [
|
|
801
|
+
/* @__PURE__ */ jsx5(Avatar, { name: conversation.clientName, size: "lg" }),
|
|
802
|
+
conversation.waitingHuman && /* @__PURE__ */ jsx5("div", { className: "absolute -bottom-0.5 -right-0.5 w-3.5 h-3.5 bg-amber-400 rounded-full border-2 border-white" })
|
|
548
803
|
] }),
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
/* @__PURE__ */
|
|
552
|
-
!conversation.clientName && flag ? /* @__PURE__ */
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
windowStatus && windowStatus.label === "expired" && /* @__PURE__ */
|
|
555
|
-
windowStatus && windowStatus.label === "warning" && /* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 min-w-0", children: [
|
|
805
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
|
|
806
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
807
|
+
!conversation.clientName && flag ? /* @__PURE__ */ jsx5("span", { "aria-hidden": true, children: flag }) : null,
|
|
808
|
+
/* @__PURE__ */ jsx5("span", { className: "text-[16px] text-[#111b21] truncate", children: name }),
|
|
809
|
+
windowStatus && windowStatus.label === "expired" && /* @__PURE__ */ jsx5("span", { className: "w-2 h-2 rounded-full bg-red-500 flex-shrink-0", title: expiredWindowLabel }),
|
|
810
|
+
windowStatus && windowStatus.label === "warning" && /* @__PURE__ */ jsx5("span", { className: "w-2 h-2 rounded-full bg-orange-500 flex-shrink-0", title: warningWindowLabel })
|
|
556
811
|
] }),
|
|
557
|
-
timestamp && /* @__PURE__ */
|
|
812
|
+
timestamp && /* @__PURE__ */ jsx5("span", { className: "text-xs text-[#667781] flex-shrink-0", children: timestamp })
|
|
558
813
|
] }),
|
|
559
|
-
conversation.clientName ? /* @__PURE__ */
|
|
560
|
-
flag ? /* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
814
|
+
conversation.clientName ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 text-xs text-[#667781]", children: [
|
|
815
|
+
flag ? /* @__PURE__ */ jsx5("span", { "aria-hidden": true, children: flag }) : null,
|
|
816
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate", children: displayHandle })
|
|
562
817
|
] }) : null,
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
preview.icon && /* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mt-0.5", children: [
|
|
819
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-sm text-[#667781] truncate max-w-[180px]", children: [
|
|
820
|
+
preview.icon && /* @__PURE__ */ jsx5("span", { className: "mr-1", children: preview.icon }),
|
|
566
821
|
preview.preview || "Sem mensagens"
|
|
567
822
|
] }),
|
|
568
|
-
conversation.unread > 0 && /* @__PURE__ */
|
|
823
|
+
conversation.unread > 0 && /* @__PURE__ */ jsx5("span", { className: "bg-[#25d366] text-white text-xs font-semibold rounded-full min-w-[20px] h-5 px-1.5 flex items-center justify-center flex-shrink-0 ml-2", children: conversation.unread > 99 ? "99+" : conversation.unread })
|
|
569
824
|
] }),
|
|
570
|
-
/* @__PURE__ */
|
|
571
|
-
conversation.mode === "human" && /* @__PURE__ */
|
|
572
|
-
conversation.mode === "bot" && conversation.waitingHuman && /* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5 mt-1", children: [
|
|
826
|
+
conversation.mode === "human" && /* @__PURE__ */ jsx5("span", { className: "text-[10px] px-1.5 py-0.5 rounded font-medium bg-purple-100 text-purple-700", children: "Humano" }),
|
|
827
|
+
conversation.mode === "bot" && conversation.waitingHuman && /* @__PURE__ */ jsx5("span", { className: "text-[10px] px-1.5 py-0.5 rounded font-medium bg-amber-100 text-amber-700", children: "Aguardando" })
|
|
573
828
|
] })
|
|
574
829
|
] })
|
|
575
830
|
]
|
|
@@ -578,8 +833,8 @@ var ConversationListItem = ({
|
|
|
578
833
|
};
|
|
579
834
|
|
|
580
835
|
// src/Toast.tsx
|
|
581
|
-
import { createContext, useContext, useState as
|
|
582
|
-
import { jsx as
|
|
836
|
+
import { createContext, useContext, useState as useState3, useCallback as useCallback2, useEffect as useEffect3 } from "react";
|
|
837
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
583
838
|
var ToastContext = createContext(null);
|
|
584
839
|
var nextId = 0;
|
|
585
840
|
var singletonShow = null;
|
|
@@ -596,34 +851,34 @@ var typeStyles = {
|
|
|
596
851
|
info: "bg-blue-600"
|
|
597
852
|
};
|
|
598
853
|
var typeIcons = {
|
|
599
|
-
success: /* @__PURE__ */
|
|
600
|
-
error: /* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */
|
|
602
|
-
/* @__PURE__ */
|
|
854
|
+
success: /* @__PURE__ */ jsx6("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx6("polyline", { points: "20 6 9 17 4 12" }) }),
|
|
855
|
+
error: /* @__PURE__ */ jsxs5("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
856
|
+
/* @__PURE__ */ jsx6("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
857
|
+
/* @__PURE__ */ jsx6("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
603
858
|
] }),
|
|
604
|
-
info: /* @__PURE__ */
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
/* @__PURE__ */
|
|
859
|
+
info: /* @__PURE__ */ jsxs5("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
860
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "10" }),
|
|
861
|
+
/* @__PURE__ */ jsx6("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
862
|
+
/* @__PURE__ */ jsx6("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
608
863
|
] })
|
|
609
864
|
};
|
|
610
865
|
function ToastItemComponent({ item, onRemove }) {
|
|
611
|
-
const [exiting, setExiting] =
|
|
612
|
-
|
|
866
|
+
const [exiting, setExiting] = useState3(false);
|
|
867
|
+
useEffect3(() => {
|
|
613
868
|
const timer = setTimeout(() => {
|
|
614
869
|
setExiting(true);
|
|
615
870
|
setTimeout(() => onRemove(item.id), 300);
|
|
616
871
|
}, 5e3);
|
|
617
872
|
return () => clearTimeout(timer);
|
|
618
873
|
}, [item.id, onRemove]);
|
|
619
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ jsxs5(
|
|
620
875
|
"div",
|
|
621
876
|
{
|
|
622
877
|
className: `flex items-center gap-2 px-4 py-3 rounded-lg shadow-lg text-white text-sm min-w-[280px] max-w-[400px] ${typeStyles[item.type]} ${exiting ? "animate-slide-out" : "animate-slide-in"}`,
|
|
623
878
|
children: [
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ jsx6("span", { className: "flex-shrink-0", children: typeIcons[item.type] }),
|
|
880
|
+
/* @__PURE__ */ jsx6("span", { className: "flex-1", children: item.message }),
|
|
881
|
+
/* @__PURE__ */ jsx6(
|
|
627
882
|
"button",
|
|
628
883
|
{
|
|
629
884
|
onClick: () => {
|
|
@@ -631,9 +886,9 @@ function ToastItemComponent({ item, onRemove }) {
|
|
|
631
886
|
setTimeout(() => onRemove(item.id), 300);
|
|
632
887
|
},
|
|
633
888
|
className: "flex-shrink-0 opacity-70 hover:opacity-100 transition-opacity",
|
|
634
|
-
children: /* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
889
|
+
children: /* @__PURE__ */ jsxs5("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
890
|
+
/* @__PURE__ */ jsx6("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
891
|
+
/* @__PURE__ */ jsx6("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
637
892
|
] })
|
|
638
893
|
}
|
|
639
894
|
)
|
|
@@ -642,24 +897,24 @@ function ToastItemComponent({ item, onRemove }) {
|
|
|
642
897
|
);
|
|
643
898
|
}
|
|
644
899
|
function ToastProvider({ children }) {
|
|
645
|
-
const [items, setItems] =
|
|
646
|
-
const show =
|
|
900
|
+
const [items, setItems] = useState3([]);
|
|
901
|
+
const show = useCallback2((type, message) => {
|
|
647
902
|
const id = ++nextId;
|
|
648
903
|
setItems((prev) => [...prev, { id, type, message }]);
|
|
649
904
|
}, []);
|
|
650
|
-
const remove =
|
|
905
|
+
const remove = useCallback2((id) => {
|
|
651
906
|
setItems((prev) => prev.filter((item) => item.id !== id));
|
|
652
907
|
}, []);
|
|
653
|
-
|
|
908
|
+
useEffect3(() => {
|
|
654
909
|
singletonShow = show;
|
|
655
910
|
return () => {
|
|
656
911
|
singletonShow = null;
|
|
657
912
|
};
|
|
658
913
|
}, [show]);
|
|
659
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ jsxs5(ToastContext.Provider, { value: { show }, children: [
|
|
660
915
|
children,
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
916
|
+
/* @__PURE__ */ jsx6("div", { className: "fixed top-4 right-4 z-[100] flex flex-col gap-2", children: items.map((item) => /* @__PURE__ */ jsx6(ToastItemComponent, { item, onRemove: remove }, item.id)) }),
|
|
917
|
+
/* @__PURE__ */ jsx6("style", { children: `
|
|
663
918
|
@keyframes slide-in {
|
|
664
919
|
from { transform: translateX(100%); opacity: 0; }
|
|
665
920
|
to { transform: translateX(0); opacity: 1; }
|
|
@@ -682,11 +937,11 @@ function useToast() {
|
|
|
682
937
|
}
|
|
683
938
|
|
|
684
939
|
// src/MessageText.tsx
|
|
685
|
-
import { useCallback as
|
|
686
|
-
import { jsx as
|
|
940
|
+
import { useCallback as useCallback3, useState as useState4 } from "react";
|
|
941
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
687
942
|
function MessageText({ message }) {
|
|
688
|
-
const [copied, setCopied] =
|
|
689
|
-
const handleCopy =
|
|
943
|
+
const [copied, setCopied] = useState4(false);
|
|
944
|
+
const handleCopy = useCallback3(async () => {
|
|
690
945
|
if (!message.content) return;
|
|
691
946
|
try {
|
|
692
947
|
await navigator.clipboard.writeText(message.content);
|
|
@@ -696,35 +951,35 @@ function MessageText({ message }) {
|
|
|
696
951
|
}
|
|
697
952
|
}, [message.content]);
|
|
698
953
|
if (message.type === "template")
|
|
699
|
-
return /* @__PURE__ */
|
|
700
|
-
return /* @__PURE__ */
|
|
954
|
+
return /* @__PURE__ */ jsx7("p", { className: "text-sm italic text-[#667781]", children: message.content ?? "Template message" });
|
|
955
|
+
return /* @__PURE__ */ jsxs6(
|
|
701
956
|
"div",
|
|
702
957
|
{
|
|
703
958
|
onClick: handleCopy,
|
|
704
959
|
className: "text-[14.2px] leading-[19px] whitespace-pre-wrap break-words select-all [&_strong]:font-bold [&_em]:italic [&_del]:line-through",
|
|
705
960
|
children: [
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
copied && /* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsx7("span", { children: parseWhatsAppFormatting(message.content ?? "") }),
|
|
962
|
+
copied && /* @__PURE__ */ jsx7("span", { className: "absolute top-0 right-0 -translate-y-full bg-[#3b4a54] text-white text-[11px] px-1.5 py-0.5 rounded shadow-lg", children: "Copiado!" })
|
|
708
963
|
]
|
|
709
964
|
}
|
|
710
965
|
);
|
|
711
966
|
}
|
|
712
967
|
|
|
713
968
|
// src/MessageTimestamp.tsx
|
|
714
|
-
import { jsx as
|
|
969
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
715
970
|
function MessageTimestamp({ timestamp, status, isOutbound }) {
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
isOutbound && status && /* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-end gap-[3px]", children: [
|
|
972
|
+
/* @__PURE__ */ jsx8("span", { className: "text-[11px] text-[#667781] leading-[15px] select-none", children: timestamp }),
|
|
973
|
+
isOutbound && status && /* @__PURE__ */ jsx8("span", { className: "flex items-center -mr-[2px]", children: /* @__PURE__ */ jsx8(StatusTicks, { status }) })
|
|
719
974
|
] });
|
|
720
975
|
}
|
|
721
976
|
|
|
722
977
|
// src/MessageTail.tsx
|
|
723
|
-
import { jsx as
|
|
978
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
724
979
|
function MessageTail({ isOutbound }) {
|
|
725
980
|
if (isOutbound)
|
|
726
|
-
return /* @__PURE__ */
|
|
727
|
-
return /* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ jsx9("svg", { className: "absolute top-0 -right-[5px] w-[5px] h-[11px]", viewBox: "0 0 5 11", fill: "#d9fdd3", children: /* @__PURE__ */ jsx9("path", { d: "M5 0H0v11c1.5-2 4.5-2 5-4V0z" }) });
|
|
982
|
+
return /* @__PURE__ */ jsx9("svg", { className: "absolute top-0 -left-[5px] w-[5px] h-[11px]", viewBox: "0 0 5 11", fill: "white", children: /* @__PURE__ */ jsx9("path", { d: "M0 0h5v11C3.5 9 .5 9 0 7V0z" }) });
|
|
728
983
|
}
|
|
729
984
|
|
|
730
985
|
// src/conversationWindow.ts
|
|
@@ -769,7 +1024,7 @@ function formatStalledFor(lastAt, now) {
|
|
|
769
1024
|
}
|
|
770
1025
|
|
|
771
1026
|
// src/ChannelIcon.tsx
|
|
772
|
-
import { Fragment as
|
|
1027
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
773
1028
|
var CHANNEL_BRAND_COLOR = {
|
|
774
1029
|
[CONVERSATION_CHANNEL.WHATSAPP]: "#25D366",
|
|
775
1030
|
[CONVERSATION_CHANNEL.MESSENGER]: "#0084FF",
|
|
@@ -779,9 +1034,9 @@ var CHANNEL_BRAND_COLOR = {
|
|
|
779
1034
|
function Glyph({ channel }) {
|
|
780
1035
|
const color = CHANNEL_BRAND_COLOR[channel];
|
|
781
1036
|
if (channel === CONVERSATION_CHANNEL.WHATSAPP) {
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */
|
|
1037
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1038
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1039
|
+
/* @__PURE__ */ jsx10(
|
|
785
1040
|
"path",
|
|
786
1041
|
{
|
|
787
1042
|
d: "M8.6 7.2c.3-.1.7 0 .9.3l1 1.6c.2.3.1.7-.1.9l-.7.7c.6 1.3 1.6 2.3 2.9 2.9l.7-.7c.2-.2.6-.3.9-.1l1.6 1c.3.2.4.6.3.9-.4 1-1.4 1.6-2.4 1.4-3-.5-5.4-2.9-5.9-5.9-.2-1 .4-2 1.4-2.4Z",
|
|
@@ -791,28 +1046,28 @@ function Glyph({ channel }) {
|
|
|
791
1046
|
] });
|
|
792
1047
|
}
|
|
793
1048
|
if (channel === CONVERSATION_CHANNEL.MESSENGER) {
|
|
794
|
-
return /* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1050
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1051
|
+
/* @__PURE__ */ jsx10("path", { d: "M6.5 15.5 11 10.8l2.4 2.4L17.5 9l-4.6 4.9-2.4-2.4-4 4Z", fill: "#fff", stroke: "#fff", strokeWidth: "1.4", strokeLinejoin: "round" })
|
|
797
1052
|
] });
|
|
798
1053
|
}
|
|
799
1054
|
if (channel === CONVERSATION_CHANNEL.INSTAGRAM) {
|
|
800
|
-
return /* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
1055
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1056
|
+
/* @__PURE__ */ jsx10("rect", { x: "2", y: "2", width: "20", height: "20", rx: "6", fill: color }),
|
|
1057
|
+
/* @__PURE__ */ jsx10("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "3.5", fill: "none", stroke: "#fff", strokeWidth: "1.6" }),
|
|
1058
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "2.6", fill: "none", stroke: "#fff", strokeWidth: "1.6" }),
|
|
1059
|
+
/* @__PURE__ */ jsx10("circle", { cx: "16.4", cy: "7.6", r: "1", fill: "#fff" })
|
|
805
1060
|
] });
|
|
806
1061
|
}
|
|
807
|
-
return /* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1063
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "11", fill: color }),
|
|
1064
|
+
/* @__PURE__ */ jsx10("path", { d: "M6.5 8.5h11v7h-5.5L8.5 18v-2.5h-2v-7Z", fill: "#fff" })
|
|
810
1065
|
] });
|
|
811
1066
|
}
|
|
812
1067
|
function ChannelIcon({ channel, size = 14, className = "" }) {
|
|
813
1068
|
const resolved = channel ?? CONVERSATION_CHANNEL.WHATSAPP;
|
|
814
1069
|
const { label } = capabilitiesOf(resolved);
|
|
815
|
-
return /* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ jsx10(
|
|
816
1071
|
"svg",
|
|
817
1072
|
{
|
|
818
1073
|
viewBox: "0 0 24 24",
|
|
@@ -821,13 +1076,13 @@ function ChannelIcon({ channel, size = 14, className = "" }) {
|
|
|
821
1076
|
className: `inline-block shrink-0 ${className}`.trim(),
|
|
822
1077
|
role: "img",
|
|
823
1078
|
"aria-label": label,
|
|
824
|
-
children: /* @__PURE__ */
|
|
1079
|
+
children: /* @__PURE__ */ jsx10(Glyph, { channel: resolved })
|
|
825
1080
|
}
|
|
826
1081
|
);
|
|
827
1082
|
}
|
|
828
1083
|
|
|
829
1084
|
// src/ConversationRow.tsx
|
|
830
|
-
import { jsx as
|
|
1085
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
831
1086
|
var WINDOW_TITLE = {
|
|
832
1087
|
[CONVERSATION_WINDOW.ALL]: "",
|
|
833
1088
|
[CONVERSATION_WINDOW.FRESH]: "Janela de 24h aberta (menos de 12h)",
|
|
@@ -860,8 +1115,8 @@ function ConversationRow({
|
|
|
860
1115
|
const stalledMs = now - new Date(conversation.lastAt).getTime();
|
|
861
1116
|
const isStalled = stalledMs > STALLED_THRESHOLD_MS;
|
|
862
1117
|
const isWaiting = conversation.mode === "bot" && conversation.waitingHuman;
|
|
863
|
-
return /* @__PURE__ */
|
|
864
|
-
/* @__PURE__ */
|
|
1118
|
+
return /* @__PURE__ */ jsxs9("div", { className: cn("cv-row flex border-b", active && "cv-row--active", classNames?.root, className), children: [
|
|
1119
|
+
/* @__PURE__ */ jsx11(
|
|
865
1120
|
"span",
|
|
866
1121
|
{
|
|
867
1122
|
className: cn("w-1 shrink-0", WINDOW_BAR_CLASS[window2], classNames?.windowBar),
|
|
@@ -869,9 +1124,9 @@ function ConversationRow({
|
|
|
869
1124
|
"aria-label": WINDOW_TITLE[window2]
|
|
870
1125
|
}
|
|
871
1126
|
),
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
|
|
1128
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-2 px-2 pt-2", children: [
|
|
1129
|
+
/* @__PURE__ */ jsx11(
|
|
875
1130
|
"input",
|
|
876
1131
|
{
|
|
877
1132
|
type: "checkbox",
|
|
@@ -881,7 +1136,7 @@ function ConversationRow({
|
|
|
881
1136
|
className: "mt-3"
|
|
882
1137
|
}
|
|
883
1138
|
),
|
|
884
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ jsx11("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx11(
|
|
885
1140
|
ConversationListItem,
|
|
886
1141
|
{
|
|
887
1142
|
conversation,
|
|
@@ -892,28 +1147,28 @@ function ConversationRow({
|
|
|
892
1147
|
}
|
|
893
1148
|
) })
|
|
894
1149
|
] }),
|
|
895
|
-
/* @__PURE__ */
|
|
896
|
-
/* @__PURE__ */
|
|
897
|
-
/* @__PURE__ */
|
|
1150
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-1.5 px-4 pb-2 pl-8", children: [
|
|
1151
|
+
/* @__PURE__ */ jsxs9("span", { className: "cv-pill", children: [
|
|
1152
|
+
/* @__PURE__ */ jsx11(ChannelIcon, { channel: conversation.channel }),
|
|
898
1153
|
" ",
|
|
899
1154
|
capabilities.label
|
|
900
1155
|
] }),
|
|
901
|
-
conversation.mode === "human" ? /* @__PURE__ */
|
|
902
|
-
isWaiting ? /* @__PURE__ */
|
|
903
|
-
!isWaiting && conversation.mode === "bot" ? /* @__PURE__ */
|
|
904
|
-
isStalled ? /* @__PURE__ */
|
|
1156
|
+
conversation.mode === "human" ? /* @__PURE__ */ jsx11("span", { className: "cv-pill cv-pill--success", children: "\u{1F9D1}\u200D\u{1F4BC} em atendimento" }) : null,
|
|
1157
|
+
isWaiting ? /* @__PURE__ */ jsx11("span", { className: "cv-pill cv-pill--warning", children: "\u23F3 aguardando atendimento" }) : null,
|
|
1158
|
+
!isWaiting && conversation.mode === "bot" ? /* @__PURE__ */ jsx11("span", { className: "cv-pill", children: "\u{1F916} bot ativo" }) : null,
|
|
1159
|
+
isStalled ? /* @__PURE__ */ jsxs9("span", { className: "cv-pill cv-pill--danger", children: [
|
|
905
1160
|
"\u23F1\uFE0F parada h\xE1 ",
|
|
906
1161
|
formatStalledFor(conversation.lastAt, now)
|
|
907
1162
|
] }) : null,
|
|
908
|
-
isWaiting ? /* @__PURE__ */
|
|
1163
|
+
isWaiting ? /* @__PURE__ */ jsx11("button", { type: "button", onClick: onTakeover, disabled: busy, className: "cv-header-action", children: "\u25B6\uFE0F Continuar Atendimento" }) : null
|
|
909
1164
|
] })
|
|
910
1165
|
] })
|
|
911
1166
|
] });
|
|
912
1167
|
}
|
|
913
1168
|
|
|
914
1169
|
// src/ConversationHeader.tsx
|
|
915
|
-
import { useState as
|
|
916
|
-
import { jsx as
|
|
1170
|
+
import { useState as useState5 } from "react";
|
|
1171
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
917
1172
|
var DEFAULT_CONVERSATION_HEADER_LABELS = {
|
|
918
1173
|
botMode: "\u{1F916} atendimento autom\xE1tico",
|
|
919
1174
|
humanMode: "\u{1F9D1}\u200D\u{1F4BC} atendimento humano",
|
|
@@ -946,7 +1201,7 @@ function ConversationHeader({
|
|
|
946
1201
|
const displayHandle = formatContactHandle({ handle, channel: conversation.channel });
|
|
947
1202
|
const flag = contactFlag({ handle, channel: conversation.channel });
|
|
948
1203
|
const capabilities = capabilitiesOf(conversation.channel);
|
|
949
|
-
const [menuOpen, setMenuOpen] =
|
|
1204
|
+
const [menuOpen, setMenuOpen] = useState5(false);
|
|
950
1205
|
const utilities = [
|
|
951
1206
|
onOpenDocuments ? { key: "documents", icon: "\u{1F4C4}", label: labels.documents, run: onOpenDocuments, active: documentsOpen } : void 0,
|
|
952
1207
|
onDownload ? { key: "download", icon: "\u2B07\uFE0F", label: labels.download, run: onDownload, active: false } : void 0,
|
|
@@ -968,7 +1223,7 @@ function ConversationHeader({
|
|
|
968
1223
|
})),
|
|
969
1224
|
...actions
|
|
970
1225
|
];
|
|
971
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ jsxs10(
|
|
972
1227
|
"header",
|
|
973
1228
|
{
|
|
974
1229
|
className: cn(
|
|
@@ -977,26 +1232,26 @@ function ConversationHeader({
|
|
|
977
1232
|
className
|
|
978
1233
|
),
|
|
979
1234
|
children: [
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
onBack ? /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex min-w-0 flex-1 items-center gap-3", classNames?.identity), children: [
|
|
1236
|
+
onBack ? /* @__PURE__ */ jsx12("button", { type: "button", onClick: onBack, className: "cv-back cv-touch", "aria-label": labels.back, title: labels.back, children: "\u2190" }) : null,
|
|
1237
|
+
/* @__PURE__ */ jsx12(Avatar, { name: conversation.clientName, size: "md" }),
|
|
1238
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0", children: [
|
|
1239
|
+
/* @__PURE__ */ jsx12("p", { className: cn("truncate font-medium", classNames?.name), children: conversation.clientName ?? displayHandle }),
|
|
1240
|
+
/* @__PURE__ */ jsxs10("p", { className: cn("truncate text-xs text-gray-500", classNames?.meta), children: [
|
|
986
1241
|
flag ? `${flag} ` : "",
|
|
987
1242
|
displayHandle,
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ jsxs10("span", { className: "ml-2 inline-flex items-center gap-1", children: [
|
|
1244
|
+
/* @__PURE__ */ jsx12(ChannelIcon, { channel: conversation.channel }),
|
|
1245
|
+
/* @__PURE__ */ jsx12("span", { className: "cv-only-wide", children: capabilities.label })
|
|
991
1246
|
] }),
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
1247
|
+
/* @__PURE__ */ jsx12("span", { className: "ml-2 cv-only-wide", children: isHuman ? labels.humanMode : labels.botMode }),
|
|
1248
|
+
/* @__PURE__ */ jsx12("span", { className: "ml-1 cv-only-narrow", title: isHuman ? labels.humanMode : labels.botMode, children: isHuman ? "\u{1F9D1}\u200D\u{1F4BC}" : "\u{1F916}" })
|
|
994
1249
|
] })
|
|
995
1250
|
] })
|
|
996
1251
|
] }),
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
utilities.map((utility) => /* @__PURE__ */
|
|
1252
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("flex shrink-0 items-center gap-2", classNames?.actions), children: [
|
|
1253
|
+
/* @__PURE__ */ jsxs10("div", { className: cn("hidden items-center gap-2 lg:flex", classNames?.desktopActions), children: [
|
|
1254
|
+
utilities.map((utility) => /* @__PURE__ */ jsx12(
|
|
1000
1255
|
"button",
|
|
1001
1256
|
{
|
|
1002
1257
|
type: "button",
|
|
@@ -1010,7 +1265,7 @@ function ConversationHeader({
|
|
|
1010
1265
|
},
|
|
1011
1266
|
utility.key
|
|
1012
1267
|
)),
|
|
1013
|
-
actions.map((action) => /* @__PURE__ */
|
|
1268
|
+
actions.map((action) => /* @__PURE__ */ jsx12(
|
|
1014
1269
|
"button",
|
|
1015
1270
|
{
|
|
1016
1271
|
type: "button",
|
|
@@ -1022,8 +1277,8 @@ function ConversationHeader({
|
|
|
1022
1277
|
action.key
|
|
1023
1278
|
))
|
|
1024
1279
|
] }),
|
|
1025
|
-
menuItems.length > 0 ? /* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
1280
|
+
menuItems.length > 0 ? /* @__PURE__ */ jsxs10("div", { className: cn("cv-menu lg:hidden", classNames?.mobileMenu), children: [
|
|
1281
|
+
/* @__PURE__ */ jsx12(
|
|
1027
1282
|
"button",
|
|
1028
1283
|
{
|
|
1029
1284
|
type: "button",
|
|
@@ -1035,7 +1290,7 @@ function ConversationHeader({
|
|
|
1035
1290
|
children: "\u22EE"
|
|
1036
1291
|
}
|
|
1037
1292
|
),
|
|
1038
|
-
menuOpen ? /* @__PURE__ */
|
|
1293
|
+
menuOpen ? /* @__PURE__ */ jsx12("div", { className: "cv-menu-panel", role: "menu", children: menuItems.map((item) => /* @__PURE__ */ jsx12(
|
|
1039
1294
|
"button",
|
|
1040
1295
|
{
|
|
1041
1296
|
type: "button",
|
|
@@ -1058,16 +1313,16 @@ function ConversationHeader({
|
|
|
1058
1313
|
}
|
|
1059
1314
|
|
|
1060
1315
|
// src/ConversationContextPanel.tsx
|
|
1061
|
-
import { useState as
|
|
1316
|
+
import { useState as useState7 } from "react";
|
|
1062
1317
|
|
|
1063
1318
|
// src/useIsNarrow.ts
|
|
1064
|
-
import { useEffect as
|
|
1319
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1065
1320
|
var NARROW_MAX_WIDTH_PX = 1023;
|
|
1066
1321
|
function useIsNarrow() {
|
|
1067
|
-
const [isNarrow, setIsNarrow] =
|
|
1322
|
+
const [isNarrow, setIsNarrow] = useState6(
|
|
1068
1323
|
() => typeof window !== "undefined" && window.matchMedia(`(max-width: ${NARROW_MAX_WIDTH_PX}px)`).matches
|
|
1069
1324
|
);
|
|
1070
|
-
|
|
1325
|
+
useEffect4(() => {
|
|
1071
1326
|
const query = window.matchMedia(`(max-width: ${NARROW_MAX_WIDTH_PX}px)`);
|
|
1072
1327
|
const handleChange = (event) => setIsNarrow(event.matches);
|
|
1073
1328
|
query.addEventListener("change", handleChange);
|
|
@@ -1078,7 +1333,7 @@ function useIsNarrow() {
|
|
|
1078
1333
|
}
|
|
1079
1334
|
|
|
1080
1335
|
// src/ConversationContextPanel.tsx
|
|
1081
|
-
import { jsx as
|
|
1336
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1082
1337
|
var DEFAULT_CONVERSATION_CONTEXT_LABELS = {
|
|
1083
1338
|
title: "\u{1F4CB} Suas Sele\xE7\xF5es",
|
|
1084
1339
|
empty: "Nada coletado ainda nesta conversa."
|
|
@@ -1092,10 +1347,10 @@ function ConversationContextPanel({
|
|
|
1092
1347
|
const labels = { ...DEFAULT_CONVERSATION_CONTEXT_LABELS, ...labelsOverride };
|
|
1093
1348
|
const filled = entries.filter((entry) => Boolean(entry.value));
|
|
1094
1349
|
const isNarrow = useIsNarrow();
|
|
1095
|
-
const [manualOpen, setManualOpen] =
|
|
1350
|
+
const [manualOpen, setManualOpen] = useState7(void 0);
|
|
1096
1351
|
const open = manualOpen ?? (!isNarrow && filled.length > 0);
|
|
1097
|
-
return /* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ jsxs11("section", { className: cn("border-b", classNames?.root, className), children: [
|
|
1353
|
+
/* @__PURE__ */ jsxs11(
|
|
1099
1354
|
"button",
|
|
1100
1355
|
{
|
|
1101
1356
|
type: "button",
|
|
@@ -1103,9 +1358,9 @@ function ConversationContextPanel({
|
|
|
1103
1358
|
"aria-expanded": open,
|
|
1104
1359
|
className: cn("flex w-full items-center gap-2 px-4 py-3 text-left text-sm font-medium", classNames?.toggle),
|
|
1105
1360
|
children: [
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1361
|
+
/* @__PURE__ */ jsx13("span", { "aria-hidden": true, className: "text-xs", children: open ? "\u25BE" : "\u25B8" }),
|
|
1362
|
+
/* @__PURE__ */ jsx13("span", { children: labels.title }),
|
|
1363
|
+
/* @__PURE__ */ jsxs11("span", { className: cn("rounded-full bg-gray-200 px-2 text-xs dark:bg-gray-700", classNames?.counter), children: [
|
|
1109
1364
|
filled.length,
|
|
1110
1365
|
"/",
|
|
1111
1366
|
entries.length
|
|
@@ -1113,12 +1368,12 @@ function ConversationContextPanel({
|
|
|
1113
1368
|
]
|
|
1114
1369
|
}
|
|
1115
1370
|
),
|
|
1116
|
-
open ? /* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
1371
|
+
open ? /* @__PURE__ */ jsx13("div", { className: cn("px-4 pb-3", classNames?.body), children: entries.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "text-xs text-gray-500", children: labels.empty }) : /* @__PURE__ */ jsx13("dl", { className: "grid grid-cols-2 gap-2 text-xs", children: entries.map((entry) => /* @__PURE__ */ jsxs11("div", { className: "min-w-0", children: [
|
|
1372
|
+
/* @__PURE__ */ jsxs11("dt", { className: "truncate text-gray-500", children: [
|
|
1118
1373
|
entry.icon ? `${entry.icon} ` : "",
|
|
1119
1374
|
entry.label
|
|
1120
1375
|
] }),
|
|
1121
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ jsx13("dd", { className: "truncate font-medium", children: entry.value ? /* @__PURE__ */ jsxs11("span", { className: "text-green-700 dark:text-green-400", children: [
|
|
1122
1377
|
"\u2713 ",
|
|
1123
1378
|
entry.value
|
|
1124
1379
|
] }) : "\u2014" })
|
|
@@ -1127,7 +1382,7 @@ function ConversationContextPanel({
|
|
|
1127
1382
|
}
|
|
1128
1383
|
|
|
1129
1384
|
// src/WindowExpiredNotice.tsx
|
|
1130
|
-
import { jsx as
|
|
1385
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1131
1386
|
var DEFAULT_WINDOW_EXPIRED_LABELS = {
|
|
1132
1387
|
title: "\u23F0 Janela de 24h expirada \u2014 o WhatsApp n\xE3o aceita mensagens livres.",
|
|
1133
1388
|
description: "Envie uma mensagem de template para reabrir a conversa com o cliente.",
|
|
@@ -1140,10 +1395,10 @@ function WindowExpiredNotice({
|
|
|
1140
1395
|
className
|
|
1141
1396
|
}) {
|
|
1142
1397
|
const labels = { ...DEFAULT_WINDOW_EXPIRED_LABELS, ...labelsOverride };
|
|
1143
|
-
return /* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
onSendTemplate ? /* @__PURE__ */
|
|
1398
|
+
return /* @__PURE__ */ jsxs12("div", { role: "status", className: cn("border-t bg-yellow-50 px-4 py-3 text-sm dark:bg-yellow-950", className), children: [
|
|
1399
|
+
/* @__PURE__ */ jsx14("p", { className: "font-medium text-yellow-900 dark:text-yellow-200", children: labels.title }),
|
|
1400
|
+
/* @__PURE__ */ jsx14("p", { className: "text-yellow-800 dark:text-yellow-300", children: labels.description }),
|
|
1401
|
+
onSendTemplate ? /* @__PURE__ */ jsx14("button", { type: "button", onClick: onSendTemplate, disabled, className: "cv-header-action mt-2", children: labels.sendTemplate }) : null
|
|
1147
1402
|
] });
|
|
1148
1403
|
}
|
|
1149
1404
|
function isWindowBlocking(window2) {
|
|
@@ -1186,7 +1441,7 @@ function downloadTextFile(filename, content) {
|
|
|
1186
1441
|
}
|
|
1187
1442
|
|
|
1188
1443
|
// src/useWaitingNotifications.ts
|
|
1189
|
-
import { useState as
|
|
1444
|
+
import { useState as useState8, useEffect as useEffect5, useRef as useRef4, useCallback as useCallback4 } from "react";
|
|
1190
1445
|
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
1191
1446
|
var DEFAULT_LIMIT = 50;
|
|
1192
1447
|
var DEFAULT_LABELS = {
|
|
@@ -1195,17 +1450,17 @@ var DEFAULT_LABELS = {
|
|
|
1195
1450
|
};
|
|
1196
1451
|
function useWaitingNotifications(params) {
|
|
1197
1452
|
const conversationsContext = useConversations();
|
|
1198
|
-
const [conversations, setConversations] =
|
|
1199
|
-
const previousUnreadMap =
|
|
1200
|
-
const notifiedIds =
|
|
1201
|
-
const isPollingRef =
|
|
1453
|
+
const [conversations, setConversations] = useState8([]);
|
|
1454
|
+
const previousUnreadMap = useRef4(/* @__PURE__ */ new Map());
|
|
1455
|
+
const notifiedIds = useRef4(/* @__PURE__ */ new Set());
|
|
1456
|
+
const isPollingRef = useRef4(false);
|
|
1202
1457
|
const isEnabled = params?.enabled ?? true;
|
|
1203
1458
|
const intervalMs = params?.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
1204
1459
|
const icon = params?.icon;
|
|
1205
1460
|
const listParams = params?.params;
|
|
1206
1461
|
const labelTitle = params?.labels?.title ?? DEFAULT_LABELS.title;
|
|
1207
1462
|
const labelBody = params?.labels?.body ?? DEFAULT_LABELS.body;
|
|
1208
|
-
const refresh =
|
|
1463
|
+
const refresh = useCallback4(async () => {
|
|
1209
1464
|
if (!conversationsContext || isPollingRef.current) return;
|
|
1210
1465
|
isPollingRef.current = true;
|
|
1211
1466
|
try {
|
|
@@ -1230,7 +1485,7 @@ function useWaitingNotifications(params) {
|
|
|
1230
1485
|
isPollingRef.current = false;
|
|
1231
1486
|
}
|
|
1232
1487
|
}, [conversationsContext, listParams, icon, labelTitle, labelBody]);
|
|
1233
|
-
|
|
1488
|
+
useEffect5(() => {
|
|
1234
1489
|
if (!isEnabled) return;
|
|
1235
1490
|
if (typeof window !== "undefined" && "Notification" in window && Notification.permission === "default") {
|
|
1236
1491
|
Notification.requestPermission();
|
|
@@ -1245,7 +1500,7 @@ function useWaitingNotifications(params) {
|
|
|
1245
1500
|
|
|
1246
1501
|
// src/settings/WhatsAppTemplateSettingsForm.tsx
|
|
1247
1502
|
import { Plus, RefreshCw, Save, Trash2 } from "lucide-react";
|
|
1248
|
-
import { jsx as
|
|
1503
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1249
1504
|
var DEFAULT_LABELS2 = {
|
|
1250
1505
|
sectionTitle: "WhatsApp",
|
|
1251
1506
|
sectionDescription: "Template usado para reabrir a janela de 24h com o cliente.",
|
|
@@ -1304,16 +1559,16 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1304
1559
|
}
|
|
1305
1560
|
onVariablesChange([...variables, token]);
|
|
1306
1561
|
}
|
|
1307
|
-
return /* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ jsxs13("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
1563
|
+
/* @__PURE__ */ jsxs13("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
1564
|
+
/* @__PURE__ */ jsx15("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }),
|
|
1565
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
1311
1566
|
] }),
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ jsxs13("form", { onSubmit: onSave, className: "p-6 space-y-4", children: [
|
|
1568
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1569
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
1570
|
+
/* @__PURE__ */ jsx15("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.templateLabel }),
|
|
1571
|
+
/* @__PURE__ */ jsxs13(
|
|
1317
1572
|
"button",
|
|
1318
1573
|
{
|
|
1319
1574
|
type: "button",
|
|
@@ -1321,31 +1576,31 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1321
1576
|
disabled: loadingTemplates,
|
|
1322
1577
|
className: "flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",
|
|
1323
1578
|
children: [
|
|
1324
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ jsx15(RefreshCw, { size: 11, className: loadingTemplates ? "animate-spin" : "" }),
|
|
1325
1580
|
labels.refreshList
|
|
1326
1581
|
]
|
|
1327
1582
|
}
|
|
1328
1583
|
)
|
|
1329
1584
|
] }),
|
|
1330
|
-
templatesError && /* @__PURE__ */
|
|
1585
|
+
templatesError && /* @__PURE__ */ jsxs13("div", { className: "mb-2 rounded-lg bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 px-3 py-2 text-xs text-amber-700 dark:text-amber-400", children: [
|
|
1331
1586
|
labels.errorLoading,
|
|
1332
|
-
/* @__PURE__ */
|
|
1333
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsx15("br", {}),
|
|
1588
|
+
/* @__PURE__ */ jsxs13("span", { className: "text-gray-500 dark:text-gray-400 mt-0.5 block", children: [
|
|
1334
1589
|
labels.currentNameSaved,
|
|
1335
1590
|
" ",
|
|
1336
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ jsx15("strong", { children: selectedTemplateName || "\u2014" })
|
|
1337
1592
|
] })
|
|
1338
1593
|
] }),
|
|
1339
|
-
loadingTemplates && /* @__PURE__ */
|
|
1340
|
-
!loadingTemplates && !templatesError && /* @__PURE__ */
|
|
1594
|
+
loadingTemplates && /* @__PURE__ */ jsx15("div", { className: "h-10 rounded-xl bg-gray-100 dark:bg-gray-700 animate-pulse" }),
|
|
1595
|
+
!loadingTemplates && !templatesError && /* @__PURE__ */ jsxs13(
|
|
1341
1596
|
"select",
|
|
1342
1597
|
{
|
|
1343
1598
|
value: selectedTemplateName,
|
|
1344
1599
|
onChange: (e) => handleSelect(e.target.value),
|
|
1345
1600
|
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all",
|
|
1346
1601
|
children: [
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
templates.map((template) => /* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: labels.selectPlaceholder }),
|
|
1603
|
+
templates.map((template) => /* @__PURE__ */ jsxs13("option", { value: template.name, disabled: template.status !== "APPROVED", children: [
|
|
1349
1604
|
template.displayName,
|
|
1350
1605
|
" \xB7 ",
|
|
1351
1606
|
template.shortId,
|
|
@@ -1357,27 +1612,27 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1357
1612
|
]
|
|
1358
1613
|
}
|
|
1359
1614
|
),
|
|
1360
|
-
selected?.bodyText && /* @__PURE__ */
|
|
1615
|
+
selected?.bodyText && /* @__PURE__ */ jsx15("div", { className: "mt-2 rounded-lg bg-gray-50 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-600 px-3 py-2 text-xs text-gray-600 dark:text-gray-300 whitespace-pre-wrap", children: selected.bodyText })
|
|
1361
1616
|
] }),
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1618
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
1619
|
+
/* @__PURE__ */ jsx15("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.variablesLabel }),
|
|
1620
|
+
/* @__PURE__ */ jsxs13(
|
|
1366
1621
|
"button",
|
|
1367
1622
|
{
|
|
1368
1623
|
type: "button",
|
|
1369
1624
|
onClick: () => onVariablesChange([...variables, ""]),
|
|
1370
1625
|
className: "flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline",
|
|
1371
1626
|
children: [
|
|
1372
|
-
/* @__PURE__ */
|
|
1627
|
+
/* @__PURE__ */ jsx15(Plus, { size: 12 }),
|
|
1373
1628
|
labels.addVariable
|
|
1374
1629
|
]
|
|
1375
1630
|
}
|
|
1376
1631
|
)
|
|
1377
1632
|
] }),
|
|
1378
|
-
availableVariables.length > 0 && /* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1633
|
+
availableVariables.length > 0 && /* @__PURE__ */ jsxs13("div", { className: "mb-3 rounded-lg border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/40 p-2.5", children: [
|
|
1634
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-gray-600 dark:text-gray-300 mb-1.5", children: labels.variablesAvailableTitle }),
|
|
1635
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1.5", children: availableVariables.map((available) => /* @__PURE__ */ jsxs13(
|
|
1381
1636
|
"button",
|
|
1382
1637
|
{
|
|
1383
1638
|
type: "button",
|
|
@@ -1385,8 +1640,8 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1385
1640
|
title: `Inserir ${available.token}`,
|
|
1386
1641
|
className: "inline-flex items-center gap-1 rounded-md border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 px-2 py-1 text-xs hover:border-blue-400 dark:hover:border-blue-500 transition-colors",
|
|
1387
1642
|
children: [
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ jsx15("code", { className: "text-blue-600 dark:text-blue-300", children: available.token }),
|
|
1644
|
+
/* @__PURE__ */ jsxs13("span", { className: "text-gray-400 dark:text-gray-500", children: [
|
|
1390
1645
|
"\xB7 ",
|
|
1391
1646
|
available.label
|
|
1392
1647
|
] })
|
|
@@ -1394,13 +1649,13 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1394
1649
|
},
|
|
1395
1650
|
available.token
|
|
1396
1651
|
)) }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1652
|
+
/* @__PURE__ */ jsx15("p", { className: "mt-1.5 text-[11px] text-gray-400 dark:text-gray-500", children: labels.variablesAvailableHint })
|
|
1398
1653
|
] }),
|
|
1399
|
-
/* @__PURE__ */
|
|
1400
|
-
variables.length === 0 && /* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
/* @__PURE__ */
|
|
1403
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs text-gray-400 dark:text-gray-500 mb-2", children: labels.variablesMappingHint }),
|
|
1655
|
+
variables.length === 0 && /* @__PURE__ */ jsx15("p", { className: "text-xs text-gray-400 dark:text-gray-500 italic", children: labels.noVariables }),
|
|
1656
|
+
/* @__PURE__ */ jsx15("div", { className: "space-y-2", children: variables.map((variable, index) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
1657
|
+
/* @__PURE__ */ jsx15("span", { className: "text-xs text-gray-400 dark:text-gray-500 w-6 text-right flex-shrink-0", children: `{{${index + 1}}}` }),
|
|
1658
|
+
/* @__PURE__ */ jsx15(
|
|
1404
1659
|
"input",
|
|
1405
1660
|
{
|
|
1406
1661
|
type: "text",
|
|
@@ -1410,27 +1665,27 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1410
1665
|
className: "flex-1 border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all placeholder:text-gray-400 dark:placeholder:text-gray-500"
|
|
1411
1666
|
}
|
|
1412
1667
|
),
|
|
1413
|
-
/* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ jsx15(
|
|
1414
1669
|
"button",
|
|
1415
1670
|
{
|
|
1416
1671
|
type: "button",
|
|
1417
1672
|
onClick: () => removeVariable(index),
|
|
1418
1673
|
className: "text-gray-400 hover:text-red-500 dark:hover:text-red-400 transition-colors flex-shrink-0",
|
|
1419
1674
|
title: labels.removeVariable,
|
|
1420
|
-
children: /* @__PURE__ */
|
|
1675
|
+
children: /* @__PURE__ */ jsx15(Trash2, { size: 14 })
|
|
1421
1676
|
}
|
|
1422
1677
|
)
|
|
1423
1678
|
] }, index)) })
|
|
1424
1679
|
] }),
|
|
1425
|
-
saveSuccess && /* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1680
|
+
saveSuccess && /* @__PURE__ */ jsx15("div", { className: "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 rounded-xl px-4 py-3 text-sm text-green-700 dark:text-green-400", children: labels.saveSuccess }),
|
|
1681
|
+
/* @__PURE__ */ jsx15("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs13(
|
|
1427
1682
|
"button",
|
|
1428
1683
|
{
|
|
1429
1684
|
type: "submit",
|
|
1430
1685
|
disabled: saving || !selectedTemplateName.trim(),
|
|
1431
1686
|
className: "flex items-center gap-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
1432
1687
|
children: [
|
|
1433
|
-
saving ? /* @__PURE__ */
|
|
1688
|
+
saving ? /* @__PURE__ */ jsx15("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx15(Save, { size: 14 }),
|
|
1434
1689
|
saving ? labels.saving : labels.save
|
|
1435
1690
|
]
|
|
1436
1691
|
}
|
|
@@ -1440,8 +1695,8 @@ function WhatsAppTemplateSettingsForm({
|
|
|
1440
1695
|
}
|
|
1441
1696
|
|
|
1442
1697
|
// src/settings/WhatsAppCreateTemplateForm.tsx
|
|
1443
|
-
import { SendHorizonal } from "lucide-react";
|
|
1444
|
-
import { jsx as
|
|
1698
|
+
import { SendHorizonal as SendHorizonal2 } from "lucide-react";
|
|
1699
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1445
1700
|
var DEFAULT_LABELS3 = {
|
|
1446
1701
|
sectionTitle: "Criar novo template",
|
|
1447
1702
|
sectionDescription: "Envia um template para aprova\xE7\xE3o da Meta.",
|
|
@@ -1498,16 +1753,16 @@ function WhatsAppCreateTemplateForm({
|
|
|
1498
1753
|
function set(key, next) {
|
|
1499
1754
|
onChange({ ...value, [key]: next });
|
|
1500
1755
|
}
|
|
1501
|
-
return /* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */
|
|
1756
|
+
return /* @__PURE__ */ jsxs14("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
1757
|
+
/* @__PURE__ */ jsxs14("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
1758
|
+
/* @__PURE__ */ jsx16("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }),
|
|
1759
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
1505
1760
|
] }),
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ jsxs14("form", { onSubmit, className: "p-6 space-y-4", children: [
|
|
1762
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1763
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.nameLabel }),
|
|
1764
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.nameHint }),
|
|
1765
|
+
/* @__PURE__ */ jsx16(
|
|
1511
1766
|
"input",
|
|
1512
1767
|
{
|
|
1513
1768
|
type: "text",
|
|
@@ -1519,56 +1774,56 @@ function WhatsAppCreateTemplateForm({
|
|
|
1519
1774
|
}
|
|
1520
1775
|
)
|
|
1521
1776
|
] }),
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
1778
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1779
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.categoryLabel }),
|
|
1780
|
+
/* @__PURE__ */ jsxs14(
|
|
1526
1781
|
"select",
|
|
1527
1782
|
{
|
|
1528
1783
|
value: value.category,
|
|
1529
1784
|
onChange: (e) => set("category", e.target.value),
|
|
1530
1785
|
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all",
|
|
1531
1786
|
children: [
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsx16("option", { value: "UTILITY", children: "UTILITY (Transacional)" }),
|
|
1788
|
+
/* @__PURE__ */ jsx16("option", { value: "MARKETING", children: "MARKETING (Promocional)" })
|
|
1534
1789
|
]
|
|
1535
1790
|
}
|
|
1536
1791
|
)
|
|
1537
1792
|
] }),
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1793
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1794
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.languageLabel }),
|
|
1795
|
+
/* @__PURE__ */ jsxs14(
|
|
1541
1796
|
"select",
|
|
1542
1797
|
{
|
|
1543
1798
|
value: value.language,
|
|
1544
1799
|
onChange: (e) => set("language", e.target.value),
|
|
1545
1800
|
className: "w-full border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent transition-all",
|
|
1546
1801
|
children: [
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1802
|
+
/* @__PURE__ */ jsx16("option", { value: "pt_BR", children: "Portugu\xEAs (Brasil)" }),
|
|
1803
|
+
/* @__PURE__ */ jsx16("option", { value: "en_US", children: "Ingl\xEAs (EUA)" }),
|
|
1804
|
+
/* @__PURE__ */ jsx16("option", { value: "es_ES", children: "Espanhol" })
|
|
1550
1805
|
]
|
|
1551
1806
|
}
|
|
1552
1807
|
)
|
|
1553
1808
|
] })
|
|
1554
1809
|
] }),
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
/* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1811
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.headerLabel }),
|
|
1812
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.headerHint }),
|
|
1813
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-2", children: [
|
|
1814
|
+
/* @__PURE__ */ jsxs14(
|
|
1560
1815
|
"select",
|
|
1561
1816
|
{
|
|
1562
1817
|
value: value.headerType,
|
|
1563
1818
|
onChange: (e) => set("headerType", e.target.value),
|
|
1564
1819
|
className: "border border-gray-200 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 transition-all",
|
|
1565
1820
|
children: [
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx16("option", { value: "NONE", children: labels.headerNone }),
|
|
1822
|
+
/* @__PURE__ */ jsx16("option", { value: "TEXT", children: labels.headerText })
|
|
1568
1823
|
]
|
|
1569
1824
|
}
|
|
1570
1825
|
),
|
|
1571
|
-
value.headerType === "TEXT" && /* @__PURE__ */
|
|
1826
|
+
value.headerType === "TEXT" && /* @__PURE__ */ jsx16(
|
|
1572
1827
|
"input",
|
|
1573
1828
|
{
|
|
1574
1829
|
type: "text",
|
|
@@ -1581,10 +1836,10 @@ function WhatsAppCreateTemplateForm({
|
|
|
1581
1836
|
)
|
|
1582
1837
|
] })
|
|
1583
1838
|
] }),
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
/* @__PURE__ */
|
|
1839
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1840
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.bodyLabel }),
|
|
1841
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.bodyHint }),
|
|
1842
|
+
/* @__PURE__ */ jsx16(
|
|
1588
1843
|
"textarea",
|
|
1589
1844
|
{
|
|
1590
1845
|
value: value.bodyText,
|
|
@@ -1595,26 +1850,26 @@ function WhatsAppCreateTemplateForm({
|
|
|
1595
1850
|
required: true
|
|
1596
1851
|
}
|
|
1597
1852
|
),
|
|
1598
|
-
detectedVariables.length > 0 && /* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
/* @__PURE__ */
|
|
1602
|
-
/* @__PURE__ */
|
|
1853
|
+
detectedVariables.length > 0 && /* @__PURE__ */ jsxs14("div", { className: "mt-2 rounded-lg bg-gray-50 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-600 px-3 py-2", children: [
|
|
1854
|
+
/* @__PURE__ */ jsx16("p", { className: "font-medium text-gray-500 dark:text-gray-400 mb-1.5 uppercase tracking-wide text-xs", children: labels.detectedVariables }),
|
|
1855
|
+
/* @__PURE__ */ jsx16("div", { className: "flex flex-wrap gap-2", children: detectedVariables.map((num) => /* @__PURE__ */ jsxs14("span", { className: "inline-flex items-center gap-1 text-xs", children: [
|
|
1856
|
+
/* @__PURE__ */ jsx16("code", { className: "bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 px-1.5 py-0.5 rounded font-mono", children: `{{${num}}}` }),
|
|
1857
|
+
/* @__PURE__ */ jsxs14("span", { className: "text-gray-400 dark:text-gray-500", children: [
|
|
1603
1858
|
"= ",
|
|
1604
1859
|
variableExamples[Number(num) - 1] ?? labels.variableLabel(Number(num))
|
|
1605
1860
|
] })
|
|
1606
1861
|
] }, num)) }),
|
|
1607
|
-
/* @__PURE__ */
|
|
1862
|
+
/* @__PURE__ */ jsxs14("p", { className: "text-gray-400 dark:text-gray-500 mt-1.5 text-xs", children: [
|
|
1608
1863
|
labels.configureHintPrefix,
|
|
1609
|
-
/* @__PURE__ */
|
|
1864
|
+
/* @__PURE__ */ jsx16("strong", { children: labels.configureHintLink }),
|
|
1610
1865
|
labels.configureHintSuffix
|
|
1611
1866
|
] })
|
|
1612
1867
|
] })
|
|
1613
1868
|
] }),
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1870
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: labels.footerLabel }),
|
|
1871
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs text-gray-400 mb-1.5", children: labels.footerHint }),
|
|
1872
|
+
/* @__PURE__ */ jsx16(
|
|
1618
1873
|
"input",
|
|
1619
1874
|
{
|
|
1620
1875
|
type: "text",
|
|
@@ -1626,48 +1881,48 @@ function WhatsAppCreateTemplateForm({
|
|
|
1626
1881
|
}
|
|
1627
1882
|
)
|
|
1628
1883
|
] }),
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
1884
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1885
|
+
/* @__PURE__ */ jsx16("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 block", children: labels.previewLabel }),
|
|
1886
|
+
/* @__PURE__ */ jsxs14("div", { className: "rounded-2xl bg-[#e5ddd5] dark:bg-[#1a1a2e] border border-gray-300 dark:border-gray-600 overflow-hidden shadow-inner", children: [
|
|
1887
|
+
/* @__PURE__ */ jsxs14("div", { className: "bg-[#075e54] px-4 py-2.5 flex items-center gap-2", children: [
|
|
1888
|
+
/* @__PURE__ */ jsx16("div", { className: "w-8 h-8 rounded-full bg-white/20 flex items-center justify-center text-white text-xs font-bold", children: previewCompanyName.slice(0, 2).toUpperCase() }),
|
|
1889
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
1890
|
+
/* @__PURE__ */ jsx16("p", { className: "text-white text-xs font-semibold leading-tight", children: previewCompanyName }),
|
|
1891
|
+
/* @__PURE__ */ jsx16("p", { className: "text-white/60 text-xs", children: labels.previewOnline })
|
|
1637
1892
|
] })
|
|
1638
1893
|
] }),
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
/* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1894
|
+
/* @__PURE__ */ jsxs14("div", { className: "px-3 py-4 space-y-3", style: { minHeight: "120px" }, children: [
|
|
1895
|
+
/* @__PURE__ */ jsx16("div", { className: "flex justify-start", style: { maxWidth: "85%" }, children: /* @__PURE__ */ jsxs14("div", { className: "bg-white dark:bg-gray-700 rounded-lg rounded-tl-none px-3 py-2 shadow-sm", children: [
|
|
1896
|
+
/* @__PURE__ */ jsx16("p", { className: "text-gray-500 dark:text-gray-400 leading-tight text-sm", children: labels.previewDescription }),
|
|
1897
|
+
/* @__PURE__ */ jsx16("p", { className: "text-gray-400 dark:text-gray-500 mt-1 text-right text-[9px]", children: "12:00" })
|
|
1643
1898
|
] }) }),
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
value.headerType === "TEXT" && value.headerText && /* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
value.footerText && /* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ jsx16("div", { className: "flex justify-end ml-auto", style: { maxWidth: "85%" }, children: /* @__PURE__ */ jsxs14("div", { className: "bg-[#dcf8c6] dark:bg-[#1b5e20] rounded-lg rounded-tr-none px-3 py-2 shadow-sm", children: [
|
|
1900
|
+
value.headerType === "TEXT" && value.headerText && /* @__PURE__ */ jsx16("p", { className: "text-xs font-bold text-gray-700 dark:text-gray-200 mb-1", children: fillPreviewTokens(value.headerText) || labels.previewHeaderFallback }),
|
|
1901
|
+
/* @__PURE__ */ jsx16("p", { className: "text-sm text-gray-800 dark:text-gray-100 leading-relaxed", children: value.bodyText ? fillPreviewTokens(value.bodyText) : /* @__PURE__ */ jsx16("span", { className: "text-gray-400 italic", children: labels.previewBodyPlaceholder }) }),
|
|
1902
|
+
value.footerText && /* @__PURE__ */ jsx16("p", { className: "text-gray-400 dark:text-gray-400 mt-1 text-xs", children: value.footerText }),
|
|
1903
|
+
/* @__PURE__ */ jsx16("p", { className: "text-gray-400 dark:text-gray-400 mt-1 text-right text-[9px]", children: "12:01 \u2713" })
|
|
1649
1904
|
] }) })
|
|
1650
1905
|
] })
|
|
1651
1906
|
] })
|
|
1652
1907
|
] }),
|
|
1653
|
-
result && /* @__PURE__ */
|
|
1908
|
+
result && /* @__PURE__ */ jsxs14(
|
|
1654
1909
|
"div",
|
|
1655
1910
|
{
|
|
1656
1911
|
className: `rounded-xl px-4 py-3 text-sm ${result.ok ? "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 text-green-700 dark:text-green-400" : "bg-red-50 dark:bg-red-950/40 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-400"}`,
|
|
1657
1912
|
children: [
|
|
1658
1913
|
result.message,
|
|
1659
|
-
result.ok && result.status && /* @__PURE__ */
|
|
1914
|
+
result.ok && result.status && /* @__PURE__ */ jsx16("p", { className: "text-xs mt-1 opacity-75", children: labels.successStatus(result.status) })
|
|
1660
1915
|
]
|
|
1661
1916
|
}
|
|
1662
1917
|
),
|
|
1663
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ jsx16("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs14(
|
|
1664
1919
|
"button",
|
|
1665
1920
|
{
|
|
1666
1921
|
type: "submit",
|
|
1667
1922
|
disabled: submitting || !value.name || !value.bodyText,
|
|
1668
1923
|
className: "flex items-center gap-2 bg-emerald-600 hover:bg-emerald-700 disabled:bg-emerald-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
1669
1924
|
children: [
|
|
1670
|
-
submitting ? /* @__PURE__ */
|
|
1925
|
+
submitting ? /* @__PURE__ */ jsx16("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx16(SendHorizonal2, { size: 14 }),
|
|
1671
1926
|
submitting ? labels.sending : labels.sendForApproval
|
|
1672
1927
|
]
|
|
1673
1928
|
}
|
|
@@ -1678,7 +1933,7 @@ function WhatsAppCreateTemplateForm({
|
|
|
1678
1933
|
|
|
1679
1934
|
// src/settings/WelcomeFarewellForm.tsx
|
|
1680
1935
|
import { LogOut, Mail, Save as Save2 } from "lucide-react";
|
|
1681
|
-
import { jsx as
|
|
1936
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1682
1937
|
var DEFAULT_LABELS4 = {
|
|
1683
1938
|
sectionTitle: "Boas-vindas e encerramento",
|
|
1684
1939
|
welcomeMessage: "Mensagem de boas-vindas",
|
|
@@ -1706,15 +1961,15 @@ function WelcomeFarewellForm({
|
|
|
1706
1961
|
labels: labelsOverride
|
|
1707
1962
|
}) {
|
|
1708
1963
|
const labels = { ...DEFAULT_LABELS4, ...labelsOverride };
|
|
1709
|
-
return /* @__PURE__ */
|
|
1710
|
-
/* @__PURE__ */
|
|
1711
|
-
/* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ jsxs15("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
1965
|
+
/* @__PURE__ */ jsx17("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: /* @__PURE__ */ jsx17("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.sectionTitle }) }),
|
|
1966
|
+
/* @__PURE__ */ jsxs15("form", { onSubmit: onSave, className: "p-6 space-y-5", children: [
|
|
1967
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
1968
|
+
/* @__PURE__ */ jsxs15("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 flex items-center gap-1.5", children: [
|
|
1969
|
+
/* @__PURE__ */ jsx17(Mail, { size: 13, className: "text-blue-600 dark:text-blue-400" }),
|
|
1715
1970
|
labels.welcomeMessage
|
|
1716
1971
|
] }),
|
|
1717
|
-
/* @__PURE__ */
|
|
1972
|
+
/* @__PURE__ */ jsx17(
|
|
1718
1973
|
WhatsAppMessageEditor,
|
|
1719
1974
|
{
|
|
1720
1975
|
value: welcomeMessage,
|
|
@@ -1723,14 +1978,14 @@ function WelcomeFarewellForm({
|
|
|
1723
1978
|
placeholders: welcomePlaceholders
|
|
1724
1979
|
}
|
|
1725
1980
|
),
|
|
1726
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-1.5 text-xs text-gray-500 dark:text-gray-400", children: labels.welcomeMessageHint })
|
|
1727
1982
|
] }),
|
|
1728
|
-
/* @__PURE__ */
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
1984
|
+
/* @__PURE__ */ jsxs15("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 flex items-center gap-1.5", children: [
|
|
1985
|
+
/* @__PURE__ */ jsx17(LogOut, { size: 13, className: "text-blue-600 dark:text-blue-400" }),
|
|
1731
1986
|
labels.farewellMessage
|
|
1732
1987
|
] }),
|
|
1733
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ jsx17(
|
|
1734
1989
|
WhatsAppMessageEditor,
|
|
1735
1990
|
{
|
|
1736
1991
|
value: farewellMessage,
|
|
@@ -1739,17 +1994,17 @@ function WelcomeFarewellForm({
|
|
|
1739
1994
|
placeholders: farewellPlaceholders
|
|
1740
1995
|
}
|
|
1741
1996
|
),
|
|
1742
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-1.5 text-xs text-gray-500 dark:text-gray-400", children: labels.farewellMessageHint })
|
|
1743
1998
|
] }),
|
|
1744
|
-
saveSuccess && /* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1999
|
+
saveSuccess && /* @__PURE__ */ jsx17("div", { className: "bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-800 rounded-xl px-4 py-3 text-sm text-green-700 dark:text-green-400", children: labels.saveSuccess }),
|
|
2000
|
+
/* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs15(
|
|
1746
2001
|
"button",
|
|
1747
2002
|
{
|
|
1748
2003
|
type: "submit",
|
|
1749
2004
|
disabled: saving,
|
|
1750
2005
|
className: "flex items-center gap-2 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-semibold px-5 py-2.5 rounded-xl transition-colors text-sm",
|
|
1751
2006
|
children: [
|
|
1752
|
-
saving ? /* @__PURE__ */
|
|
2007
|
+
saving ? /* @__PURE__ */ jsx17("span", { className: "w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin" }) : /* @__PURE__ */ jsx17(Save2, { size: 14 }),
|
|
1753
2008
|
saving ? labels.saving : labels.save
|
|
1754
2009
|
]
|
|
1755
2010
|
}
|
|
@@ -1759,8 +2014,8 @@ function WelcomeFarewellForm({
|
|
|
1759
2014
|
}
|
|
1760
2015
|
|
|
1761
2016
|
// src/settings/WhatsAppTemplatesSettings.tsx
|
|
1762
|
-
import { useState as
|
|
1763
|
-
import { jsx as
|
|
2017
|
+
import { useState as useState9 } from "react";
|
|
2018
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1764
2019
|
var TEMPLATE_SETTINGS_TAB = {
|
|
1765
2020
|
SELECT: "select",
|
|
1766
2021
|
CREATE: "create"
|
|
@@ -1775,10 +2030,10 @@ function WhatsAppTemplatesSettings({
|
|
|
1775
2030
|
...settingsProps
|
|
1776
2031
|
}) {
|
|
1777
2032
|
const labels = { ...DEFAULT_TEMPLATES_SETTINGS_LABELS, ...labelsOverride };
|
|
1778
|
-
const [tab, setTab] =
|
|
1779
|
-
return /* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
2033
|
+
const [tab, setTab] = useState9(TEMPLATE_SETTINGS_TAB.SELECT);
|
|
2034
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-4", children: [
|
|
2035
|
+
/* @__PURE__ */ jsxs16("nav", { className: "flex gap-1 border-b", role: "tablist", children: [
|
|
2036
|
+
/* @__PURE__ */ jsx18(
|
|
1782
2037
|
"button",
|
|
1783
2038
|
{
|
|
1784
2039
|
type: "button",
|
|
@@ -1789,7 +2044,7 @@ function WhatsAppTemplatesSettings({
|
|
|
1789
2044
|
children: labels.selectTab
|
|
1790
2045
|
}
|
|
1791
2046
|
),
|
|
1792
|
-
create ? /* @__PURE__ */
|
|
2047
|
+
create ? /* @__PURE__ */ jsx18(
|
|
1793
2048
|
"button",
|
|
1794
2049
|
{
|
|
1795
2050
|
type: "button",
|
|
@@ -1801,13 +2056,13 @@ function WhatsAppTemplatesSettings({
|
|
|
1801
2056
|
}
|
|
1802
2057
|
) : null
|
|
1803
2058
|
] }),
|
|
1804
|
-
tab === TEMPLATE_SETTINGS_TAB.SELECT ? /* @__PURE__ */
|
|
2059
|
+
tab === TEMPLATE_SETTINGS_TAB.SELECT ? /* @__PURE__ */ jsx18(WhatsAppTemplateSettingsForm, { ...settingsProps }) : create ? /* @__PURE__ */ jsx18(WhatsAppCreateTemplateForm, { ...create }) : null
|
|
1805
2060
|
] });
|
|
1806
2061
|
}
|
|
1807
2062
|
|
|
1808
2063
|
// src/settings/TopicsForm.tsx
|
|
1809
2064
|
import { Megaphone, Save as Save3 } from "lucide-react";
|
|
1810
|
-
import { jsx as
|
|
2065
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1811
2066
|
var DEFAULT_LABELS5 = {
|
|
1812
2067
|
sectionTitle: "T\xF3picos intermedi\xE1rios",
|
|
1813
2068
|
sectionDescription: "Mensagens autom\xE1ticas para assuntos espec\xEDficos, disparadas quando o cliente demonstra interesse.",
|
|
@@ -1825,19 +2080,19 @@ function TopicsForm({
|
|
|
1825
2080
|
labels: labelsOverride
|
|
1826
2081
|
}) {
|
|
1827
2082
|
const labels = { ...DEFAULT_LABELS5, ...labelsOverride };
|
|
1828
|
-
return /* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
2083
|
+
return /* @__PURE__ */ jsxs17("section", { className: "bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden", children: [
|
|
2084
|
+
/* @__PURE__ */ jsxs17("div", { className: "px-6 py-4 border-b border-gray-100 dark:border-gray-700", children: [
|
|
2085
|
+
/* @__PURE__ */ jsxs17("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2", children: [
|
|
2086
|
+
/* @__PURE__ */ jsx19(Megaphone, { size: 16, className: "text-orange-600 dark:text-orange-400" }),
|
|
1832
2087
|
labels.sectionTitle
|
|
1833
2088
|
] }),
|
|
1834
|
-
/* @__PURE__ */
|
|
2089
|
+
/* @__PURE__ */ jsx19("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: labels.sectionDescription })
|
|
1835
2090
|
] }),
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
topics.map((topic) => /* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ jsxs17("form", { onSubmit: onSave, className: "p-6 space-y-6", children: [
|
|
2092
|
+
topics.map((topic) => /* @__PURE__ */ jsxs17("div", { className: "space-y-2", children: [
|
|
2093
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-4", children: [
|
|
2094
|
+
/* @__PURE__ */ jsx19("div", { className: "flex-1", children: /* @__PURE__ */ jsx19("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: topic.label }) }),
|
|
2095
|
+
/* @__PURE__ */ jsx19(
|
|
1841
2096
|
"button",
|
|
1842
2097
|
{
|
|
1843
2098
|
type: "button",
|
|
@@ -1845,7 +2100,7 @@ function TopicsForm({
|
|
|
1845
2100
|
className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${topic.enabled ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-200 dark:bg-gray-700"}`,
|
|
1846
2101
|
role: "switch",
|
|
1847
2102
|
"aria-checked": topic.enabled,
|
|
1848
|
-
children: /* @__PURE__ */
|
|
2103
|
+
children: /* @__PURE__ */ jsx19(
|
|
1849
2104
|
"span",
|
|
1850
2105
|
{
|
|
1851
2106
|
className: `pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${topic.enabled ? "translate-x-5" : "translate-x-0"}`
|
|
@@ -1854,7 +2109,7 @@ function TopicsForm({
|
|
|
1854
2109
|
}
|
|
1855
2110
|
)
|
|
1856
2111
|
] }),
|
|
1857
|
-
/* @__PURE__ */
|
|
2112
|
+
/* @__PURE__ */ jsx19(
|
|
1858
2113
|
"textarea",
|
|
1859
2114
|
{
|
|
1860
2115
|
value: topic.message,
|
|
@@ -1866,27 +2121,27 @@ function TopicsForm({
|
|
|
1866
2121
|
}
|
|
1867
2122
|
)
|
|
1868
2123
|
] }, topic.key)),
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
/* @__PURE__ */
|
|
2124
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3", children: [
|
|
2125
|
+
/* @__PURE__ */ jsxs17(
|
|
1871
2126
|
"button",
|
|
1872
2127
|
{
|
|
1873
2128
|
type: "submit",
|
|
1874
2129
|
disabled: saving,
|
|
1875
2130
|
className: "inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50",
|
|
1876
2131
|
children: [
|
|
1877
|
-
/* @__PURE__ */
|
|
2132
|
+
/* @__PURE__ */ jsx19(Save3, { size: 14 }),
|
|
1878
2133
|
labels.saveButton
|
|
1879
2134
|
]
|
|
1880
2135
|
}
|
|
1881
2136
|
),
|
|
1882
|
-
saveSuccess && /* @__PURE__ */
|
|
2137
|
+
saveSuccess && /* @__PURE__ */ jsx19("span", { className: "text-sm text-green-600 dark:text-green-400", children: labels.saveSuccess })
|
|
1883
2138
|
] })
|
|
1884
2139
|
] })
|
|
1885
2140
|
] });
|
|
1886
2141
|
}
|
|
1887
2142
|
|
|
1888
2143
|
// src/hooks/useConversationMessages.ts
|
|
1889
|
-
import { useCallback as
|
|
2144
|
+
import { useCallback as useCallback5 } from "react";
|
|
1890
2145
|
function useConversationMessages(conversationId, params) {
|
|
1891
2146
|
const context = useConversations();
|
|
1892
2147
|
if (!context) {
|
|
@@ -1897,7 +2152,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
1897
2152
|
() => api.fetchMessages(conversationId, params),
|
|
1898
2153
|
[conversationId, params?.limit, params?.before]
|
|
1899
2154
|
);
|
|
1900
|
-
const sendMessage =
|
|
2155
|
+
const sendMessage = useCallback5(
|
|
1901
2156
|
async (text) => {
|
|
1902
2157
|
const message = await api.sendMessage(conversationId, text);
|
|
1903
2158
|
await refetch();
|
|
@@ -1905,7 +2160,7 @@ function useConversationMessages(conversationId, params) {
|
|
|
1905
2160
|
},
|
|
1906
2161
|
[api, conversationId, refetch]
|
|
1907
2162
|
);
|
|
1908
|
-
const sendMedia =
|
|
2163
|
+
const sendMedia = useCallback5(
|
|
1909
2164
|
async (mediaData) => {
|
|
1910
2165
|
const message = await api.sendMedia(conversationId, mediaData);
|
|
1911
2166
|
await refetch();
|
|
@@ -1913,14 +2168,14 @@ function useConversationMessages(conversationId, params) {
|
|
|
1913
2168
|
},
|
|
1914
2169
|
[api, conversationId, refetch]
|
|
1915
2170
|
);
|
|
1916
|
-
const sendTemplate =
|
|
2171
|
+
const sendTemplate = useCallback5(
|
|
1917
2172
|
async (templateData) => {
|
|
1918
2173
|
await api.sendTemplate(conversationId, templateData);
|
|
1919
2174
|
await refetch();
|
|
1920
2175
|
},
|
|
1921
2176
|
[api, conversationId, refetch]
|
|
1922
2177
|
);
|
|
1923
|
-
const markRead =
|
|
2178
|
+
const markRead = useCallback5(() => api.markRead(conversationId), [api, conversationId]);
|
|
1924
2179
|
return { messages: data ?? [], loading, error, refetch, sendMessage, sendMedia, sendTemplate, markRead };
|
|
1925
2180
|
}
|
|
1926
2181
|
|
|
@@ -1954,12 +2209,12 @@ function useConversationContext(conversationId) {
|
|
|
1954
2209
|
}
|
|
1955
2210
|
|
|
1956
2211
|
// src/hooks/useConversationRealtime.ts
|
|
1957
|
-
import { useEffect as
|
|
2212
|
+
import { useEffect as useEffect6, useRef as useRef5 } from "react";
|
|
1958
2213
|
function useConversationRealtime(conversationId, onEvent) {
|
|
1959
2214
|
const context = useConversations();
|
|
1960
|
-
const onEventRef =
|
|
2215
|
+
const onEventRef = useRef5(onEvent);
|
|
1961
2216
|
onEventRef.current = onEvent;
|
|
1962
|
-
|
|
2217
|
+
useEffect6(() => {
|
|
1963
2218
|
if (!context || !conversationId) return;
|
|
1964
2219
|
const source = context.sse.connectConversationStream(conversationId);
|
|
1965
2220
|
const handler = (event) => onEventRef.current(event);
|
|
@@ -1972,9 +2227,9 @@ function useConversationRealtime(conversationId, onEvent) {
|
|
|
1972
2227
|
}
|
|
1973
2228
|
function useGlobalRealtime(onEvent) {
|
|
1974
2229
|
const context = useConversations();
|
|
1975
|
-
const onEventRef =
|
|
2230
|
+
const onEventRef = useRef5(onEvent);
|
|
1976
2231
|
onEventRef.current = onEvent;
|
|
1977
|
-
|
|
2232
|
+
useEffect6(() => {
|
|
1978
2233
|
if (!context) return;
|
|
1979
2234
|
const source = context.sse.connectGlobalStream();
|
|
1980
2235
|
const handler = (event) => onEventRef.current(event);
|
|
@@ -2019,6 +2274,7 @@ function useInboxActions() {
|
|
|
2019
2274
|
}
|
|
2020
2275
|
export {
|
|
2021
2276
|
AudioPlayer,
|
|
2277
|
+
AudioRecorderButton,
|
|
2022
2278
|
Avatar,
|
|
2023
2279
|
CHANNEL_BRAND_COLOR,
|
|
2024
2280
|
CHANNEL_CAPABILITIES,
|
|
@@ -2035,6 +2291,7 @@ export {
|
|
|
2035
2291
|
ConversationWallpaper,
|
|
2036
2292
|
ConversationsProvider,
|
|
2037
2293
|
DEFAULT_ACCEPTED_FILE_TYPES,
|
|
2294
|
+
DEFAULT_AUDIO_RECORDER_BUTTON_LABELS,
|
|
2038
2295
|
DEFAULT_AVATAR_LABELS,
|
|
2039
2296
|
DEFAULT_CONVERSATION_CHANNEL,
|
|
2040
2297
|
DEFAULT_CONVERSATION_CONTEXT_LABELS,
|
|
@@ -2045,7 +2302,9 @@ export {
|
|
|
2045
2302
|
DEFAULT_EMOJI_PICKER_LABELS,
|
|
2046
2303
|
DEFAULT_INTERACTIVE_MESSAGE_LABELS,
|
|
2047
2304
|
DEFAULT_LIGHTBOX_LABELS,
|
|
2305
|
+
DEFAULT_MAX_RECORDING_MILLISECONDS,
|
|
2048
2306
|
DEFAULT_MESSAGE_COMPOSER_LABELS,
|
|
2307
|
+
DEFAULT_RICH_COMPOSER_TOOLTIPS,
|
|
2049
2308
|
DEFAULT_TEMPLATES_SETTINGS_LABELS,
|
|
2050
2309
|
DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS,
|
|
2051
2310
|
DEFAULT_WINDOW_EXPIRED_LABELS,
|
|
@@ -2066,6 +2325,8 @@ export {
|
|
|
2066
2325
|
MessageTimestamp,
|
|
2067
2326
|
NARROW_MAX_WIDTH_PX,
|
|
2068
2327
|
REOPEN_MECHANISM,
|
|
2328
|
+
RICH_COMPOSER_ACTION,
|
|
2329
|
+
RichMessageComposer,
|
|
2069
2330
|
SimpleEmojiPicker,
|
|
2070
2331
|
StatusTicks,
|
|
2071
2332
|
TEMPLATE_SETTINGS_TAB,
|