@adatechnology/conversations-ui 0.1.0-rc.6 → 0.1.0-rc.7

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { ReactNode, FormEvent } from 'react';
3
- import { v as MessagePayload, x as ResolveMediaUrl, p as ConversationsFeatures, m as ConversationSummary, h as ConversationChannel, L as ListConversationsParams, o as ConversationsApi, S as SSEProvider, t as ListDocumentsParams, i as ConversationDocument, n as ConversationTemplate } from './types-CeixG2Z9.js';
4
- export { C as CHANNEL_CAPABILITIES, a as CHANNEL_FILTER_ALL, b as CONVERSATION_CHANNEL, c as ChannelCapabilities, d as ChannelFilter, e as ChannelFilterOption, f as CompanyDocument, g as CompanyDocumentPage, j as ConversationDocumentPage, k as ConversationEventSource, l as ConversationPage, q as ConversationsTheme, r as ConversationsUIConfig, D as DEFAULT_CONVERSATION_CHANNEL, F as FormatContactHandleParams, H as HANDLE_KIND, s as HandleKind, M as MediaRenderer, u as MediaRendererProps, R as REOPEN_MECHANISM, w as ReopenMechanism, y as capabilitiesOf, z as channelFiltersFor, A as contactFlag, B as formatContactHandle } from './types-CeixG2Z9.js';
3
+ import { y as MessagePayload, A as ResolveMediaUrl, v as InteractiveSelection, t as InteractivePayload, p as ConversationsFeatures, m as ConversationSummary, h as ConversationChannel, L as ListConversationsParams, o as ConversationsApi, S as SSEProvider, w as ListDocumentsParams, i as ConversationDocument, n as ConversationTemplate } from './types-B5C1DLu1.js';
4
+ export { C as CHANNEL_CAPABILITIES, a as CHANNEL_FILTER_ALL, b as CONVERSATION_CHANNEL, c as ChannelCapabilities, d as ChannelFilter, e as ChannelFilterOption, f as CompanyDocument, g as CompanyDocumentPage, j as ConversationDocumentPage, k as ConversationEventSource, l as ConversationPage, q as ConversationsTheme, r as ConversationsUIConfig, D as DEFAULT_CONVERSATION_CHANNEL, F as FormatContactHandleParams, H as HANDLE_KIND, s as HandleKind, I as InteractiveOption, u as InteractiveSection, M as MediaRenderer, x as MediaRendererProps, R as REOPEN_MECHANISM, z as ReopenMechanism, B as capabilitiesOf, E as channelFiltersFor, G as contactFlag, J as formatContactHandle } from './types-B5C1DLu1.js';
5
5
 
6
6
  interface MessageBubbleProps {
7
7
  message: MessagePayload;
@@ -16,9 +16,27 @@ interface MessageBubbleProps {
16
16
  * `ConversationsProvider` — passe apenas para sobrescrever (cache próprio, CDN, proxy do host).
17
17
  */
18
18
  onResolveMediaUrl?: ResolveMediaUrl;
19
+ /**
20
+ * Toque numa opção do menu interativo. Ausente, as opções aparecem desabilitadas — que é o certo
21
+ * no histórico da inbox: o operador vê o que foi oferecido, sem responder no lugar do cliente.
22
+ */
23
+ onInteractiveSelect?: (selection: InteractiveSelection) => void;
19
24
  className?: string;
20
25
  }
21
- declare function MessageBubble({ message, isMine, senderName, isFirstInGroup, isSelecting, isSelected, onToggleSelect, onResolveMediaUrl, className, }: MessageBubbleProps): react.JSX.Element;
26
+ declare function MessageBubble({ message, isMine, senderName, isFirstInGroup, isSelecting, isSelected, onToggleSelect, onResolveMediaUrl, onInteractiveSelect, className, }: MessageBubbleProps): react.JSX.Element;
27
+
28
+ interface InteractiveMessageLabels {
29
+ /** Fallback do rótulo do botão que abre a lista, quando o payload não traz um. */
30
+ openList: string;
31
+ }
32
+ declare const DEFAULT_INTERACTIVE_MESSAGE_LABELS: InteractiveMessageLabels;
33
+ interface InteractiveMessageProps {
34
+ payload: InteractivePayload;
35
+ onSelect?: (selection: InteractiveSelection) => void;
36
+ labels?: Partial<InteractiveMessageLabels>;
37
+ className?: string;
38
+ }
39
+ declare function InteractiveMessage({ payload, onSelect, labels, className }: InteractiveMessageProps): react.JSX.Element;
22
40
 
23
41
  interface ConversationWallpaperProps {
24
42
  children?: ReactNode;
@@ -72,11 +90,41 @@ interface AudioPlayerProps {
72
90
  }
73
91
  declare function AudioPlayer({ src, isMine }: AudioPlayerProps): react.JSX.Element;
74
92
 
93
+ interface EmojiPickerLabels {
94
+ search: string;
95
+ noResults: string;
96
+ }
97
+ declare const DEFAULT_EMOJI_PICKER_LABELS: EmojiPickerLabels;
75
98
  interface EmojiPickerProps {
76
99
  onSelect: (emoji: string) => void;
100
+ labels?: Partial<EmojiPickerLabels>;
77
101
  className?: string;
78
102
  }
79
- declare const EmojiPicker: ({ onSelect, className }: EmojiPickerProps) => react.JSX.Element;
103
+ declare const EmojiPicker: ({ onSelect, labels, className }: EmojiPickerProps) => react.JSX.Element;
104
+
105
+ /**
106
+ * Catálogo de emojis com palavras-chave em português, usado pela busca do seletor.
107
+ *
108
+ * Fica em módulo próprio (e não dentro do `EmojiPicker`) porque a busca precisa varrer TODAS as
109
+ * categorias, não só a aberta — o índice é montado uma vez, no carregamento, e não a cada tecla.
110
+ *
111
+ * As palavras-chave são de busca, não legendas: incluem sinônimos e formas sem acento, porque quem
112
+ * digita rápido escreve "coracao" e "polegar" com a mesma frequência que a forma correta.
113
+ */
114
+ type EmojiEntry = {
115
+ readonly emoji: string;
116
+ readonly keywords: readonly string[];
117
+ };
118
+ type EmojiCategory = {
119
+ readonly name: string;
120
+ readonly entries: readonly EmojiEntry[];
121
+ };
122
+ declare const EMOJI_CATEGORIES: readonly EmojiCategory[];
123
+ /**
124
+ * Busca por prefixo de palavra-chave, não por substring: "ca" traz "casa" e "cartão", mas "sa" não
125
+ * traz "casa" — casar no meio da palavra devolvia resultado que ninguém consegue explicar.
126
+ */
127
+ declare function searchEmojis(query: string): readonly EmojiEntry[];
80
128
 
81
129
  interface MessageComposerLabels {
82
130
  emoji: string;
@@ -102,6 +150,13 @@ interface MessageComposerClassNames {
102
150
  root: string;
103
151
  field: string;
104
152
  }
153
+ /**
154
+ * Exatamente o que a Meta aceita em mensagem de mídia — imagem, sticker, áudio, vídeo e a lista
155
+ * fechada de documentos. Oferecer no seletor um formato que o WhatsApp recusa (`.zip`, `.rtf`)
156
+ * empurra a falha para depois do envio, quando já não dá para explicar ao operador o que houve.
157
+ * Produto com regra própria passa `acceptedFileTypes`.
158
+ */
159
+ declare const DEFAULT_ACCEPTED_FILE_TYPES: string;
105
160
  declare const MessageComposer: ({ onSend, onAttach, value: externalValue, onChange: externalOnChange, features, placeholder, maxLength, disabled, acceptedFileTypes, className, classNames, labels, }: MessageComposerProps) => react.JSX.Element;
106
161
 
107
162
  interface WhatsAppMessageEditorLabels {
@@ -350,6 +405,19 @@ interface ConversationHeaderClassNames {
350
405
  desktopActions: string;
351
406
  mobileMenu: string;
352
407
  }
408
+ /**
409
+ * Utilitário extra que o host pendura no cabeçalho — ícone no desktop, item de menu no celular,
410
+ * como os nativos. Entra por aqui, e não por um slot de ReactNode, porque é isso que preserva o
411
+ * comportamento responsivo: um nó solto viraria um quarto ícone em 375px, sem área de toque.
412
+ */
413
+ interface ConversationHeaderUtility {
414
+ key: string;
415
+ /** Emoji, para casar com os utilitários nativos do cabeçalho. */
416
+ icon: string;
417
+ label: string;
418
+ run: () => void;
419
+ active?: boolean;
420
+ }
353
421
  interface ConversationHeaderProps {
354
422
  conversation: ConversationSummary;
355
423
  busy?: boolean;
@@ -359,12 +427,14 @@ interface ConversationHeaderProps {
359
427
  onDownload?: () => void;
360
428
  onOpenDocuments?: () => void;
361
429
  documentsOpen?: boolean;
430
+ /** Ações do produto que não existem no contrato do pacote (ex.: ferramentas de dev). */
431
+ extraUtilities?: readonly ConversationHeaderUtility[];
362
432
  onBack?: () => void;
363
433
  labels?: Partial<ConversationHeaderLabels>;
364
434
  className?: string;
365
435
  classNames?: Partial<ConversationHeaderClassNames>;
366
436
  }
367
- declare function ConversationHeader({ conversation, busy, onTakeover, onReturnToBot, onFinish, onDownload, onOpenDocuments, documentsOpen, onBack, labels: labelsOverride, className, classNames, }: ConversationHeaderProps): react.JSX.Element;
437
+ declare function ConversationHeader({ conversation, busy, onTakeover, onReturnToBot, onFinish, onDownload, onOpenDocuments, documentsOpen, extraUtilities, onBack, labels: labelsOverride, className, classNames, }: ConversationHeaderProps): react.JSX.Element;
368
438
 
369
439
  /**
370
440
  * "Suas Seleções": o que o bot já coletou na conversa. Para o atendente que assume no meio, é a
@@ -945,4 +1015,4 @@ interface AsyncResourceState<T> {
945
1015
 
946
1016
  declare function createMediaUrlResolver(api: Pick<ConversationsApi, 'getDocumentUrl' | 'getMediaProxyUrl'>): ResolveMediaUrl;
947
1017
 
948
- export { type AsyncResourceState, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarLabels, type AvatarProps, type BuildTranscriptTextParams, CHANNEL_BRAND_COLOR, CONVERSATION_WINDOW, ChannelIcon, type ChannelIconProps, ConversationChannel, type ConversationContextEntry, ConversationContextPanel, type ConversationContextPanelClassNames, type ConversationContextPanelLabels, type ConversationContextPanelProps, ConversationDocument, ConversationDocumentsPanel, type ConversationDocumentsPanelClassNames, type ConversationDocumentsPanelLabels, type ConversationDocumentsPanelProps, ConversationHeader, type ConversationHeaderClassNames, type ConversationHeaderLabels, type ConversationHeaderProps, ConversationListItem, type ConversationListItemLabels, type ConversationListItemProps, type ConversationLocales, ConversationLocalesProvider, type ConversationLocalesProviderProps, type ConversationRealtimeHandler, ConversationRow, type ConversationRowClassNames, type ConversationRowProps, ConversationSummary, ConversationTemplate, ConversationWallpaper, type ConversationWallpaperProps, type ConversationWindow, ConversationsApi, ConversationsFeatures, ConversationsProvider, DEFAULT_AVATAR_LABELS, DEFAULT_CONVERSATION_CONTEXT_LABELS, DEFAULT_CONVERSATION_DOCUMENTS_LABELS, DEFAULT_CONVERSATION_HEADER_LABELS, DEFAULT_CONVERSATION_LIST_ITEM_LABELS, DEFAULT_DOCUMENTS_LIBRARY_LABELS, DEFAULT_LIGHTBOX_LABELS, DEFAULT_MESSAGE_COMPOSER_LABELS, DEFAULT_TEMPLATES_SETTINGS_LABELS, DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS, DEFAULT_WINDOW_EXPIRED_LABELS, DOCUMENT_SOURCE_FILTER, DateDivider, type DateDividerClassNames, type DateDividerProps, type DocumentSourceFilter, DocumentsLibrary, type DocumentsLibraryClassNames, type DocumentsLibraryLabels, type DocumentsLibraryProps, EmojiPicker, type EmojiPickerProps, FileIcon, type FileIconProps, Lightbox, type LightboxLabels, type LightboxProps, ListConversationsParams, ListDocumentsParams, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerClassNames, type MessageComposerLabels, type MessageComposerProps, MessagePayload, MessageTail, MessageText, type MessageTextProps, MessageTimestamp, NARROW_MAX_WIDTH_PX, ResolveMediaUrl, SSEProvider, SimpleEmojiPicker, type SimpleEmojiPickerProps, StatusTicks, type StatusTicksProps, TEMPLATE_SETTINGS_TAB, type TemplateSettingsTab, ToastProvider, type TopicItem, TopicsForm, type TopicsFormLabels, type TopicsFormProps, type UseConversationActionsResult, type UseConversationContextResult, type UseConversationDocumentsParams, type UseConversationDocumentsResult, type UseConversationListParams, type UseConversationListResult, type UseConversationMessagesResult, type UseInboxActionsResult, type UseWaitingNotificationsLabels, type UseWaitingNotificationsParams, type UseWaitingNotificationsResult, WINDOW_FILTERS, WelcomeFarewellForm, type WelcomeFarewellFormLabels, type WelcomeFarewellFormProps, WhatsAppCreateTemplateForm, type WhatsAppCreateTemplateFormLabels, type WhatsAppCreateTemplateFormProps, type WhatsAppCreateTemplateResult, type WhatsAppCreateTemplateState, WhatsAppMessageEditor, type WhatsAppMessageEditorLabels, type WhatsAppMessageEditorProps, type WhatsAppTemplateHeaderType, WhatsAppTemplateSettingsForm, type WhatsAppTemplateSettingsFormLabels, type WhatsAppTemplateSettingsFormProps, type WhatsAppTemplateSummary, type WhatsAppTemplateVariableSuggestion, WhatsAppTemplatesSettings, type WhatsAppTemplatesSettingsLabels, type WhatsAppTemplatesSettingsProps, WindowExpiredNotice, type WindowExpiredNoticeLabels, type WindowExpiredNoticeProps, type WindowOfParams, buildTranscriptFilename, buildTranscriptText, createMediaUrlResolver, downloadTextFile, formatDateTime, formatFileSize, formatPhone, formatStalledFor, formatTimestamp, htmlToWA, isSameDay, isWindowBlocking, parseWhatsAppFormatting, phoneInitials, toast, useConversationActions, useConversationContext, useConversationDocuments, useConversationList, useConversationLocales, useConversationMessages, useConversationRealtime, useConversations, useDarkMode, useGlobalRealtime, useInboxActions, useIsDarkTheme, useIsNarrow, useToast, useWaitingNotifications, waToHTML, waToHTMLInline, windowOf };
1018
+ export { type AsyncResourceState, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarLabels, type AvatarProps, type BuildTranscriptTextParams, CHANNEL_BRAND_COLOR, CONVERSATION_WINDOW, ChannelIcon, type ChannelIconProps, ConversationChannel, type ConversationContextEntry, ConversationContextPanel, type ConversationContextPanelClassNames, type ConversationContextPanelLabels, type ConversationContextPanelProps, ConversationDocument, ConversationDocumentsPanel, type ConversationDocumentsPanelClassNames, type ConversationDocumentsPanelLabels, type ConversationDocumentsPanelProps, ConversationHeader, type ConversationHeaderClassNames, type ConversationHeaderLabels, type ConversationHeaderProps, type ConversationHeaderUtility, ConversationListItem, type ConversationListItemLabels, type ConversationListItemProps, type ConversationLocales, ConversationLocalesProvider, type ConversationLocalesProviderProps, type ConversationRealtimeHandler, ConversationRow, type ConversationRowClassNames, type ConversationRowProps, ConversationSummary, ConversationTemplate, ConversationWallpaper, type ConversationWallpaperProps, type ConversationWindow, ConversationsApi, ConversationsFeatures, ConversationsProvider, DEFAULT_ACCEPTED_FILE_TYPES, DEFAULT_AVATAR_LABELS, DEFAULT_CONVERSATION_CONTEXT_LABELS, DEFAULT_CONVERSATION_DOCUMENTS_LABELS, DEFAULT_CONVERSATION_HEADER_LABELS, DEFAULT_CONVERSATION_LIST_ITEM_LABELS, DEFAULT_DOCUMENTS_LIBRARY_LABELS, DEFAULT_EMOJI_PICKER_LABELS, DEFAULT_INTERACTIVE_MESSAGE_LABELS, DEFAULT_LIGHTBOX_LABELS, DEFAULT_MESSAGE_COMPOSER_LABELS, DEFAULT_TEMPLATES_SETTINGS_LABELS, DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS, DEFAULT_WINDOW_EXPIRED_LABELS, DOCUMENT_SOURCE_FILTER, DateDivider, type DateDividerClassNames, type DateDividerProps, type DocumentSourceFilter, DocumentsLibrary, type DocumentsLibraryClassNames, type DocumentsLibraryLabels, type DocumentsLibraryProps, EMOJI_CATEGORIES, type EmojiCategory, type EmojiEntry, EmojiPicker, type EmojiPickerLabels, type EmojiPickerProps, FileIcon, type FileIconProps, InteractiveMessage, type InteractiveMessageLabels, type InteractiveMessageProps, InteractivePayload, InteractiveSelection, Lightbox, type LightboxLabels, type LightboxProps, ListConversationsParams, ListDocumentsParams, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerClassNames, type MessageComposerLabels, type MessageComposerProps, MessagePayload, MessageTail, MessageText, type MessageTextProps, MessageTimestamp, NARROW_MAX_WIDTH_PX, ResolveMediaUrl, SSEProvider, SimpleEmojiPicker, type SimpleEmojiPickerProps, StatusTicks, type StatusTicksProps, TEMPLATE_SETTINGS_TAB, type TemplateSettingsTab, ToastProvider, type TopicItem, TopicsForm, type TopicsFormLabels, type TopicsFormProps, type UseConversationActionsResult, type UseConversationContextResult, type UseConversationDocumentsParams, type UseConversationDocumentsResult, type UseConversationListParams, type UseConversationListResult, type UseConversationMessagesResult, type UseInboxActionsResult, type UseWaitingNotificationsLabels, type UseWaitingNotificationsParams, type UseWaitingNotificationsResult, WINDOW_FILTERS, WelcomeFarewellForm, type WelcomeFarewellFormLabels, type WelcomeFarewellFormProps, WhatsAppCreateTemplateForm, type WhatsAppCreateTemplateFormLabels, type WhatsAppCreateTemplateFormProps, type WhatsAppCreateTemplateResult, type WhatsAppCreateTemplateState, WhatsAppMessageEditor, type WhatsAppMessageEditorLabels, type WhatsAppMessageEditorProps, type WhatsAppTemplateHeaderType, WhatsAppTemplateSettingsForm, type WhatsAppTemplateSettingsFormLabels, type WhatsAppTemplateSettingsFormProps, type WhatsAppTemplateSummary, type WhatsAppTemplateVariableSuggestion, WhatsAppTemplatesSettings, type WhatsAppTemplatesSettingsLabels, type WhatsAppTemplatesSettingsProps, WindowExpiredNotice, type WindowExpiredNoticeLabels, type WindowExpiredNoticeProps, type WindowOfParams, buildTranscriptFilename, buildTranscriptText, createMediaUrlResolver, downloadTextFile, formatDateTime, formatFileSize, formatPhone, formatStalledFor, formatTimestamp, htmlToWA, isSameDay, isWindowBlocking, parseWhatsAppFormatting, phoneInitials, searchEmojis, toast, useConversationActions, useConversationContext, useConversationDocuments, useConversationList, useConversationLocales, useConversationMessages, useConversationRealtime, useConversations, useDarkMode, useGlobalRealtime, useInboxActions, useIsDarkTheme, useIsNarrow, useToast, useWaitingNotifications, waToHTML, waToHTMLInline, windowOf };
package/dist/index.js CHANGED
@@ -8,15 +8,20 @@ import {
8
8
  ConversationLocalesProvider,
9
9
  ConversationWallpaper,
10
10
  ConversationsProvider,
11
+ DEFAULT_ACCEPTED_FILE_TYPES,
11
12
  DEFAULT_CONVERSATION_DOCUMENTS_LABELS,
12
13
  DEFAULT_DOCUMENTS_LIBRARY_LABELS,
14
+ DEFAULT_EMOJI_PICKER_LABELS,
15
+ DEFAULT_INTERACTIVE_MESSAGE_LABELS,
13
16
  DEFAULT_LIGHTBOX_LABELS,
14
17
  DEFAULT_MESSAGE_COMPOSER_LABELS,
15
18
  DOCUMENT_SOURCE_FILTER,
16
19
  DateDivider,
17
20
  DocumentsLibrary,
21
+ EMOJI_CATEGORIES,
18
22
  EmojiPicker,
19
23
  FileIcon,
24
+ InteractiveMessage,
20
25
  Lightbox,
21
26
  MediaRenderer,
22
27
  MessageBubble,
@@ -32,12 +37,13 @@ import {
32
37
  isSameDay,
33
38
  phoneCountryFlag,
34
39
  phoneInitials,
40
+ searchEmojis,
35
41
  totalOf,
36
42
  useAsyncResource,
37
43
  useConversationDocuments,
38
44
  useConversationLocales,
39
45
  useConversations
40
- } from "./chunk-LITPZCWW.js";
46
+ } from "./chunk-TGTBMMFC.js";
41
47
  import {
42
48
  htmlToWA,
43
49
  parseWhatsAppFormatting,
@@ -928,6 +934,7 @@ function ConversationHeader({
928
934
  onDownload,
929
935
  onOpenDocuments,
930
936
  documentsOpen = false,
937
+ extraUtilities,
931
938
  onBack,
932
939
  labels: labelsOverride,
933
940
  className,
@@ -942,7 +949,8 @@ function ConversationHeader({
942
949
  const [menuOpen, setMenuOpen] = useState4(false);
943
950
  const utilities = [
944
951
  onOpenDocuments ? { key: "documents", icon: "\u{1F4C4}", label: labels.documents, run: onOpenDocuments, active: documentsOpen } : void 0,
945
- onDownload ? { key: "download", icon: "\u2B07\uFE0F", label: labels.download, run: onDownload, active: false } : void 0
952
+ onDownload ? { key: "download", icon: "\u2B07\uFE0F", label: labels.download, run: onDownload, active: false } : void 0,
953
+ ...(extraUtilities ?? []).map((utility) => ({ ...utility, active: utility.active ?? false }))
946
954
  ].filter(
947
955
  (utility) => Boolean(utility)
948
956
  );
@@ -2026,6 +2034,7 @@ export {
2026
2034
  ConversationRow,
2027
2035
  ConversationWallpaper,
2028
2036
  ConversationsProvider,
2037
+ DEFAULT_ACCEPTED_FILE_TYPES,
2029
2038
  DEFAULT_AVATAR_LABELS,
2030
2039
  DEFAULT_CONVERSATION_CHANNEL,
2031
2040
  DEFAULT_CONVERSATION_CONTEXT_LABELS,
@@ -2033,6 +2042,8 @@ export {
2033
2042
  DEFAULT_CONVERSATION_HEADER_LABELS,
2034
2043
  DEFAULT_CONVERSATION_LIST_ITEM_LABELS,
2035
2044
  DEFAULT_DOCUMENTS_LIBRARY_LABELS,
2045
+ DEFAULT_EMOJI_PICKER_LABELS,
2046
+ DEFAULT_INTERACTIVE_MESSAGE_LABELS,
2036
2047
  DEFAULT_LIGHTBOX_LABELS,
2037
2048
  DEFAULT_MESSAGE_COMPOSER_LABELS,
2038
2049
  DEFAULT_TEMPLATES_SETTINGS_LABELS,
@@ -2041,9 +2052,11 @@ export {
2041
2052
  DOCUMENT_SOURCE_FILTER,
2042
2053
  DateDivider,
2043
2054
  DocumentsLibrary,
2055
+ EMOJI_CATEGORIES,
2044
2056
  EmojiPicker,
2045
2057
  FileIcon,
2046
2058
  HANDLE_KIND,
2059
+ InteractiveMessage,
2047
2060
  Lightbox,
2048
2061
  MediaRenderer,
2049
2062
  MessageBubble,
@@ -2083,6 +2096,7 @@ export {
2083
2096
  isWindowBlocking,
2084
2097
  parseWhatsAppFormatting,
2085
2098
  phoneInitials,
2099
+ searchEmojis,
2086
2100
  toast,
2087
2101
  useConversationActions,
2088
2102
  useConversationContext,
@@ -1,6 +1,6 @@
1
- import { v as MessagePayload, m as ConversationSummary, k as ConversationEventSource, o as ConversationsApi, L as ListConversationsParams, l as ConversationPage, S as SSEProvider, i as ConversationDocument, x as ResolveMediaUrl } from '../types-CeixG2Z9.js';
1
+ import { y as MessagePayload, m as ConversationSummary, k as ConversationEventSource, o as ConversationsApi, L as ListConversationsParams, l as ConversationPage, S as SSEProvider, i as ConversationDocument, A as ResolveMediaUrl } from '../types-B5C1DLu1.js';
2
2
  import * as react from 'react';
3
- import { InteractiveReplyOption } from '@adatechnology/meta-whatsapp-contracts/testing';
3
+ import { InteractiveReplyOption, InboundMediaType } from '@adatechnology/meta-whatsapp-contracts/testing';
4
4
 
5
5
  /**
6
6
  * Estado em memória que alimenta o preview de atendimento humano. Mock de API e mock de SSE
@@ -129,6 +129,19 @@ type PreviewWebhookClient = {
129
129
  sendButtonReply(reply: InteractiveReplyOption): Promise<void>;
130
130
  sendListReply(reply: InteractiveReplyOption): Promise<void>;
131
131
  sendAudio(mediaId: string): Promise<void>;
132
+ sendMedia(params: SendPreviewMediaParams): Promise<void>;
133
+ };
134
+ type SendPreviewMediaParams = {
135
+ readonly mediaType: InboundMediaType;
136
+ /**
137
+ * Id que o host já usa para buscar o arquivo. Não é bytes: o webhook da Meta entrega mídia por
138
+ * referência, e o consumidor baixa depois — mandar base64 aqui simularia um payload que a Meta
139
+ * nunca produz, e o caminho testado deixaria de ser o de produção.
140
+ */
141
+ readonly mediaId: string;
142
+ readonly mimeType?: string;
143
+ readonly filename?: string;
144
+ readonly caption?: string;
132
145
  };
133
146
  type CreatePreviewWebhookClientParams = {
134
147
  readonly webhookUrl: string;
@@ -149,6 +162,18 @@ declare class PreviewWebhookRejectedError extends Error {
149
162
  * que um que se recusa a montar.
150
163
  */
151
164
  declare function assertPreviewEnvironment(isProduction: boolean): void;
165
+ /**
166
+ * Assina um texto qualquer com o app secret, no mesmo formato do header da Meta.
167
+ *
168
+ * Exportada porque o preview precisa provar identidade em MAIS de um lugar: além de entregar a
169
+ * mensagem no webhook, ele lê o transcript de volta — e ler pela API de admin exigia uma sessão que
170
+ * a aba do simulador não tem. Assinar a leitura com o segredo que ele já carrega resolve sem token
171
+ * de admin e sem rota aberta.
172
+ */
173
+ declare function signPreviewPayload(params: {
174
+ rawBody: string;
175
+ appSecret: string;
176
+ }): Promise<string>;
152
177
  declare function createPreviewWebhookClient(params: CreatePreviewWebhookClientParams): PreviewWebhookClient;
153
178
 
154
179
  type ConversationPreviewProps = {
@@ -157,8 +182,52 @@ type ConversationPreviewProps = {
157
182
  conversationId: string;
158
183
  loadMessages: (conversationId: string) => Promise<MessagePayload[]>;
159
184
  placeholder?: string;
185
+ /**
186
+ * Recarrega o transcript a cada N ms. Serve a host SEM stream: a resposta do bot é assíncrona, e
187
+ * sem SSE nem polling ela só apareceria no próximo envio — o sintoma é "às vezes ele não
188
+ * responde". Ausente, não faz polling (host com SSE não precisa).
189
+ */
190
+ pollIntervalMs?: number;
191
+ /**
192
+ * Como transformar um arquivo do disco (ou o áudio gravado) na referência que o webhook carrega.
193
+ * O caminho da Meta entrega mídia por `id`, e quem sabe hospedar o arquivo é o host — a SDK não
194
+ * inventa um endpoint de upload. Ausente, o compositor não oferece anexo nem gravação: melhor um
195
+ * botão que não existe do que um que falha ao ser tocado.
196
+ */
197
+ uploadMedia?: (file: File) => Promise<PreviewUploadedMedia>;
198
+ };
199
+ type PreviewUploadedMedia = {
200
+ readonly mediaId: string;
201
+ readonly mimeType?: string;
202
+ readonly filename?: string;
160
203
  };
161
- declare function ConversationPreview({ client, sse, conversationId, loadMessages, placeholder, }: ConversationPreviewProps): react.JSX.Element;
204
+ /** Deriva o tipo de mídia do WhatsApp a partir do MIME do arquivo escolhido. */
205
+ declare function mediaTypeOf(mimeType: string): SendPreviewMediaParams['mediaType'];
206
+ declare function ConversationPreview({ client, sse, conversationId, loadMessages, placeholder, pollIntervalMs, uploadMedia, }: ConversationPreviewProps): react.JSX.Element;
207
+
208
+ /**
209
+ * Gravação de áudio no simulador, pelo microfone do próprio navegador.
210
+ *
211
+ * Existe porque áudio é o formato que mais chega de cliente real e o que mais quebra fluxo: sem
212
+ * poder gravar aqui, testar o caminho de transcrição exigia mandar mensagem do celular de alguém.
213
+ *
214
+ * O arquivo gravado sai daqui como `File` e segue exatamente o mesmo caminho de um anexo — quem
215
+ * hospeda e devolve o `mediaId` é o host, via `uploadMedia`.
216
+ */
217
+ interface AudioRecorderButtonLabels {
218
+ start: string;
219
+ stop: string;
220
+ unsupported: string;
221
+ denied: string;
222
+ }
223
+ declare const DEFAULT_AUDIO_RECORDER_BUTTON_LABELS: AudioRecorderButtonLabels;
224
+ interface AudioRecorderButtonProps {
225
+ onRecorded: (file: File) => void | Promise<void>;
226
+ onFailure?: (message: string) => void;
227
+ labels?: Partial<AudioRecorderButtonLabels>;
228
+ disabled?: boolean;
229
+ }
230
+ declare function AudioRecorderButton({ onRecorded, onFailure, labels, disabled }: AudioRecorderButtonProps): react.JSX.Element;
162
231
 
163
232
  /**
164
233
  * Roteiro que mantém o preview vivo: sem tráfego chegando, a inbox é uma tela estática e as
@@ -258,4 +327,4 @@ type MediaTypesPreviewProps = {
258
327
  };
259
328
  declare function MediaTypesPreview({ conversationId, className, }: MediaTypesPreviewProps): react.JSX.Element;
260
329
 
261
- export { type AppendMessageParams, ConversationPreview, type ConversationPreviewProps, type CreateMockConversationsApiParams, type CreateMockSSEProviderParams, type CreatePreviewStoreParams, type CreatePreviewWebhookClientParams, DEFAULT_PREVIEW_SCRIPT, GLOBAL_CHANNEL, type ListConversationsFilters, MEDIA_TYPES_CONVERSATION_ID, MediaTypesPreview, type MediaTypesPreviewProps, type MockEventSource, PREVIEW_CONVERSATIONS, PREVIEW_DOCUMENTS, PREVIEW_FILE_SAMPLES, PREVIEW_MESSAGES, type PreviewEmission, PreviewInProductionError, type PreviewScriptStep, type PreviewStore, type PreviewStoreListener, type PreviewWebhookClient, PreviewWebhookRejectedError, type SetModeParams, type StartPreviewScriptParams, assertPreviewEnvironment, conversationChannel, createMockConversationsApi, createMockEventSource, createMockSSEProvider, createPreviewMediaResolver, createPreviewStore, createPreviewWebhookClient, previewFileBase64, previewFileUrl, resolvePreviewFileSample, startPreviewScript };
330
+ export { type AppendMessageParams, AudioRecorderButton, type AudioRecorderButtonLabels, type AudioRecorderButtonProps, ConversationPreview, type ConversationPreviewProps, type CreateMockConversationsApiParams, type CreateMockSSEProviderParams, type CreatePreviewStoreParams, type CreatePreviewWebhookClientParams, DEFAULT_AUDIO_RECORDER_BUTTON_LABELS, DEFAULT_PREVIEW_SCRIPT, GLOBAL_CHANNEL, type ListConversationsFilters, MEDIA_TYPES_CONVERSATION_ID, MediaTypesPreview, type MediaTypesPreviewProps, type MockEventSource, PREVIEW_CONVERSATIONS, PREVIEW_DOCUMENTS, PREVIEW_FILE_SAMPLES, PREVIEW_MESSAGES, type PreviewEmission, PreviewInProductionError, type PreviewScriptStep, type PreviewStore, type PreviewStoreListener, type PreviewUploadedMedia, type PreviewWebhookClient, PreviewWebhookRejectedError, type SendPreviewMediaParams, type SetModeParams, type StartPreviewScriptParams, assertPreviewEnvironment, conversationChannel, createMockConversationsApi, createMockEventSource, createMockSSEProvider, createPreviewMediaResolver, createPreviewStore, createPreviewWebhookClient, mediaTypeOf, previewFileBase64, previewFileUrl, resolvePreviewFileSample, signPreviewPayload, startPreviewScript };