@adatechnology/conversations-ui 0.1.0-rc.23 → 0.1.0-rc.25

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.
@@ -69,6 +69,7 @@ declare function slugifyNodeId(label: string, existing: Set<string>): string;
69
69
  interface FlowEditorLabels {
70
70
  legend: Record<FlowNodeType, string>;
71
71
  startNodeTooltip: string;
72
+ detachedNodeTooltip: string;
72
73
  liveCountTooltip: (count: number) => string;
73
74
  edgeFallbackLabel: string;
74
75
  actionKindLabels: Record<string, string>;
@@ -77,6 +78,9 @@ interface FlowEditorLabels {
77
78
  nodePanel: {
78
79
  title: string;
79
80
  contextKey: string;
81
+ nodeName: string;
82
+ nodeNamePlaceholder: string;
83
+ nodeNameHint: string;
80
84
  questionType: string;
81
85
  question: string;
82
86
  options: string;
@@ -125,6 +129,8 @@ interface FlowEditorLabels {
125
129
  flowMap: {
126
130
  nodeCount: (count: number) => string;
127
131
  openFlow: string;
132
+ toggleToMap: string;
133
+ toggleToDetail: string;
128
134
  };
129
135
  flowGroup: {
130
136
  focus: string;
@@ -134,6 +140,66 @@ interface FlowEditorLabels {
134
140
  tooltip: string;
135
141
  goesTo: (label: string) => string;
136
142
  };
143
+ collectionChain: {
144
+ feeds: (label: string) => string;
145
+ };
146
+ /**
147
+ * Texto dos problemas encontrados por `validateGraph`. Vive aqui, e não no host, porque a tela
148
+ * composta é quem valida — deixar de fora obrigaria todo produto a repassar o mesmo mapa de
149
+ * funções só para a barra de erros aparecer.
150
+ */
151
+ validation: FlowValidationLabels;
152
+ /** Barra de cima, estados de carregamento e ações do editor inteiro. */
153
+ workspace: {
154
+ title: string;
155
+ subtitle: string;
156
+ loading: string;
157
+ loadError: string;
158
+ saveGraph: string;
159
+ saving: string;
160
+ saveSuccess: string;
161
+ saveError: string;
162
+ organize: string;
163
+ organizeTooltip: string;
164
+ discardChanges: string;
165
+ discardTooltip: string;
166
+ discardConfirm: string;
167
+ unsavedChangesConfirm: string;
168
+ };
169
+ flowManager: {
170
+ newFlow: string;
171
+ createTitle: string;
172
+ key: string;
173
+ keyHint: string;
174
+ keyInvalid: string;
175
+ label: string;
176
+ showInMenu: string;
177
+ menuOptionLabel: string;
178
+ create: string;
179
+ creating: string;
180
+ deleteFlow: string;
181
+ deleteConfirm: (label: string) => string;
182
+ createError: string;
183
+ deleteError: string;
184
+ };
185
+ }
186
+ interface FlowValidationLabels {
187
+ title: string;
188
+ errors: (count: number) => string;
189
+ warnings: (count: number) => string;
190
+ noStart: string;
191
+ brokenRef: (from: string, to: string) => string;
192
+ choiceWithoutOptions: (id: string) => string;
193
+ duplicatedOptionId: (id: string, optionId: string) => string;
194
+ optionWithoutTarget: (id: string, optionLabel: string) => string;
195
+ tooManyOptions: (id: string, count: number) => string;
196
+ buttonTitleTooLong: (id: string, label: string) => string;
197
+ listTitleTooLong: (id: string, label: string) => string;
198
+ bodyTooLong: (id: string) => string;
199
+ unreachable: (id: string) => string;
200
+ deadEndQuestion: (id: string) => string;
201
+ conditionIncomplete: (id: string) => string;
202
+ conditionBranchMissing: (id: string, branch: string) => string;
137
203
  }
138
204
  declare const DEFAULT_FLOW_EDITOR_LABELS: FlowEditorLabels;
139
205
  declare function mergeFlowEditorLabels(override?: Partial<FlowEditorLabels>): FlowEditorLabels;
@@ -144,6 +210,12 @@ type FlowNodeCardData = {
144
210
  liveCount: number;
145
211
  isStart: boolean;
146
212
  isSelected: boolean;
213
+ /**
214
+ * Nó sem nenhuma ligação de entrada — o bot nunca chega nele. Contorno tracejado e pulso: sem
215
+ * isso, desconectar um fio ou criar um card solto passa despercebido até o fluxo quebrar em
216
+ * produção.
217
+ */
218
+ isDetached?: boolean;
147
219
  issues: GraphIssue[];
148
220
  labels: FlowEditorLabels;
149
221
  actionKindIcons?: Record<string, LucideIcon>;
@@ -244,7 +316,7 @@ interface FlowNodePanelProps {
244
316
  * URL assinada são dele, e o painel não tem como buscar nada. Ausente, o nó continua editável —
245
317
  * só não dá para anexar por aqui.
246
318
  */
247
- renderMediaPicker?: (node: FlowNodeData) => ReactNode;
319
+ renderMediaPicker?: (node: FlowNodeData, graph: FlowGraphData) => ReactNode;
248
320
  }
249
321
  declare function FlowNodePanel({ graph, node, issues, otherFlows, onClose, onChange, onDelete, labels: labelsOverride, renderMediaPicker, }: FlowNodePanelProps): react.JSX.Element;
250
322
 
@@ -255,4 +327,58 @@ interface FlowWhatsAppPreviewProps {
255
327
  }
256
328
  declare function FlowWhatsAppPreview({ body, options, labels, }: FlowWhatsAppPreviewProps): react.JSX.Element;
257
329
 
258
- export { BUILT_IN_ACTION_KINDS, CONDITION_OPERATORS, CROSS_FLOW_PREFIX, type CollectionChain, DEFAULT_FLOW_EDITOR_LABELS, type FlowEditorLabels, FlowGroupFrame, type FlowGroupFrameData, FlowGroupHeader, type FlowGroupHeaderData, FlowMapCanvas, type FlowMapCanvasProps, FlowMapNode, type FlowMapNodeData, FlowNodeCard, type FlowNodeCardData, FlowNodePanel, type FlowNodePanelProps, FlowPalette, type FlowPaletteActionOption, type FlowPaletteProps, FlowPortalNode, type FlowPortalNodeData, FlowWhatsAppPreview, type FlowWhatsAppPreviewProps, type GraphIssue, NODE_CARD_WIDTH, type NewNodeSpec, WHATSAPP_LIMITS, computeAutoLayout, computeFlowMapLayout, crossFlowKey, crossFlowTargetsOf, estimateNodeHeight, findCollectionChains, flowGroupFrameNodeTypes, flowGroupHeaderNodeTypes, flowMapNodeTypes, flowNodeTypes, flowPortalNodeTypes, isCrossFlowTarget, mergeFlowEditorLabels, nodeLabel, rendersAsButtons, slugifyNodeId, targetsOf, validateGraph };
330
+ /** Onde cada conversa viva está parada agora, para o card pulsar com a contagem. */
331
+ interface FlowLivePosition {
332
+ currentState: string;
333
+ flow: string | null;
334
+ nodeId: string | null;
335
+ menuNodeId: string | null;
336
+ }
337
+ interface CreateFlowInput {
338
+ key: string;
339
+ label: string;
340
+ showInMenu: boolean;
341
+ /** Ausente quando `showInMenu` é falso — não há opção de menu para rotular. */
342
+ menuOptionLabel?: string;
343
+ }
344
+ /**
345
+ * Backend de fluxos do host. Funções cruas em vez de um cliente HTTP: o pacote roda em produtos com
346
+ * axios, fetch e react-query, e nenhum deles precisa entrar como dependência daqui.
347
+ */
348
+ interface FlowsWorkspaceApi {
349
+ getGraphs(): Promise<Record<string, FlowGraphData>>;
350
+ saveGraph(key: string, graph: FlowGraphData): Promise<void>;
351
+ /**
352
+ * Criar e excluir fluxo são **opcionais por capacidade**: produto cujos fluxos vêm de um seed
353
+ * versionado não expõe rota para isso, e a tela simplesmente não desenha os botões — em vez de
354
+ * oferecer uma ação que estoura no clique.
355
+ */
356
+ createFlow?(input: CreateFlowInput): Promise<void>;
357
+ deleteFlow?(key: string): Promise<void>;
358
+ /** Contagem de conversas vivas por nó. Ausente, os cards não pulsam e nada é consultado. */
359
+ getLivePositions?(): Promise<FlowLivePosition[]>;
360
+ }
361
+ interface FlowsWorkspaceProps {
362
+ readonly api: FlowsWorkspaceApi;
363
+ /** Fluxo raiz — o que abre por padrão e o único que não pode ser excluído. */
364
+ readonly rootFlowKey?: string;
365
+ readonly labels?: Partial<FlowEditorLabels>;
366
+ /** Kinds de ação do produto oferecidos na paleta (`trigger_simulation`, `abrir_comanda`…). */
367
+ readonly actionOptions?: readonly FlowPaletteActionOption[];
368
+ /** Seletor de arquivos do nó `send_media` — a biblioteca é do host, então entra por slot. */
369
+ readonly renderMediaPicker?: (node: FlowNodeData) => ReactNode;
370
+ /** Intervalo do polling de posições vivas. Só tem efeito com `getLivePositions`. */
371
+ readonly livePollIntervalMs?: number;
372
+ readonly className?: string;
373
+ }
374
+ /**
375
+ * Editor de fluxograma completo — barra de ações, abas de fluxo, paleta, canvas com fusão
376
+ * editável, painel de nó, mapa de fluxos e diálogos de criar/excluir.
377
+ *
378
+ * É a tela inteira, não as peças: cada produto que remontava esse grid à mão acabava com uma
379
+ * versão diferente do mesmo editor. Customização entra por `labels`, `actionOptions` e
380
+ * `renderMediaPicker` — nunca por cópia do arquivo.
381
+ */
382
+ declare function FlowsWorkspace({ api, rootFlowKey, labels: labelsOverride, actionOptions, renderMediaPicker, livePollIntervalMs, className, }: FlowsWorkspaceProps): react.JSX.Element;
383
+
384
+ export { BUILT_IN_ACTION_KINDS, CONDITION_OPERATORS, CROSS_FLOW_PREFIX, type CollectionChain, type CreateFlowInput, DEFAULT_FLOW_EDITOR_LABELS, type FlowEditorLabels, FlowGroupFrame, type FlowGroupFrameData, FlowGroupHeader, type FlowGroupHeaderData, type FlowLivePosition, FlowMapCanvas, type FlowMapCanvasProps, FlowMapNode, type FlowMapNodeData, FlowNodeCard, type FlowNodeCardData, FlowNodePanel, type FlowNodePanelProps, FlowPalette, type FlowPaletteActionOption, type FlowPaletteProps, FlowPortalNode, type FlowPortalNodeData, type FlowValidationLabels, FlowWhatsAppPreview, type FlowWhatsAppPreviewProps, FlowsWorkspace, type FlowsWorkspaceApi, type FlowsWorkspaceProps, type GraphIssue, NODE_CARD_WIDTH, type NewNodeSpec, WHATSAPP_LIMITS, computeAutoLayout, computeFlowMapLayout, crossFlowKey, crossFlowTargetsOf, estimateNodeHeight, findCollectionChains, flowGroupFrameNodeTypes, flowGroupHeaderNodeTypes, flowMapNodeTypes, flowNodeTypes, flowPortalNodeTypes, isCrossFlowTarget, mergeFlowEditorLabels, nodeLabel, rendersAsButtons, slugifyNodeId, targetsOf, validateGraph };