@adatechnology/conversations-ui 0.1.0-rc.20 → 0.1.0-rc.22
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-OIDAIVCH.js → chunk-TV4OQRGH.js} +636 -434
- package/dist/index.d.ts +142 -9
- package/dist/index.js +374 -66
- package/dist/preview/index.d.ts +122 -3
- package/dist/preview/index.js +137 -21
- package/dist/styles.css +112 -0
- package/dist/{types-O7kMP1Yn.d.ts → types-C6A_9edv.d.ts} +42 -2
- package/package.json +2 -2
- package/src/AudioTranscription.test.tsx +115 -0
- package/src/AudioTranscription.tsx +249 -0
- package/src/ConversationContextPanel.tsx +205 -52
- package/src/ConversationLocalesProvider.tsx +28 -0
- package/src/MediaRenderer.tsx +37 -6
- package/src/MessageBubble.tsx +26 -3
- package/src/MessageComposer.tsx +21 -2
- package/src/Wallpaper.tsx +27 -13
- package/src/conversationTranscript.test.ts +57 -0
- package/src/conversationTranscript.ts +29 -4
- package/src/hooks/useScrollToLatestMessage.ts +127 -0
- package/src/index.ts +11 -0
- package/src/preview/ConversationPreview.tsx +13 -4
- package/src/preview/ConversationSimulatorPanel.test.tsx +55 -0
- package/src/preview/ConversationSimulatorPanel.tsx +89 -0
- package/src/preview/createPreviewBridgeClient.ts +37 -1
- package/src/preview/createPreviewMediaUploader.ts +82 -0
- package/src/preview/createPreviewWebhookClient.test.ts +89 -0
- package/src/preview/createPreviewWebhookClient.ts +91 -0
- package/src/preview/index.ts +9 -0
- package/src/preview/previewMediaUploader.test.ts +61 -0
- package/src/providers/types.ts +12 -1
- package/src/settings/TranscriptionSettingsForm.test.tsx +81 -0
- package/src/settings/TranscriptionSettingsForm.tsx +189 -0
- package/src/styles.css +122 -0
- package/src/types.ts +26 -0
package/src/styles.css
CHANGED
|
@@ -155,3 +155,125 @@
|
|
|
155
155
|
max-width: calc(100vw - 1.5rem);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Scrollbar fina — paridade com `.scrollbar-thin` de
|
|
161
|
+
* financiamento-imobiliario-bot/apps/web/src/index.css.
|
|
162
|
+
*
|
|
163
|
+
* Prefixo `cv-` porque o host pode ter a própria `.scrollbar-thin` (plugin do Tailwind ou CSS
|
|
164
|
+
* próprio): colidir no nome faria o painel herdar regra alheia sem ninguém entender por quê.
|
|
165
|
+
*
|
|
166
|
+
* Usada onde a área rola dentro de um bloco de altura limitada, como o grid de "Suas Seleções":
|
|
167
|
+
* a barra padrão do sistema ocupa ~15px e, num card de 3 colunas, come uma coluna inteira.
|
|
168
|
+
*/
|
|
169
|
+
.cv-scrollbar-thin {
|
|
170
|
+
scrollbar-width: thin;
|
|
171
|
+
scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
|
|
172
|
+
}
|
|
173
|
+
.cv-scrollbar-thin::-webkit-scrollbar { width: 4px; height: 4px; }
|
|
174
|
+
.cv-scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
|
|
175
|
+
.cv-scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 2px; }
|
|
176
|
+
.cv-scrollbar-thin::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }
|
|
177
|
+
.dark .cv-scrollbar-thin { scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
|
|
178
|
+
.dark .cv-scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); }
|
|
179
|
+
.dark .cv-scrollbar-thin::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Mãozinha no que é clicável.
|
|
183
|
+
*
|
|
184
|
+
* O Preflight do Tailwind v3 punha `cursor: pointer` em `button`; o v4 removeu, e sem regra
|
|
185
|
+
* explícita o botão herda o `cursor: default` do browser — os componentes deste pacote deixam de
|
|
186
|
+
* parecer clicáveis num host v4. São 91 botões aqui: carimbar a classe em cada um seria ruído que o
|
|
187
|
+
* próximo componente esqueceria de repetir.
|
|
188
|
+
*
|
|
189
|
+
* `:where()` zera a especificidade de propósito: a regra vence o UA stylesheet (autor sempre vence)
|
|
190
|
+
* mas perde de qualquer regra do host, então quem quiser outro cursor não precisa de `!important`.
|
|
191
|
+
*/
|
|
192
|
+
:where(button:not(:disabled), [role='button']:not(:disabled), summary) {
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Simulador de cliente. Largura fixa porque é painel auxiliar: a thread ao lado é que deve
|
|
198
|
+
* ganhar o espaço restante quando a janela encolhe.
|
|
199
|
+
*/
|
|
200
|
+
.cv-simulator-panel {
|
|
201
|
+
display: flex;
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
width: 24rem;
|
|
204
|
+
flex-shrink: 0;
|
|
205
|
+
border-left: 1px solid rgb(229 231 235);
|
|
206
|
+
background: #fff;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.cv-simulator-panel__header {
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
justify-content: space-between;
|
|
213
|
+
gap: 0.5rem;
|
|
214
|
+
padding: 0.75rem 1rem;
|
|
215
|
+
border-bottom: 1px solid rgb(229 231 235);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.cv-simulator-panel__heading { min-width: 0; }
|
|
219
|
+
|
|
220
|
+
.cv-simulator-panel__title {
|
|
221
|
+
font-size: 0.875rem;
|
|
222
|
+
font-weight: 600;
|
|
223
|
+
color: rgb(17 24 39);
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
text-overflow: ellipsis;
|
|
226
|
+
white-space: nowrap;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.cv-simulator-panel__subtitle {
|
|
230
|
+
font-size: 0.75rem;
|
|
231
|
+
color: rgb(156 163 175);
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
text-overflow: ellipsis;
|
|
234
|
+
white-space: nowrap;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.cv-simulator-panel__actions {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
gap: 0.25rem;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.cv-simulator-panel__close {
|
|
244
|
+
display: inline-flex;
|
|
245
|
+
padding: 0.375rem;
|
|
246
|
+
border: 0;
|
|
247
|
+
border-radius: 0.5rem;
|
|
248
|
+
background: transparent;
|
|
249
|
+
color: rgb(156 163 175);
|
|
250
|
+
transition: color 150ms, background-color 150ms;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.cv-simulator-panel__close:hover {
|
|
254
|
+
color: rgb(55 65 81);
|
|
255
|
+
background: rgb(243 244 246);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* `min-height: 0` para o transcript rolar dentro do painel em vez de esticar o `<aside>`. */
|
|
259
|
+
.cv-simulator-panel__body { flex: 1; min-height: 0; }
|
|
260
|
+
|
|
261
|
+
.dark .cv-simulator-panel {
|
|
262
|
+
border-left-color: rgb(31 41 55);
|
|
263
|
+
background: rgb(17 24 39);
|
|
264
|
+
}
|
|
265
|
+
.dark .cv-simulator-panel__header { border-bottom-color: rgb(31 41 55); }
|
|
266
|
+
.dark .cv-simulator-panel__title { color: rgb(243 244 246); }
|
|
267
|
+
.dark .cv-simulator-panel__subtitle { color: rgb(107 114 128); }
|
|
268
|
+
.dark .cv-simulator-panel__close:hover { color: rgb(229 231 235); background: rgb(31 41 55); }
|
|
269
|
+
|
|
270
|
+
/* Painel auxiliar não cabe ao lado da thread em tela estreita: vira sobreposição de tela cheia. */
|
|
271
|
+
@media (max-width: 1023px) {
|
|
272
|
+
.cv-simulator-panel {
|
|
273
|
+
position: fixed;
|
|
274
|
+
inset: 0;
|
|
275
|
+
width: 100%;
|
|
276
|
+
z-index: 40;
|
|
277
|
+
border-left: 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -84,6 +84,32 @@ export interface MessagePayload {
|
|
|
84
84
|
* diferente de avaliado e limpo.
|
|
85
85
|
*/
|
|
86
86
|
moderation?: { isOffensive: boolean; terms: string[] } | null
|
|
87
|
+
/**
|
|
88
|
+
* Transcrição do áudio, vinda do backend — a UI só exibe, nunca transcreve. Rodar STT no browser
|
|
89
|
+
* exigiria baixar modelo por aba e daria resultado diferente por versão de cliente.
|
|
90
|
+
*
|
|
91
|
+
* `null`/ausente = não avaliado, que é diferente de `'done'` com texto vazio (áudio em silêncio,
|
|
92
|
+
* já processado). É essa distinção que decide se o balão oferece "transcrever" ou "sem fala
|
|
93
|
+
* detectada".
|
|
94
|
+
*/
|
|
95
|
+
transcription?: MessageTranscription | null
|
|
87
96
|
isFirstInGroup?: boolean
|
|
88
97
|
isLastInGroup?: boolean
|
|
89
98
|
}
|
|
99
|
+
|
|
100
|
+
export type TranscriptionStatus = 'pending' | 'done' | 'failed' | 'unsupported'
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Quando transcrever, escolhido nas configurações da empresa. Espelha o
|
|
104
|
+
* `TranscriptionMode` de `@adatechnology/meta-whatsapp-contracts`; declarado aqui para o pacote de
|
|
105
|
+
* UI não obrigar quem só desenha telas a instalar os contratos do backend.
|
|
106
|
+
*/
|
|
107
|
+
export type TranscriptionMode = 'auto' | 'onDemand'
|
|
108
|
+
|
|
109
|
+
export interface MessageTranscription {
|
|
110
|
+
status: TranscriptionStatus
|
|
111
|
+
text?: string | null
|
|
112
|
+
/** ISO 639-1 ou nome do idioma, conforme o engine. Exibido como dica, não interpretado. */
|
|
113
|
+
language?: string | null
|
|
114
|
+
engine?: string | null
|
|
115
|
+
}
|