@adatechnology/conversations-ui 0.3.2 → 0.4.1

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.
@@ -119,6 +119,85 @@ interface MessageTranscription {
119
119
  engine?: string | null;
120
120
  }
121
121
 
122
+ /**
123
+ * Canal de origem da conversa e o que cada um permite.
124
+ *
125
+ * Existe porque as regras que a inbox precisa respeitar não são do WhatsApp, são **de cada canal**:
126
+ * a janela de sessão, o jeito de reabrir a conversa e o formato do identificador do contato mudam
127
+ * entre WhatsApp, Messenger, Instagram e chat de site. Tratar a regra do WhatsApp como universal
128
+ * faria a UI bloquear o composer num chat de site, onde janela nenhuma existe.
129
+ *
130
+ * `whatsapp` é o padrão em todo lugar: instalações que ainda não informam canal continuam
131
+ * funcionando exatamente como antes.
132
+ */
133
+ declare const CONVERSATION_CHANNEL: {
134
+ readonly WHATSAPP: "whatsapp";
135
+ readonly MESSENGER: "messenger";
136
+ readonly INSTAGRAM: "instagram";
137
+ readonly WEBCHAT: "webchat";
138
+ readonly EMAIL: "email";
139
+ };
140
+ type ConversationChannel = (typeof CONVERSATION_CHANNEL)[keyof typeof CONVERSATION_CHANNEL];
141
+ declare const DEFAULT_CONVERSATION_CHANNEL: ConversationChannel;
142
+ /** Como o canal reabre uma conversa fora da janela de sessão. */
143
+ declare const REOPEN_MECHANISM: {
144
+ readonly TEMPLATE: "template";
145
+ readonly TAG: "tag";
146
+ readonly NONE: "none";
147
+ };
148
+ type ReopenMechanism = (typeof REOPEN_MECHANISM)[keyof typeof REOPEN_MECHANISM];
149
+ /** Natureza do identificador do contato — decide como exibi-lo. */
150
+ declare const HANDLE_KIND: {
151
+ readonly PHONE: "phone";
152
+ readonly USERNAME: "username";
153
+ readonly SESSION: "session";
154
+ readonly EMAIL: "email";
155
+ };
156
+ type HandleKind = (typeof HANDLE_KIND)[keyof typeof HANDLE_KIND];
157
+ /**
158
+ * Só o que é **exibição** do canal — rótulo, ícone, como reabrir, como mostrar o identificador.
159
+ * Capacidade de **comportamento** (confirma leitura, tem janela e de quantas horas, aceita anexo e
160
+ * áudio, precisa de transporte próprio) não mora mais aqui: para canal que
161
+ * `@adatechnology/conversation-contracts` conhece, ela vem de `channelCapabilityFor` (RF10). Manter
162
+ * os dois tipos de capacidade juntos foi o que criou a "janela" duplicada (`windowHours`) que a
163
+ * spec 211 mandou apagar — a mesma verdade não pode morar em dois lugares.
164
+ */
165
+ type ChannelCapabilities = {
166
+ readonly label: string;
167
+ readonly icon: string;
168
+ readonly reopenMechanism: ReopenMechanism;
169
+ readonly handleKind: HandleKind;
170
+ };
171
+ declare const CHANNEL_CAPABILITIES: Readonly<Record<ConversationChannel, ChannelCapabilities>>;
172
+ declare function capabilitiesOf(channel: ConversationChannel | undefined): ChannelCapabilities;
173
+ declare const CHANNEL_FILTER_ALL = "all";
174
+ type ChannelFilter = ConversationChannel | typeof CHANNEL_FILTER_ALL;
175
+ type ChannelFilterOption = {
176
+ readonly value: ChannelFilter;
177
+ readonly label: string;
178
+ };
179
+ /**
180
+ * Opções derivadas do que existe na lista, não do catálogo inteiro: oferecer Instagram numa conta
181
+ * que só tem WhatsApp promete um recorte que nunca traz resultado.
182
+ *
183
+ * Devolve vazio com menos de dois canais — um filtro de opção única não filtra nada, e a barra só
184
+ * ocuparia espaço. O host usa isso para esconder a seção.
185
+ */
186
+ declare function channelFiltersFor(conversations: readonly {
187
+ readonly channel?: ConversationChannel | undefined;
188
+ }[]): ChannelFilterOption[];
189
+ type FormatContactHandleParams = {
190
+ readonly handle: string;
191
+ readonly channel?: ConversationChannel | undefined;
192
+ };
193
+ /**
194
+ * Exibição do identificador conforme a natureza dele. Formatar tudo como telefone — o que a UI
195
+ * fazia — transforma um `@perfil` do Instagram em dígitos sem sentido.
196
+ */
197
+ declare function formatContactHandle(params: FormatContactHandleParams): string;
198
+ /** Bandeira só faz sentido quando o identificador é telefone. */
199
+ declare function contactFlag(params: FormatContactHandleParams): string;
200
+
122
201
  type ResolveMediaUrl = (message: MessagePayload) => Promise<string | null>;
123
202
  interface MediaRendererProps {
124
203
  message: MessagePayload;
@@ -249,6 +328,12 @@ interface AudioRecorderButtonProps {
249
328
  maxDurationMilliseconds?: number;
250
329
  labels?: Partial<AudioRecorderButtonLabels>;
251
330
  disabled?: boolean;
331
+ /**
332
+ * Por que o microfone está desabilitado (RF10, D3) — o canal atual não grava áudio. Sai como
333
+ * `aria-describedby`, não só `data-cv-tooltip`: o tooltip visual não é lido por leitor de tela
334
+ * sozinho, e uma dica que só aparece no hover falha exatamente para quem mais precisa dela.
335
+ */
336
+ disabledHint?: string;
252
337
  }
253
338
  /**
254
339
  * Cinco minutos: com o codec de voz do WhatsApp isso dá menos de 3MB, folgado dentro do teto de
@@ -256,78 +341,7 @@ interface AudioRecorderButtonProps {
256
341
  * existe porque gravação esquecida aberta só se descobre no envio, com o arquivo inteiro perdido.
257
342
  */
258
343
  declare const DEFAULT_MAX_RECORDING_MILLISECONDS: number;
259
- declare function AudioRecorderButton({ onRecorded, onFailure, onRecordingChange, reviewBeforeSend, maxDurationMilliseconds, labels, disabled, }: AudioRecorderButtonProps): react.JSX.Element;
260
-
261
- /**
262
- * Canal de origem da conversa e o que cada um permite.
263
- *
264
- * Existe porque as regras que a inbox precisa respeitar não são do WhatsApp, são **de cada canal**:
265
- * a janela de sessão, o jeito de reabrir a conversa e o formato do identificador do contato mudam
266
- * entre WhatsApp, Messenger, Instagram e chat de site. Tratar a regra do WhatsApp como universal
267
- * faria a UI bloquear o composer num chat de site, onde janela nenhuma existe.
268
- *
269
- * `whatsapp` é o padrão em todo lugar: instalações que ainda não informam canal continuam
270
- * funcionando exatamente como antes.
271
- */
272
- declare const CONVERSATION_CHANNEL: {
273
- readonly WHATSAPP: "whatsapp";
274
- readonly MESSENGER: "messenger";
275
- readonly INSTAGRAM: "instagram";
276
- readonly WEBCHAT: "webchat";
277
- };
278
- type ConversationChannel = (typeof CONVERSATION_CHANNEL)[keyof typeof CONVERSATION_CHANNEL];
279
- declare const DEFAULT_CONVERSATION_CHANNEL: ConversationChannel;
280
- /** Como o canal reabre uma conversa fora da janela de sessão. */
281
- declare const REOPEN_MECHANISM: {
282
- readonly TEMPLATE: "template";
283
- readonly TAG: "tag";
284
- readonly NONE: "none";
285
- };
286
- type ReopenMechanism = (typeof REOPEN_MECHANISM)[keyof typeof REOPEN_MECHANISM];
287
- /** Natureza do identificador do contato — decide como exibi-lo. */
288
- declare const HANDLE_KIND: {
289
- readonly PHONE: "phone";
290
- readonly USERNAME: "username";
291
- readonly SESSION: "session";
292
- };
293
- type HandleKind = (typeof HANDLE_KIND)[keyof typeof HANDLE_KIND];
294
- type ChannelCapabilities = {
295
- readonly label: string;
296
- readonly icon: string;
297
- readonly hasSessionWindow: boolean;
298
- readonly windowHours: number;
299
- readonly reopenMechanism: ReopenMechanism;
300
- readonly handleKind: HandleKind;
301
- };
302
- declare const CHANNEL_CAPABILITIES: Readonly<Record<ConversationChannel, ChannelCapabilities>>;
303
- declare function capabilitiesOf(channel: ConversationChannel | undefined): ChannelCapabilities;
304
- declare const CHANNEL_FILTER_ALL = "all";
305
- type ChannelFilter = ConversationChannel | typeof CHANNEL_FILTER_ALL;
306
- type ChannelFilterOption = {
307
- readonly value: ChannelFilter;
308
- readonly label: string;
309
- };
310
- /**
311
- * Opções derivadas do que existe na lista, não do catálogo inteiro: oferecer Instagram numa conta
312
- * que só tem WhatsApp promete um recorte que nunca traz resultado.
313
- *
314
- * Devolve vazio com menos de dois canais — um filtro de opção única não filtra nada, e a barra só
315
- * ocuparia espaço. O host usa isso para esconder a seção.
316
- */
317
- declare function channelFiltersFor(conversations: readonly {
318
- readonly channel?: ConversationChannel | undefined;
319
- }[]): ChannelFilterOption[];
320
- type FormatContactHandleParams = {
321
- readonly handle: string;
322
- readonly channel?: ConversationChannel | undefined;
323
- };
324
- /**
325
- * Exibição do identificador conforme a natureza dele. Formatar tudo como telefone — o que a UI
326
- * fazia — transforma um `@perfil` do Instagram em dígitos sem sentido.
327
- */
328
- declare function formatContactHandle(params: FormatContactHandleParams): string;
329
- /** Bandeira só faz sentido quando o identificador é telefone. */
330
- declare function contactFlag(params: FormatContactHandleParams): string;
344
+ declare function AudioRecorderButton({ onRecorded, onFailure, onRecordingChange, reviewBeforeSend, maxDurationMilliseconds, labels, disabled, disabledHint, }: AudioRecorderButtonProps): react.JSX.Element;
331
345
 
332
346
  interface ListConversationsParams {
333
347
  page?: number;
@@ -903,4 +917,4 @@ type ConversationSimulatorPanelProps = Omit<ConversationPreviewProps, 'placehold
903
917
  };
904
918
  declare function ConversationSimulatorPanel({ onClose, channel, displayHandle, displayNumber, labels, headerActions, ...previewProps }: ConversationSimulatorPanelProps): react.JSX.Element;
905
919
 
906
- export { type ListDocumentsParams as $, AudioRecorderButton as A, acceptsMediaKind as B, type ConversationSummary as C, DEFAULT_AUDIO_RECORDER_BUTTON_LABELS as D, assertPreviewEnvironment as E, createPreviewMediaPoster as F, createPreviewMediaUploader as G, createPreviewWebhookClient as H, isConversationSimulatorClient as I, mediaKindOf as J, mediaTypeOf as K, type ListConversationsParams as L, type MessagePayload as M, signPreviewPayload as N, simulatorPanelLabelsOf as O, type PreviewUploadedMedia$1 as P, toConversationSimulatorClient as Q, type ResolveMediaUrl as R, type SSEProvider as S, type ToSimulatorClientParams as T, type InteractiveSelection as U, type MessageTranscription as V, type InteractivePayload as W, type ConversationsFeatures as X, type QuickReply as Y, type ConversationChannel as Z, type TranscriptionMode as _, type ConversationEventSource as a, type ConversationTemplate as a0, type QueuedAttachment as a1, type QuickReplyInput as a2, type QuickReplyAttachment as a3, type ConversationVariable as a4, type ChannelFilter as a5, type ChannelFilterOption as a6, CHANNEL_CAPABILITIES as a7, CHANNEL_FILTER_ALL as a8, CONVERSATION_CHANNEL as a9, type ChannelCapabilities as aa, type CompanyDocument as ab, type CompanyDocumentPage as ac, type ConversationDocumentPage as ad, type ConversationsTheme as ae, type ConversationsUIConfig as af, DEFAULT_CONVERSATION_CHANNEL as ag, DEFAULT_MAX_RECORDING_MILLISECONDS as ah, type FormatContactHandleParams as ai, HANDLE_KIND as aj, type HandleKind as ak, type InteractiveOption as al, type InteractiveSection as am, MediaRenderer as an, type MediaRendererProps as ao, QUICK_REPLY_ATTACHMENT_LIMIT as ap, REOPEN_MECHANISM as aq, type ReopenMechanism as ar, type StoredAttachmentSendResult as as, type TranscriptionStatus as at, capabilitiesOf as au, channelFiltersFor as av, contactFlag as aw, formatContactHandle as ax, type ConversationsApi as b, type ConversationPage as c, type ConversationDocument as d, type SendPreviewMediaParams as e, type PreviewWebhookClient as f, type AudioRecorderButtonLabels as g, type AudioRecorderButtonProps as h, ConversationPreview as i, type ConversationPreviewProps as j, type ConversationSimulatorClient as k, ConversationSimulatorPanel as l, type ConversationSimulatorPanelLabels as m, type ConversationSimulatorPanelProps as n, type CreatePreviewMediaUploaderParams as o, type CreatePreviewWebhookClientParams as p, DEFAULT_CONVERSATION_SIMULATOR_PANEL_LABELS as q, DEFAULT_MEDIA_UPLOAD_PATH as r, PreviewInProductionError as s, PreviewMediaUploadRejectedError as t, type PreviewMediaUploadRequest as u, type PreviewUploadedMedia as v, PreviewWebhookRejectedError as w, SIMULATOR_FILE_MEDIA_KINDS as x, type SendSimulatorMediaParams as y, type SimulatorMediaKind as z };
920
+ export { type ListDocumentsParams as $, AudioRecorderButton as A, acceptsMediaKind as B, type ConversationSummary as C, DEFAULT_AUDIO_RECORDER_BUTTON_LABELS as D, assertPreviewEnvironment as E, createPreviewMediaPoster as F, createPreviewMediaUploader as G, createPreviewWebhookClient as H, isConversationSimulatorClient as I, mediaKindOf as J, mediaTypeOf as K, type ListConversationsParams as L, type MessagePayload as M, signPreviewPayload as N, simulatorPanelLabelsOf as O, type PreviewUploadedMedia$1 as P, toConversationSimulatorClient as Q, type ResolveMediaUrl as R, type SSEProvider as S, type ToSimulatorClientParams as T, type InteractiveSelection as U, type MessageTranscription as V, type ConversationChannel as W, type InteractivePayload as X, type ConversationsFeatures as Y, type QuickReply as Z, type TranscriptionMode as _, type ConversationEventSource as a, type ConversationTemplate as a0, type QueuedAttachment as a1, type QuickReplyInput as a2, type QuickReplyAttachment as a3, type ConversationVariable as a4, type ChannelFilter as a5, type ChannelFilterOption as a6, CHANNEL_CAPABILITIES as a7, CHANNEL_FILTER_ALL as a8, CONVERSATION_CHANNEL as a9, type ChannelCapabilities as aa, type CompanyDocument as ab, type CompanyDocumentPage as ac, type ConversationDocumentPage as ad, type ConversationsTheme as ae, type ConversationsUIConfig as af, DEFAULT_CONVERSATION_CHANNEL as ag, DEFAULT_MAX_RECORDING_MILLISECONDS as ah, type FormatContactHandleParams as ai, HANDLE_KIND as aj, type HandleKind as ak, type InteractiveOption as al, type InteractiveSection as am, MediaRenderer as an, type MediaRendererProps as ao, QUICK_REPLY_ATTACHMENT_LIMIT as ap, REOPEN_MECHANISM as aq, type ReopenMechanism as ar, type StoredAttachmentSendResult as as, type TranscriptionStatus as at, capabilitiesOf as au, channelFiltersFor as av, contactFlag as aw, formatContactHandle as ax, type ConversationsApi as b, type ConversationPage as c, type ConversationDocument as d, type SendPreviewMediaParams as e, type PreviewWebhookClient as f, type AudioRecorderButtonLabels as g, type AudioRecorderButtonProps as h, ConversationPreview as i, type ConversationPreviewProps as j, type ConversationSimulatorClient as k, ConversationSimulatorPanel as l, type ConversationSimulatorPanelLabels as m, type ConversationSimulatorPanelProps as n, type CreatePreviewMediaUploaderParams as o, type CreatePreviewWebhookClientParams as p, DEFAULT_CONVERSATION_SIMULATOR_PANEL_LABELS as q, DEFAULT_MEDIA_UPLOAD_PATH as r, PreviewInProductionError as s, PreviewMediaUploadRejectedError as t, type PreviewMediaUploadRequest as u, type PreviewUploadedMedia as v, PreviewWebhookRejectedError as w, SIMULATOR_FILE_MEDIA_KINDS as x, type SendSimulatorMediaParams as y, type SimulatorMediaKind as z };