@adatechnology/conversations-ui 0.15.0 → 0.16.0

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.
@@ -435,7 +435,9 @@ type SendPreviewMediaParams = {
435
435
  type CreatePreviewWebhookClientParams = {
436
436
  readonly webhookUrl: string;
437
437
  readonly appSecret: string;
438
+ /** Usado como veio. Para contato de simulador, ver `createPreviewBridgeClient` (`from` + `features.previewContacts`). */
438
439
  readonly from: string;
440
+ /** O `phone_number_id` do host. Sem ele o webhook descarta a entrega no filtro de número. */
439
441
  readonly phoneNumberId?: string;
440
442
  /**
441
443
  * Rota que guarda o áudio gravado. Por padrão, `/v1/preview/media` na mesma origem do webhook.
@@ -636,4 +638,4 @@ type ConversationSimulatorPanelProps = Omit<ConversationPreviewProps, 'placehold
636
638
  };
637
639
  declare function ConversationSimulatorPanel({ onClose, channel, displayHandle, displayNumber, labels, headerActions, ...previewProps }: ConversationSimulatorPanelProps): react.JSX.Element;
638
640
 
639
- export { 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, signPreviewPayload as M, simulatorPanelLabelsOf as N, toConversationSimulatorClient as O, type PreviewUploadedMedia$1 as P, type ListDocumentsParams as Q, type ResolveMediaUrl as R, type SSEProvider as S, type ToSimulatorClientParams as T, type ConversationTemplate as U, type CompanyDocument as V, type CompanyDocumentPage as W, type ConversationDocumentPage as X, MediaRenderer as Y, type MediaRendererProps as Z, type ConversationEventSource as a, 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 };
641
+ export { 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, signPreviewPayload as M, simulatorPanelLabelsOf as N, toConversationSimulatorClient as O, type PreviewUploadedMedia$1 as P, type ListDocumentsParams as Q, type ResolveMediaUrl as R, type SSEProvider as S, type ToSimulatorClientParams as T, type ConversationTemplate as U, type CompanyDocument as V, type CompanyDocumentPage as W, type ConversationDocumentPage as X, MediaRenderer as Y, type MediaRendererProps as Z, type ConversationEventSource as a, type ConversationsApi as b, type ConversationPage as c, type ConversationDocument as d, type PreviewWebhookClient as e, type AudioRecorderButtonLabels as f, type AudioRecorderButtonProps as g, ConversationPreview as h, type ConversationPreviewProps as i, type ConversationSimulatorClient as j, ConversationSimulatorPanel as k, type ConversationSimulatorPanelLabels as l, type ConversationSimulatorPanelProps as m, type CreatePreviewMediaUploaderParams as n, type CreatePreviewWebhookClientParams as o, DEFAULT_CONVERSATION_SIMULATOR_PANEL_LABELS as p, DEFAULT_MEDIA_UPLOAD_PATH as q, PreviewInProductionError as r, PreviewMediaUploadRejectedError as s, type PreviewMediaUploadRequest as t, type PreviewUploadedMedia as u, PreviewWebhookRejectedError as v, SIMULATOR_FILE_MEDIA_KINDS as w, type SendPreviewMediaParams as x, type SendSimulatorMediaParams as y, type SimulatorMediaKind as z };
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { NodeProps, EdgeProps } from '@xyflow/react';
4
4
  import { LucideIcon } from 'lucide-react';
5
- import { FlowConditionOperator, FlowGraphData, FlowNodeData, FlowNodeType, FlowQuestionType, FlowActionKind } from '@adatechnology/meta-whatsapp-contracts';
5
+ import { FlowConditionOperator, FlowGraphData, FlowNodeData, FlowOptionDetail, FlowNodeType, FlowQuestionType, FlowActionKind } from '@adatechnology/meta-whatsapp-contracts';
6
6
  export { FlowActionKind, FlowConditionOperator, FlowGraphData, FlowNodeData, FlowNodeNext, FlowNodeType, FlowQuestionType } from '@adatechnology/meta-whatsapp-contracts';
7
7
 
8
8
  declare const CONDITION_OPERATORS: FlowConditionOperator[];
@@ -26,17 +26,29 @@ declare const isCrossFlowTarget: (target: string) => boolean;
26
26
  declare const crossFlowKey: (target: string) => string;
27
27
  declare const NODE_CARD_WIDTH = 240;
28
28
  declare function estimateNodeHeight(node: FlowNodeData): number;
29
+ /**
30
+ * Limites da Meta, lidos do contrato (`WHATSAPP_CHOICE_LIMIT`) — o mesmo número que o módulo usa
31
+ * para recusar a mensagem. Antes eram uma cópia local, e duas cópias divergem sem nada acusar.
32
+ * Nome mantido para não quebrar quem já importa.
33
+ */
29
34
  declare const WHATSAPP_LIMITS: {
30
35
  readonly MAX_BUTTONS: 3;
31
36
  readonly MAX_LIST_ROWS: 10;
32
37
  readonly BUTTON_TITLE_MAX: 20;
33
38
  readonly LIST_ROW_TITLE_MAX: 24;
39
+ readonly LIST_ROW_DESCRIPTION_MAX: 72;
40
+ readonly LIST_SECTION_TITLE_MAX: 24;
34
41
  readonly BODY_MAX: 1024;
35
42
  };
36
- declare function rendersAsButtons(options: [string, string][] | undefined): boolean;
43
+ /**
44
+ * Botão com até 3 opções simples; opção com descrição ou seção força lista — é a mesma regra do
45
+ * runner do módulo, para a prévia mostrar o que o cliente vai ver.
46
+ */
47
+ declare function rendersAsButtons(options: [string, string][] | undefined, optionDetails?: Record<string, FlowOptionDetail>): boolean;
37
48
  declare function targetsOf(node: FlowNodeData): {
38
49
  target: string;
39
50
  optionId?: string;
51
+ keyword?: string;
40
52
  isDefault?: boolean;
41
53
  }[];
42
54
  type GraphIssue = {
@@ -58,6 +70,9 @@ declare function validateGraph(graph: FlowGraphData, issueText: {
58
70
  deadEndQuestion: (id: string) => string;
59
71
  conditionIncomplete: (id: string) => string;
60
72
  conditionBranchMissing: (id: string, branch: string) => string;
73
+ descriptionTooLong?: (id: string, label: string) => string;
74
+ dynamicChoiceWithoutProvider?: (id: string) => string;
75
+ choiceDefaultIgnored?: (id: string) => string;
61
76
  }): GraphIssue[];
62
77
  /**
63
78
  * Auto-layout em cascata: avança para a direita a cada passo do fluxo e desce a cada card.
@@ -84,8 +99,49 @@ type CollectionChain = {
84
99
  declare function findCollectionChains(graph: FlowGraphData): CollectionChain[];
85
100
  declare function slugifyNodeId(label: string, existing: ReadonlySet<string>): string;
86
101
 
102
+ /** Campos do runner de fluxo do módulo (validação, palavras-chave, descrições, escolha dinâmica). */
103
+ interface FlowRunnerFieldLabels {
104
+ section: string;
105
+ fallbackMessage: string;
106
+ fallbackPlaceholder: string;
107
+ maxInvalidAnswers: string;
108
+ maxInvalidAnswersHint: string;
109
+ minDateToday: string;
110
+ afterContextKey: string;
111
+ minValue: string;
112
+ maxValue: string;
113
+ minLength: string;
114
+ maxLength: string;
115
+ skipKeywords: string;
116
+ skipKeywordsHint: string;
117
+ keywordRoutes: string;
118
+ keywordRoutesHint: string;
119
+ addKeywordRoute: string;
120
+ removeKeywordRoute: string;
121
+ keywordPlaceholder: string;
122
+ optionDescription: string;
123
+ optionSection: string;
124
+ listButtonLabel: string;
125
+ unmatchedChoice: string;
126
+ unmatchedChoiceReask: string;
127
+ unmatchedChoiceDefault: string;
128
+ choiceProvider: string;
129
+ choiceProviderHint: string;
130
+ contextKey: string;
131
+ placeholdersHint: string;
132
+ paletteDynamicChoice: string;
133
+ paletteDynamicChoiceHint: string;
134
+ paletteMessage: string;
135
+ paletteMessageHint: string;
136
+ }
87
137
  interface FlowEditorLabels {
88
- legend: Record<FlowNodeType, string>;
138
+ /**
139
+ * `dynamic_choice` é opcional para não quebrar quem já monta a legenda inteira à mão; ausente, vale
140
+ * o texto padrão.
141
+ */
142
+ legend: Record<Exclude<FlowNodeType, 'dynamic_choice'>, string> & {
143
+ dynamic_choice?: string;
144
+ };
89
145
  startNodeTooltip: string;
90
146
  detachedNodeTooltip: string;
91
147
  liveCountTooltip: (count: number) => string;
@@ -93,6 +149,8 @@ interface FlowEditorLabels {
93
149
  actionKindLabels: Record<string, string>;
94
150
  conditionOperatorLabels: Record<FlowConditionOperator, string>;
95
151
  questionTypeLabels: Record<FlowQuestionType, string>;
152
+ /** Opcional para não quebrar quem monta os textos à mão; ausente, vale o padrão pt-BR. */
153
+ runnerFields?: FlowRunnerFieldLabels;
96
154
  nodePanel: {
97
155
  title: string;
98
156
  contextKey: string;
@@ -239,6 +297,9 @@ interface FlowValidationLabels {
239
297
  deadEndQuestion: (id: string) => string;
240
298
  conditionIncomplete: (id: string) => string;
241
299
  conditionBranchMissing: (id: string, branch: string) => string;
300
+ descriptionTooLong?: (id: string, label: string) => string;
301
+ dynamicChoiceWithoutProvider?: (id: string) => string;
302
+ choiceDefaultIgnored?: (id: string) => string;
242
303
  }
243
304
  declare const DEFAULT_FLOW_EDITOR_LABELS: FlowEditorLabels;
244
305
  declare function mergeFlowEditorLabels(override?: Partial<FlowEditorLabels>): FlowEditorLabels;
@@ -333,6 +394,10 @@ type NewNodeSpec = {
333
394
  kind: 'decision';
334
395
  } | {
335
396
  kind: 'condition';
397
+ } | {
398
+ kind: 'dynamicChoice';
399
+ } | {
400
+ kind: 'message';
336
401
  } | {
337
402
  kind: 'action';
338
403
  actionKind: FlowActionKind;
@@ -407,9 +472,11 @@ declare function FlowNodePanel({ graph, node, issues, otherFlows, onClose, onCha
407
472
  interface FlowWhatsAppPreviewProps {
408
473
  body: string;
409
474
  options?: [string, string][];
475
+ /** Descrição e seção por id de opção — com qualquer uma, a mensagem sai como lista. */
476
+ optionDetails?: Record<string, FlowOptionDetail>;
410
477
  labels?: FlowEditorLabels['nodePanel'];
411
478
  }
412
- declare function FlowWhatsAppPreview({ body, options, labels, }: FlowWhatsAppPreviewProps): react.JSX.Element;
479
+ declare function FlowWhatsAppPreview({ body, options, optionDetails, labels, }: FlowWhatsAppPreviewProps): react.JSX.Element;
413
480
 
414
481
  /**
415
482
  * Derivações puras do canvas do editor: posições, arestas, contagem de conversas vivas e o nó que