@accurix/centrinfo-widget 1.0.0 → 1.1.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.
@@ -0,0 +1 @@
1
+ const e=require(`./config-BfVMFkZ4.cjs`),t=t=>t.demo?new e.v:t.preview?new e._(new e.y(t.apiBaseUrl,t.token,t.gifApiKey,t.analyticsContextToken,{agentName:t.agentName,agentAvatarUrl:t.agentAvatarUrl},t.identityToken,t.getIdentityToken,t.chatSurface),t.strings):new e.y(t.apiBaseUrl,t.token,t.gifApiKey,t.analyticsContextToken,{agentName:t.agentName,agentAvatarUrl:t.agentAvatarUrl},t.identityToken,t.getIdentityToken,t.chatSurface);exports.ResultTable=e.u,exports.WidgetAnalyticsChart=e.p,exports.buildWidgetAnalyticsChartModel=e.m,exports.createChatTransport=t,exports.formatResultCell=e.d,exports.renderRich=e.a,exports.resolveConfig=e.t,exports.serializeResultCsv=e.f,exports.useChat=e.n;
@@ -0,0 +1,249 @@
1
+ import { a as Visitor, c as WidgetThemeTokens, d as ActionType, f as AnalyticsVisualization, g as WidgetStrings, h as Transport, i as Source, l as WidgetUser, m as GifResult, n as ChatMessage, o as WidgetConfig, p as DemoSlotsResult, r as FeaturedLink, t as BootstrapInfo, u as ActionResult } from "./types-CiW6Ilds.cjs";
2
+ import * as preact0 from "preact";
3
+ import { JSX } from "preact";
4
+
5
+ //#region src/config.d.ts
6
+ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'user' | 'analyticsContextToken' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onAction' | 'onHandoff'>> {
7
+ accentColor?: string;
8
+ agentName?: string;
9
+ agentAvatarUrl?: string;
10
+ launcherIcon?: string;
11
+ themeTokens?: WidgetConfig['themeTokens'];
12
+ gifApiKey?: string;
13
+ /** Resolved string table (English defaults + host `labels` overrides). */
14
+ strings: WidgetStrings;
15
+ /** Host-app SSO passthrough (see WidgetConfig.user). Optional. */
16
+ user?: WidgetConfig['user'];
17
+ /** Short-lived signed context for governed customer analytics. */
18
+ analyticsContextToken?: WidgetConfig['analyticsContextToken'];
19
+ identityToken?: WidgetConfig['identityToken'];
20
+ getIdentityToken?: WidgetConfig['getIdentityToken'];
21
+ customLauncherSelector?: string;
22
+ proactiveMessage?: string;
23
+ proactiveOnPaths?: string[];
24
+ onOpen?: WidgetConfig['onOpen'];
25
+ onClose?: WidgetConfig['onClose'];
26
+ onShow?: WidgetConfig['onShow'];
27
+ onHide?: WidgetConfig['onHide'];
28
+ onUnreadChange?: WidgetConfig['onUnreadChange'];
29
+ onMessage?: WidgetConfig['onMessage'];
30
+ onAction?: WidgetConfig['onAction'];
31
+ onHandoff?: WidgetConfig['onHandoff'];
32
+ }
33
+ declare const resolveConfig: (cfg: WidgetConfig) => ResolvedConfig;
34
+ //#endregion
35
+ //#region ../centrinfo-results/src/types.d.ts
36
+ interface AnalyticsVisualizationColumn {
37
+ key: string;
38
+ label: string;
39
+ dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
40
+ semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
41
+ aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
42
+ formatPattern?: string;
43
+ currencyCode?: string;
44
+ description?: string;
45
+ priority?: 'primary' | 'secondary' | 'detail';
46
+ sortable?: boolean;
47
+ filterable?: boolean;
48
+ groupable?: boolean;
49
+ }
50
+ interface AnalyticsVisualizationRecommendation {
51
+ type: 'kpi' | 'table' | 'line' | 'area' | 'bar' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel';
52
+ mode: string;
53
+ categoryField?: string;
54
+ valueFields?: string[];
55
+ seriesField?: string;
56
+ reason?: string;
57
+ confidence?: number;
58
+ }
59
+ interface AnalyticsVisualization$1 {
60
+ version?: number;
61
+ presentation?: 'kpi' | 'chart' | 'table';
62
+ type: 'kpi' | 'table' | 'bar' | 'line' | 'area' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel';
63
+ title?: string;
64
+ label?: string;
65
+ value?: string;
66
+ valueFields?: string[];
67
+ series?: string;
68
+ seriesField?: string;
69
+ columns?: string[];
70
+ rows?: Array<Record<string, unknown>>;
71
+ rowCount?: number;
72
+ timezone?: string;
73
+ columnMetadata?: AnalyticsVisualizationColumn[];
74
+ currency?: {
75
+ code?: string;
76
+ field?: string;
77
+ source?: 'fixed_metadata' | 'source_field';
78
+ isMixed: boolean;
79
+ };
80
+ chartRecommendation?: AnalyticsVisualizationRecommendation;
81
+ }
82
+ interface ResultColumn {
83
+ key: string;
84
+ label?: string;
85
+ dataType?: AnalyticsVisualizationColumn['dataType'];
86
+ currencyCode?: string;
87
+ }
88
+ interface ResultTableClassNames {
89
+ wrap?: string;
90
+ table?: string;
91
+ note?: string;
92
+ }
93
+ //#endregion
94
+ //#region ../centrinfo-results/src/chart.d.ts
95
+ type WidgetAnalyticsSeries = {
96
+ field: string;
97
+ name: string;
98
+ values: Array<number | null>;
99
+ valueColumn?: AnalyticsVisualizationColumn;
100
+ };
101
+ type WidgetAnalyticsChartType = 'line' | 'bar' | 'stacked_bar';
102
+ type WidgetAnalyticsChartModel = {
103
+ type: WidgetAnalyticsChartType;
104
+ title: string;
105
+ xAxisTitle: string;
106
+ yAxisTitle: string;
107
+ categories: string[];
108
+ series: WidgetAnalyticsSeries[];
109
+ summary: string;
110
+ omittedSeriesCount: number;
111
+ };
112
+ declare const buildWidgetAnalyticsChartModel: (visualization: AnalyticsVisualization$1, overrideType?: WidgetAnalyticsChartType) => WidgetAnalyticsChartModel | null;
113
+ declare const WidgetAnalyticsChart: ({
114
+ model,
115
+ expanded
116
+ }: {
117
+ model: WidgetAnalyticsChartModel;
118
+ expanded?: boolean;
119
+ }) => preact0.JSX.Element;
120
+ //#endregion
121
+ //#region ../centrinfo-results/src/result.d.ts
122
+ declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn) => string;
123
+ declare const serializeResultCsv: (rows: Array<Record<string, unknown>>, columns?: Array<string | ResultColumn>) => string;
124
+ //#endregion
125
+ //#region ../centrinfo-results/src/table.d.ts
126
+ interface ResultTableProps {
127
+ rows: Array<Record<string, unknown>>;
128
+ columns?: Array<string | ResultColumn>;
129
+ maxRows?: number;
130
+ locale?: string;
131
+ expanded?: boolean;
132
+ classNames?: ResultTableClassNames;
133
+ emptyLabel?: string;
134
+ }
135
+ declare const ResultTable: ({
136
+ rows,
137
+ columns,
138
+ maxRows,
139
+ locale,
140
+ expanded,
141
+ classNames,
142
+ emptyLabel
143
+ }: ResultTableProps) => preact0.JSX.Element;
144
+ //#endregion
145
+ //#region src/rich.d.ts
146
+ declare const renderRich: (text: string) => JSX.Element[];
147
+ //#endregion
148
+ //#region src/useChat.d.ts
149
+ /** One past conversation, for the in-widget history list. */
150
+ interface HistoryEntry {
151
+ sessionId: string;
152
+ /** Last-activity timestamp (epoch ms) — newest first. */
153
+ ts: number;
154
+ /** Short label: the visitor's first message, else a snippet of the reply. */
155
+ title: string;
156
+ ended: boolean;
157
+ }
158
+ /** Optional extras when sending — an inline image (GIF) or an extracted file. */
159
+ interface SendOpts {
160
+ imageUrl?: string;
161
+ /** Voice-call turns should speak the assistant reply using provider TTS when configured. */
162
+ forceVoicePlayback?: boolean;
163
+ /** Existing local user bubble to turn into the sent visitor message. */
164
+ userMessageId?: string;
165
+ /** Display name of an attached file (shown as a chip on the user bubble). */
166
+ attachmentName?: string;
167
+ /** Text extracted from the attachment, folded into the backend question. */
168
+ attachmentText?: string;
169
+ }
170
+ interface ChatApi {
171
+ persona: BootstrapInfo | null;
172
+ messages: ChatMessage[];
173
+ sending: boolean;
174
+ /** True while a TTS reply audio element is actively playing. */
175
+ assistantSpeaking: boolean;
176
+ visitor: Visitor;
177
+ /** Effective starter prompts: host `starters` if set, else token `starterQuestions`. */
178
+ starters: string[];
179
+ /** Manual featured links configured on the token, shown before first visitor message. */
180
+ featuredLinks: FeaturedLink[];
181
+ /** True once we know the visitor's email — drives the handoff UI (Case 1 vs 2). */
182
+ hasEmail: boolean;
183
+ /** Current handoff state for this live session. */
184
+ liveMode: 'ai' | 'queued' | 'human';
185
+ /** Human currently assigned to the live chat, if any. */
186
+ assignedAgentName?: string;
187
+ /** Human currently typing in the live chat, if any. */
188
+ agentTypingName?: string;
189
+ send: (text: string, opts?: SendOpts) => void;
190
+ sendGif: (url: string) => void;
191
+ /** Soft visitor typing hint for the staff console. */
192
+ notifyTyping: (isTyping: boolean) => void;
193
+ /** Cancel the in-flight streaming reply (Stop button). */
194
+ stop: () => void;
195
+ /** Re-run a failed turn in place. */
196
+ retry: (agentId: string, question: string) => void;
197
+ /** Record a 👍/👎 on an assistant reply (optional comment on 👎). Optimistic. */
198
+ rateMessage: (messageId: string, rating: 'up' | 'down', comment?: string) => void;
199
+ /** Append a proactive assistant message (auto-engagement). No-op duplicate-guarded. */
200
+ injectAssistant: (content: string) => void;
201
+ /** Add/update/remove local-only bubbles used by the live voice capture UI. */
202
+ appendUserDraft: (content: string) => string;
203
+ patchMessage: (id: string, fields: Partial<ChatMessage>) => void;
204
+ removeMessage: (id: string) => void;
205
+ /** Conversation-level CSAT at end-of-chat. Best-effort. */
206
+ submitCsat: (rating: 'up' | 'down', comment?: string) => void;
207
+ /** Submit an inline action form; persists identity so Case-1 auto-handoff can fire later. */
208
+ submitForm: (type: ActionType, payload: Record<string, unknown>, identity?: Visitor) => Promise<ActionResult>;
209
+ transcribe: (audioBase64: string, mimeType: string, languageHint?: string, durationSeconds?: number) => Promise<string>;
210
+ /** Extract text from an attached image/PDF (folded into the next message). */
211
+ extract: (fileBase64: string, mimeType: string, filename?: string) => Promise<string>;
212
+ searchGifs: (query: string) => Promise<GifResult[]>;
213
+ /** Booking availability in a window (booked slots + connected-calendar busy ranges). */
214
+ demoSlots: (fromISO: string, toISO: string) => Promise<DemoSlotsResult>;
215
+ gifEnabled: boolean;
216
+ /** Host-app SSO passthrough. */
217
+ identify: (user: WidgetUser) => void;
218
+ /** True once the conversation is closed (visitor ended it, 24h idle, or the
219
+ * backend reported it ended). The composer is disabled; only `startNew` works. */
220
+ ended: boolean;
221
+ /** Close the current conversation — tells the backend, disables the composer. */
222
+ endConversation: () => void;
223
+ /** Start a fresh conversation: new backend session, transcript reset to greeting. */
224
+ startNew: () => void;
225
+ /** Past conversations (newest first), for the in-widget history list. */
226
+ history: HistoryEntry[];
227
+ /** sessionId of the archived conversation being viewed read-only (null = live). */
228
+ viewingSessionId: string | null;
229
+ /** The read-only transcript of the conversation being viewed. */
230
+ viewMessages: ChatMessage[];
231
+ /** Open a past conversation read-only. */
232
+ openConversation: (sessionId: string) => void;
233
+ /** Leave the read-only history view, back to the live conversation. */
234
+ closeHistoryView: () => void;
235
+ /** Logout: erase ALL of this visitor's locally-stored data (identity,
236
+ * transcripts, history) and reset to a fresh anonymous session. For
237
+ * shared devices / host-app logout — à la Intercom `shutdown`. */
238
+ shutdown: () => void;
239
+ /** Stop any currently-playing TTS reply audio (voice call "Talk now" interrupt). */
240
+ stopSpeaking: () => void;
241
+ /** Speak a local assistant message, used for call-mode welcome/status prompts. */
242
+ speakAssistantText: (text: string) => Promise<boolean>;
243
+ }
244
+ declare const useChat: (transport: Transport, config: ResolvedConfig, active?: boolean) => ChatApi;
245
+ //#endregion
246
+ //#region src/runtime.d.ts
247
+ declare const createChatTransport: (config: ResolvedConfig) => Transport;
248
+ //#endregion
249
+ export { type AnalyticsVisualization, type BootstrapInfo, type ChatApi, type ChatMessage, type HistoryEntry, type ResolvedConfig, ResultTable, type Source, type Transport, WidgetAnalyticsChart, type WidgetConfig, type WidgetThemeTokens, type WidgetUser, buildWidgetAnalyticsChartModel, createChatTransport, formatResultCell, renderRich, resolveConfig, serializeResultCsv, useChat };
@@ -0,0 +1,249 @@
1
+ import { a as Visitor, c as WidgetThemeTokens, d as ActionType, f as AnalyticsVisualization, g as WidgetStrings, h as Transport, i as Source, l as WidgetUser, m as GifResult, n as ChatMessage, o as WidgetConfig, p as DemoSlotsResult, r as FeaturedLink, t as BootstrapInfo, u as ActionResult } from "./types-BwixZ4yh.mjs";
2
+ import * as preact0 from "preact";
3
+ import { JSX } from "preact";
4
+
5
+ //#region src/config.d.ts
6
+ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'user' | 'analyticsContextToken' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onAction' | 'onHandoff'>> {
7
+ accentColor?: string;
8
+ agentName?: string;
9
+ agentAvatarUrl?: string;
10
+ launcherIcon?: string;
11
+ themeTokens?: WidgetConfig['themeTokens'];
12
+ gifApiKey?: string;
13
+ /** Resolved string table (English defaults + host `labels` overrides). */
14
+ strings: WidgetStrings;
15
+ /** Host-app SSO passthrough (see WidgetConfig.user). Optional. */
16
+ user?: WidgetConfig['user'];
17
+ /** Short-lived signed context for governed customer analytics. */
18
+ analyticsContextToken?: WidgetConfig['analyticsContextToken'];
19
+ identityToken?: WidgetConfig['identityToken'];
20
+ getIdentityToken?: WidgetConfig['getIdentityToken'];
21
+ customLauncherSelector?: string;
22
+ proactiveMessage?: string;
23
+ proactiveOnPaths?: string[];
24
+ onOpen?: WidgetConfig['onOpen'];
25
+ onClose?: WidgetConfig['onClose'];
26
+ onShow?: WidgetConfig['onShow'];
27
+ onHide?: WidgetConfig['onHide'];
28
+ onUnreadChange?: WidgetConfig['onUnreadChange'];
29
+ onMessage?: WidgetConfig['onMessage'];
30
+ onAction?: WidgetConfig['onAction'];
31
+ onHandoff?: WidgetConfig['onHandoff'];
32
+ }
33
+ declare const resolveConfig: (cfg: WidgetConfig) => ResolvedConfig;
34
+ //#endregion
35
+ //#region ../centrinfo-results/src/types.d.ts
36
+ interface AnalyticsVisualizationColumn {
37
+ key: string;
38
+ label: string;
39
+ dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
40
+ semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
41
+ aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
42
+ formatPattern?: string;
43
+ currencyCode?: string;
44
+ description?: string;
45
+ priority?: 'primary' | 'secondary' | 'detail';
46
+ sortable?: boolean;
47
+ filterable?: boolean;
48
+ groupable?: boolean;
49
+ }
50
+ interface AnalyticsVisualizationRecommendation {
51
+ type: 'kpi' | 'table' | 'line' | 'area' | 'bar' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel';
52
+ mode: string;
53
+ categoryField?: string;
54
+ valueFields?: string[];
55
+ seriesField?: string;
56
+ reason?: string;
57
+ confidence?: number;
58
+ }
59
+ interface AnalyticsVisualization$1 {
60
+ version?: number;
61
+ presentation?: 'kpi' | 'chart' | 'table';
62
+ type: 'kpi' | 'table' | 'bar' | 'line' | 'area' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel';
63
+ title?: string;
64
+ label?: string;
65
+ value?: string;
66
+ valueFields?: string[];
67
+ series?: string;
68
+ seriesField?: string;
69
+ columns?: string[];
70
+ rows?: Array<Record<string, unknown>>;
71
+ rowCount?: number;
72
+ timezone?: string;
73
+ columnMetadata?: AnalyticsVisualizationColumn[];
74
+ currency?: {
75
+ code?: string;
76
+ field?: string;
77
+ source?: 'fixed_metadata' | 'source_field';
78
+ isMixed: boolean;
79
+ };
80
+ chartRecommendation?: AnalyticsVisualizationRecommendation;
81
+ }
82
+ interface ResultColumn {
83
+ key: string;
84
+ label?: string;
85
+ dataType?: AnalyticsVisualizationColumn['dataType'];
86
+ currencyCode?: string;
87
+ }
88
+ interface ResultTableClassNames {
89
+ wrap?: string;
90
+ table?: string;
91
+ note?: string;
92
+ }
93
+ //#endregion
94
+ //#region ../centrinfo-results/src/chart.d.ts
95
+ type WidgetAnalyticsSeries = {
96
+ field: string;
97
+ name: string;
98
+ values: Array<number | null>;
99
+ valueColumn?: AnalyticsVisualizationColumn;
100
+ };
101
+ type WidgetAnalyticsChartType = 'line' | 'bar' | 'stacked_bar';
102
+ type WidgetAnalyticsChartModel = {
103
+ type: WidgetAnalyticsChartType;
104
+ title: string;
105
+ xAxisTitle: string;
106
+ yAxisTitle: string;
107
+ categories: string[];
108
+ series: WidgetAnalyticsSeries[];
109
+ summary: string;
110
+ omittedSeriesCount: number;
111
+ };
112
+ declare const buildWidgetAnalyticsChartModel: (visualization: AnalyticsVisualization$1, overrideType?: WidgetAnalyticsChartType) => WidgetAnalyticsChartModel | null;
113
+ declare const WidgetAnalyticsChart: ({
114
+ model,
115
+ expanded
116
+ }: {
117
+ model: WidgetAnalyticsChartModel;
118
+ expanded?: boolean;
119
+ }) => preact0.JSX.Element;
120
+ //#endregion
121
+ //#region ../centrinfo-results/src/result.d.ts
122
+ declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn) => string;
123
+ declare const serializeResultCsv: (rows: Array<Record<string, unknown>>, columns?: Array<string | ResultColumn>) => string;
124
+ //#endregion
125
+ //#region ../centrinfo-results/src/table.d.ts
126
+ interface ResultTableProps {
127
+ rows: Array<Record<string, unknown>>;
128
+ columns?: Array<string | ResultColumn>;
129
+ maxRows?: number;
130
+ locale?: string;
131
+ expanded?: boolean;
132
+ classNames?: ResultTableClassNames;
133
+ emptyLabel?: string;
134
+ }
135
+ declare const ResultTable: ({
136
+ rows,
137
+ columns,
138
+ maxRows,
139
+ locale,
140
+ expanded,
141
+ classNames,
142
+ emptyLabel
143
+ }: ResultTableProps) => preact0.JSX.Element;
144
+ //#endregion
145
+ //#region src/rich.d.ts
146
+ declare const renderRich: (text: string) => JSX.Element[];
147
+ //#endregion
148
+ //#region src/useChat.d.ts
149
+ /** One past conversation, for the in-widget history list. */
150
+ interface HistoryEntry {
151
+ sessionId: string;
152
+ /** Last-activity timestamp (epoch ms) — newest first. */
153
+ ts: number;
154
+ /** Short label: the visitor's first message, else a snippet of the reply. */
155
+ title: string;
156
+ ended: boolean;
157
+ }
158
+ /** Optional extras when sending — an inline image (GIF) or an extracted file. */
159
+ interface SendOpts {
160
+ imageUrl?: string;
161
+ /** Voice-call turns should speak the assistant reply using provider TTS when configured. */
162
+ forceVoicePlayback?: boolean;
163
+ /** Existing local user bubble to turn into the sent visitor message. */
164
+ userMessageId?: string;
165
+ /** Display name of an attached file (shown as a chip on the user bubble). */
166
+ attachmentName?: string;
167
+ /** Text extracted from the attachment, folded into the backend question. */
168
+ attachmentText?: string;
169
+ }
170
+ interface ChatApi {
171
+ persona: BootstrapInfo | null;
172
+ messages: ChatMessage[];
173
+ sending: boolean;
174
+ /** True while a TTS reply audio element is actively playing. */
175
+ assistantSpeaking: boolean;
176
+ visitor: Visitor;
177
+ /** Effective starter prompts: host `starters` if set, else token `starterQuestions`. */
178
+ starters: string[];
179
+ /** Manual featured links configured on the token, shown before first visitor message. */
180
+ featuredLinks: FeaturedLink[];
181
+ /** True once we know the visitor's email — drives the handoff UI (Case 1 vs 2). */
182
+ hasEmail: boolean;
183
+ /** Current handoff state for this live session. */
184
+ liveMode: 'ai' | 'queued' | 'human';
185
+ /** Human currently assigned to the live chat, if any. */
186
+ assignedAgentName?: string;
187
+ /** Human currently typing in the live chat, if any. */
188
+ agentTypingName?: string;
189
+ send: (text: string, opts?: SendOpts) => void;
190
+ sendGif: (url: string) => void;
191
+ /** Soft visitor typing hint for the staff console. */
192
+ notifyTyping: (isTyping: boolean) => void;
193
+ /** Cancel the in-flight streaming reply (Stop button). */
194
+ stop: () => void;
195
+ /** Re-run a failed turn in place. */
196
+ retry: (agentId: string, question: string) => void;
197
+ /** Record a 👍/👎 on an assistant reply (optional comment on 👎). Optimistic. */
198
+ rateMessage: (messageId: string, rating: 'up' | 'down', comment?: string) => void;
199
+ /** Append a proactive assistant message (auto-engagement). No-op duplicate-guarded. */
200
+ injectAssistant: (content: string) => void;
201
+ /** Add/update/remove local-only bubbles used by the live voice capture UI. */
202
+ appendUserDraft: (content: string) => string;
203
+ patchMessage: (id: string, fields: Partial<ChatMessage>) => void;
204
+ removeMessage: (id: string) => void;
205
+ /** Conversation-level CSAT at end-of-chat. Best-effort. */
206
+ submitCsat: (rating: 'up' | 'down', comment?: string) => void;
207
+ /** Submit an inline action form; persists identity so Case-1 auto-handoff can fire later. */
208
+ submitForm: (type: ActionType, payload: Record<string, unknown>, identity?: Visitor) => Promise<ActionResult>;
209
+ transcribe: (audioBase64: string, mimeType: string, languageHint?: string, durationSeconds?: number) => Promise<string>;
210
+ /** Extract text from an attached image/PDF (folded into the next message). */
211
+ extract: (fileBase64: string, mimeType: string, filename?: string) => Promise<string>;
212
+ searchGifs: (query: string) => Promise<GifResult[]>;
213
+ /** Booking availability in a window (booked slots + connected-calendar busy ranges). */
214
+ demoSlots: (fromISO: string, toISO: string) => Promise<DemoSlotsResult>;
215
+ gifEnabled: boolean;
216
+ /** Host-app SSO passthrough. */
217
+ identify: (user: WidgetUser) => void;
218
+ /** True once the conversation is closed (visitor ended it, 24h idle, or the
219
+ * backend reported it ended). The composer is disabled; only `startNew` works. */
220
+ ended: boolean;
221
+ /** Close the current conversation — tells the backend, disables the composer. */
222
+ endConversation: () => void;
223
+ /** Start a fresh conversation: new backend session, transcript reset to greeting. */
224
+ startNew: () => void;
225
+ /** Past conversations (newest first), for the in-widget history list. */
226
+ history: HistoryEntry[];
227
+ /** sessionId of the archived conversation being viewed read-only (null = live). */
228
+ viewingSessionId: string | null;
229
+ /** The read-only transcript of the conversation being viewed. */
230
+ viewMessages: ChatMessage[];
231
+ /** Open a past conversation read-only. */
232
+ openConversation: (sessionId: string) => void;
233
+ /** Leave the read-only history view, back to the live conversation. */
234
+ closeHistoryView: () => void;
235
+ /** Logout: erase ALL of this visitor's locally-stored data (identity,
236
+ * transcripts, history) and reset to a fresh anonymous session. For
237
+ * shared devices / host-app logout — à la Intercom `shutdown`. */
238
+ shutdown: () => void;
239
+ /** Stop any currently-playing TTS reply audio (voice call "Talk now" interrupt). */
240
+ stopSpeaking: () => void;
241
+ /** Speak a local assistant message, used for call-mode welcome/status prompts. */
242
+ speakAssistantText: (text: string) => Promise<boolean>;
243
+ }
244
+ declare const useChat: (transport: Transport, config: ResolvedConfig, active?: boolean) => ChatApi;
245
+ //#endregion
246
+ //#region src/runtime.d.ts
247
+ declare const createChatTransport: (config: ResolvedConfig) => Transport;
248
+ //#endregion
249
+ export { type AnalyticsVisualization, type BootstrapInfo, type ChatApi, type ChatMessage, type HistoryEntry, type ResolvedConfig, ResultTable, type Source, type Transport, WidgetAnalyticsChart, type WidgetConfig, type WidgetThemeTokens, type WidgetUser, buildWidgetAnalyticsChartModel, createChatTransport, formatResultCell, renderRich, resolveConfig, serializeResultCsv, useChat };
@@ -0,0 +1 @@
1
+ import{_ as e,a as t,d as n,f as r,m as i,n as a,p as o,t as s,u as c,v as l,y as u}from"./config-CHvO9tW1.mjs";const d=t=>t.demo?new l:t.preview?new e(new u(t.apiBaseUrl,t.token,t.gifApiKey,t.analyticsContextToken,{agentName:t.agentName,agentAvatarUrl:t.agentAvatarUrl},t.identityToken,t.getIdentityToken,t.chatSurface),t.strings):new u(t.apiBaseUrl,t.token,t.gifApiKey,t.analyticsContextToken,{agentName:t.agentName,agentAvatarUrl:t.agentAvatarUrl},t.identityToken,t.getIdentityToken,t.chatSurface);export{c as ResultTable,o as WidgetAnalyticsChart,i as buildWidgetAnalyticsChartModel,d as createChatTransport,n as formatResultCell,t as renderRich,s as resolveConfig,r as serializeResultCsv,a as useChat};