@accurix/centrinfo-widget 4.0.0 → 5.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.
- package/README.md +195 -28
- package/dist/cdn/centrinfo-widget-charts.js +15826 -0
- package/dist/cdn/centrinfo-widget-dev.js +122 -0
- package/dist/cdn/centrinfo-widget.js +568 -641
- package/dist/cdn/manifest.json +20 -6
- package/dist/dev-transports-CuEqYhZT.cjs +1 -0
- package/dist/dev-transports-D6oaj_ri.mjs +1 -0
- package/dist/echarts-runtime-BfpVL8xu.cjs +24 -0
- package/dist/echarts-runtime-Bu1uy4oO.mjs +18 -0
- package/dist/index.cjs +1 -3519
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -3519
- package/dist/runtime.cjs +2 -1
- package/dist/runtime.d.cts +315 -59
- package/dist/runtime.d.mts +189 -142
- package/dist/runtime.mjs +2 -1
- package/dist/styles-BH7P8Q_3.cjs +3472 -0
- package/dist/styles-DwSTSmZb.mjs +3472 -0
- package/dist/{types-1ZJJY7Da.d.mts → types-CYFMH8yg.d.cts} +615 -12
- package/dist/{types-B0r4SXaT.d.cts → types-D82dr33R.d.mts} +824 -10
- package/package.json +5 -7
- package/dist/config-CkU4urQY.mjs +0 -30
- package/dist/config-DsNMbdKp.cjs +0 -36
package/dist/runtime.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import * as preact0 from "preact";
|
|
1
|
+
import { A as buildWidgetAnalyticsChartModel, C as StringsProvider, D as formatResultCell, E as ResultTable, M as AnalyticsAIExplanationTransport, N as AnalyticsExplanationInput, O as serializeResultCsv, S as Transport, T as AnalyticsResultDetail, _ as DemoSlotsResult, a as MessageAttachment, b as PublicChatAction, c as Visitor, f as WidgetThemeTokens, g as DemoBooking, h as AnalyticsVisualization, i as FeaturedLink, j as ResultLabels, k as WidgetAnalyticsChart, l as WidgetActionTranslation, m as ActionResult, n as ChatArtifact, o as SchedulerInfo, p as WidgetUser, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as ExplanationFeedbackInput, w as WidgetStrings, x as PublicChatActionField, y as GifResult } from "./types-D82dr33R.mjs";
|
|
3
2
|
import { JSX } from "preact";
|
|
4
3
|
|
|
5
4
|
//#region src/config.d.ts
|
|
6
|
-
interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'locale' | 'translations' | 'user' | 'analyticsContextToken' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onAction' | 'onHandoff'>> {
|
|
5
|
+
interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'locale' | 'dir' | 'translations' | 'user' | 'analyticsContextToken' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onOpenAnalyticsSource' | 'onAction' | 'onHandoff'>> {
|
|
7
6
|
accentColor?: string;
|
|
8
7
|
agentName?: string;
|
|
9
8
|
agentAvatarUrl?: string;
|
|
@@ -13,6 +12,8 @@ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'ag
|
|
|
13
12
|
/** Resolved string table (English defaults + host `labels` overrides). */
|
|
14
13
|
strings: WidgetStrings;
|
|
15
14
|
locale: string;
|
|
15
|
+
/** Resolved text direction (from `dir`, else the locale). */
|
|
16
|
+
dir: 'ltr' | 'rtl';
|
|
16
17
|
actionTranslations: Record<string, WidgetActionTranslation>;
|
|
17
18
|
/** Host-app SSO passthrough (see WidgetConfig.user). Optional. */
|
|
18
19
|
user?: WidgetConfig['user'];
|
|
@@ -29,149 +30,25 @@ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'ag
|
|
|
29
30
|
onHide?: WidgetConfig['onHide'];
|
|
30
31
|
onUnreadChange?: WidgetConfig['onUnreadChange'];
|
|
31
32
|
onMessage?: WidgetConfig['onMessage'];
|
|
33
|
+
onOpenAnalyticsSource?: WidgetConfig['onOpenAnalyticsSource'];
|
|
32
34
|
onAction?: WidgetConfig['onAction'];
|
|
33
35
|
onHandoff?: WidgetConfig['onHandoff'];
|
|
34
36
|
}
|
|
35
37
|
declare const resolveConfig: (cfg: WidgetConfig) => ResolvedConfig;
|
|
36
38
|
//#endregion
|
|
37
|
-
//#region
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
label: string;
|
|
44
|
-
dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
|
|
45
|
-
semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
|
|
46
|
-
aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
|
|
47
|
-
formatPattern?: string;
|
|
48
|
-
currencyCode?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
priority?: 'primary' | 'secondary' | 'detail';
|
|
51
|
-
sortable?: boolean;
|
|
52
|
-
filterable?: boolean;
|
|
53
|
-
groupable?: boolean;
|
|
54
|
-
}
|
|
55
|
-
interface AnalyticsVisualizationRecommendation {
|
|
56
|
-
type: AnalyticsChartCatalogType | 'area' | 'stacked_bar';
|
|
57
|
-
mode: string;
|
|
58
|
-
categoryField?: string;
|
|
59
|
-
latitudeField?: string;
|
|
60
|
-
longitudeField?: string;
|
|
61
|
-
geometryField?: string;
|
|
62
|
-
valueFields?: string[];
|
|
63
|
-
seriesField?: string;
|
|
64
|
-
reason?: string;
|
|
65
|
-
confidence?: number;
|
|
66
|
-
}
|
|
67
|
-
interface AnalyticsVisualization$1 {
|
|
68
|
-
version?: number;
|
|
69
|
-
presentation?: 'kpi' | 'chart' | 'table';
|
|
70
|
-
type: AnalyticsChartCatalogType | 'area' | 'stacked_bar';
|
|
71
|
-
title?: string;
|
|
72
|
-
label?: string;
|
|
73
|
-
value?: string;
|
|
74
|
-
latitudeField?: string;
|
|
75
|
-
longitudeField?: string;
|
|
76
|
-
geometryField?: string;
|
|
77
|
-
valueFields?: string[];
|
|
78
|
-
series?: string;
|
|
79
|
-
seriesField?: string;
|
|
80
|
-
columns?: string[];
|
|
81
|
-
rows?: Array<Record<string, unknown>>;
|
|
82
|
-
rowCount?: number;
|
|
83
|
-
timezone?: string;
|
|
84
|
-
columnMetadata?: AnalyticsVisualizationColumn[];
|
|
85
|
-
currency?: {
|
|
86
|
-
code?: string;
|
|
87
|
-
field?: string;
|
|
88
|
-
source?: 'fixed_metadata' | 'source_field';
|
|
89
|
-
isMixed: boolean;
|
|
90
|
-
};
|
|
91
|
-
chartRecommendation?: AnalyticsVisualizationRecommendation;
|
|
92
|
-
}
|
|
93
|
-
interface ResultColumn {
|
|
94
|
-
key: string;
|
|
95
|
-
label?: string;
|
|
96
|
-
dataType?: AnalyticsVisualizationColumn['dataType'];
|
|
97
|
-
currencyCode?: string;
|
|
98
|
-
}
|
|
99
|
-
interface ResultTableClassNames {
|
|
100
|
-
wrap?: string;
|
|
101
|
-
table?: string;
|
|
102
|
-
note?: string;
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region ../centrinfo-results/src/chart.d.ts
|
|
106
|
-
type WidgetAnalyticsSeries = {
|
|
107
|
-
field: string;
|
|
108
|
-
name: string;
|
|
109
|
-
values: Array<number | null>;
|
|
110
|
-
valueColumn?: AnalyticsVisualizationColumn;
|
|
111
|
-
};
|
|
112
|
-
type WidgetAnalyticsChartType = 'line' | 'bar' | 'stacked_bar';
|
|
113
|
-
type WidgetAnalyticsChartModel = {
|
|
114
|
-
type: WidgetAnalyticsChartType;
|
|
115
|
-
title: string;
|
|
116
|
-
xAxisTitle: string;
|
|
117
|
-
yAxisTitle: string;
|
|
118
|
-
categories: string[];
|
|
119
|
-
series: WidgetAnalyticsSeries[];
|
|
120
|
-
summary: string;
|
|
121
|
-
omittedSeriesCount: number;
|
|
122
|
-
};
|
|
123
|
-
declare const buildWidgetAnalyticsChartModel: (visualization: AnalyticsVisualization$1, overrideType?: WidgetAnalyticsChartType) => WidgetAnalyticsChartModel | null;
|
|
124
|
-
declare const WidgetAnalyticsChart: ({
|
|
125
|
-
model,
|
|
126
|
-
expanded
|
|
127
|
-
}: {
|
|
128
|
-
model: WidgetAnalyticsChartModel;
|
|
129
|
-
expanded?: boolean;
|
|
130
|
-
}) => preact0.JSX.Element;
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region ../centrinfo-results/src/result.d.ts
|
|
133
|
-
declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn) => string;
|
|
134
|
-
declare const serializeResultCsv: (rows: Array<Record<string, unknown>>, columns?: Array<string | ResultColumn>) => string;
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region ../centrinfo-results/src/table.d.ts
|
|
137
|
-
interface ResultTableProps {
|
|
138
|
-
rows: Array<Record<string, unknown>>;
|
|
139
|
-
columns?: Array<string | ResultColumn>;
|
|
140
|
-
maxRows?: number;
|
|
141
|
-
locale?: string;
|
|
142
|
-
expanded?: boolean;
|
|
143
|
-
classNames?: ResultTableClassNames;
|
|
144
|
-
emptyLabel?: string;
|
|
145
|
-
}
|
|
146
|
-
declare const ResultTable: ({
|
|
147
|
-
rows,
|
|
148
|
-
columns,
|
|
149
|
-
maxRows,
|
|
150
|
-
locale,
|
|
151
|
-
expanded,
|
|
152
|
-
classNames,
|
|
153
|
-
emptyLabel
|
|
154
|
-
}: ResultTableProps) => preact0.JSX.Element;
|
|
39
|
+
//#region src/api/factory.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* The real client is bundled; the demo and preview transports are fetched the
|
|
42
|
+
* first time they are used, so production widgets never download them.
|
|
43
|
+
*/
|
|
44
|
+
declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
155
45
|
//#endregion
|
|
156
46
|
//#region src/rich.d.ts
|
|
157
47
|
declare const renderRich: (text: string) => JSX.Element[];
|
|
158
48
|
//#endregion
|
|
159
|
-
//#region src/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
noiseSuppression?: boolean;
|
|
163
|
-
autoGainControl?: boolean;
|
|
164
|
-
channelCount?: boolean;
|
|
165
|
-
voiceIsolation?: boolean;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Build a best-effort microphone profile for conversational speech. Every
|
|
169
|
-
* enhancement is capability-driven and optional, so unsupported processing
|
|
170
|
-
* cannot make microphone permission fail.
|
|
171
|
-
*/
|
|
172
|
-
declare const createVoiceAudioConstraints: (deviceId?: string, supported?: VoiceAudioCapabilities) => MediaTrackConstraints;
|
|
173
|
-
declare const createPreferredAudioRecorder: (stream: MediaStream) => MediaRecorder;
|
|
174
|
-
declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined) => void;
|
|
49
|
+
//#region src/result-details.d.ts
|
|
50
|
+
/** Reader-safe result context shared by the floating widget and chat app. */
|
|
51
|
+
declare const analyticsResultDetails: (result: AnalyticsVisualization, labels?: Partial<ResultLabels>, locale?: string) => AnalyticsResultDetail[];
|
|
175
52
|
//#endregion
|
|
176
53
|
//#region src/useChat.d.ts
|
|
177
54
|
/** One past conversation, for the in-widget history list. */
|
|
@@ -183,7 +60,18 @@ interface HistoryEntry {
|
|
|
183
60
|
title: string;
|
|
184
61
|
ended: boolean;
|
|
185
62
|
}
|
|
63
|
+
/** The catalogue action that brings a teammate into the chat, when usable.
|
|
64
|
+
* A backend older than the liveHandoff flag is recognised by its fixed id. */
|
|
65
|
+
declare const findLiveSupportAction: (actions: PublicChatAction[] | undefined) => PublicChatAction | undefined;
|
|
66
|
+
/** The ai_handback notice that may still offer to reconnect: the latest one,
|
|
67
|
+
* while the AI has the chat and the visitor has not already asked again. */
|
|
68
|
+
declare const reconnectableHandbackId: (messages: ChatMessage[], liveMode: "ai" | "queued" | "human") => string | undefined;
|
|
186
69
|
/** Optional extras when sending — an inline image (GIF) or an extracted file. */
|
|
70
|
+
interface VoiceReply {
|
|
71
|
+
status: 'idle' | 'answering' | 'speaking' | 'done' | 'failed';
|
|
72
|
+
/** The assistant message answering the voice turn. */
|
|
73
|
+
agentId?: string;
|
|
74
|
+
}
|
|
187
75
|
interface SendOpts {
|
|
188
76
|
imageUrl?: string;
|
|
189
77
|
/** Voice-call turns should speak the assistant reply using provider TTS when configured. */
|
|
@@ -194,6 +82,19 @@ interface SendOpts {
|
|
|
194
82
|
attachmentName?: string;
|
|
195
83
|
/** Text extracted from the attachment, folded into the backend question. */
|
|
196
84
|
attachmentText?: string;
|
|
85
|
+
attachmentId?: string;
|
|
86
|
+
/** The attached file itself, kept in memory so it can be previewed. */
|
|
87
|
+
attachmentFile?: Blob;
|
|
88
|
+
/** Several files sent with the message (replaces the single fields). */
|
|
89
|
+
attachments?: OutgoingAttachment[];
|
|
90
|
+
}
|
|
91
|
+
interface OutgoingAttachment {
|
|
92
|
+
id?: string;
|
|
93
|
+
name: string;
|
|
94
|
+
/** Text extracted from the file, folded into the backend question. */
|
|
95
|
+
text?: string;
|
|
96
|
+
/** Kept in memory so it can be previewed. */
|
|
97
|
+
file?: Blob;
|
|
197
98
|
}
|
|
198
99
|
interface ChatApi {
|
|
199
100
|
persona: BootstrapInfo | null;
|
|
@@ -201,6 +102,12 @@ interface ChatApi {
|
|
|
201
102
|
sending: boolean;
|
|
202
103
|
/** True while a TTS reply audio element is actively playing. */
|
|
203
104
|
assistantSpeaking: boolean;
|
|
105
|
+
/** Progress of the answer to the latest voice turn (a send or retry with
|
|
106
|
+
* forceVoicePlayback): answering until its audio starts, speaking while it
|
|
107
|
+
* plays, then done — or failed when the request failed. Done is only set
|
|
108
|
+
* once playback has ended or there was nothing to play, so a caller can
|
|
109
|
+
* safely reopen the microphone. */
|
|
110
|
+
voiceReply: VoiceReply;
|
|
204
111
|
visitor: Visitor;
|
|
205
112
|
/** Effective starter prompts: host `starters` if set, else token `starterQuestions`. */
|
|
206
113
|
starters: string[];
|
|
@@ -215,17 +122,42 @@ interface ChatApi {
|
|
|
215
122
|
/** Human currently typing in the live chat, if any. */
|
|
216
123
|
agentTypingName?: string;
|
|
217
124
|
send: (text: string, opts?: SendOpts) => void;
|
|
125
|
+
/** Add to the question being answered (the visitor kept talking while the
|
|
126
|
+
* reply was prepared): cancels that reply and asks again with all of it.
|
|
127
|
+
* Also completes a held question (see `hold`). An ordinary send otherwise. */
|
|
128
|
+
amend: (text: string, opts?: SendOpts) => void;
|
|
129
|
+
/** The visitor started talking while the reply was prepared: cancel it now
|
|
130
|
+
* (so its audio never plays over them) but keep the question, to be asked
|
|
131
|
+
* again by `amend` with their words, or by `resumeHeld` if it was noise.
|
|
132
|
+
* Returns false when nothing was in flight. */
|
|
133
|
+
hold: () => boolean;
|
|
134
|
+
/** Ask a held question again, unchanged (what was heard was not speech). */
|
|
135
|
+
resumeHeld: () => void;
|
|
136
|
+
/** Lower (true) or restore (false) the reply being read aloud, while the
|
|
137
|
+
* visitor may be talking over it: it keeps playing until we know whether
|
|
138
|
+
* that was the visitor or the reply's own echo. */
|
|
139
|
+
duckSpeaking: (ducked: boolean) => void;
|
|
218
140
|
sendGif: (url: string) => void;
|
|
219
141
|
/** Soft visitor typing hint for the staff console. */
|
|
220
142
|
notifyTyping: (isTyping: boolean) => void;
|
|
221
143
|
/** Cancel the in-flight streaming reply (Stop button). */
|
|
222
144
|
stop: () => void;
|
|
223
145
|
/** Re-run a failed turn in place. */
|
|
224
|
-
retry: (agentId: string, question: string) => void;
|
|
146
|
+
retry: (agentId: string, question: string, opts?: Pick<SendOpts, 'forceVoicePlayback'>) => void;
|
|
225
147
|
/** Record a 👍/👎 on an assistant reply (optional comment on 👎). Optimistic. */
|
|
226
148
|
rateMessage: (messageId: string, rating: 'up' | 'down', comment?: string) => void;
|
|
149
|
+
/** Record a vote on an analytics explanation. Rejects when it could not be
|
|
150
|
+
* saved (or the transport has no explanation feedback) so the UI can retry. */
|
|
151
|
+
rateExplanation: (input: Omit<ExplanationFeedbackInput, 'sessionId' | 'surface'>, surface?: ExplanationFeedbackInput['surface']) => Promise<void>;
|
|
152
|
+
/** Poll / retry the detailed AI explanation of an analytics answer for this
|
|
153
|
+
* session; undefined when the transport cannot. */
|
|
154
|
+
explanationTransport: (surface?: ExplanationFeedbackInput['surface']) => AnalyticsAIExplanationTransport<AnalyticsExplanationInput> | undefined;
|
|
227
155
|
/** Append a proactive assistant message (auto-engagement). No-op duplicate-guarded. */
|
|
228
156
|
injectAssistant: (content: string) => void;
|
|
157
|
+
/** After a teammate handed the chat back to the AI: offer the live-support
|
|
158
|
+
* action again (its form opens in the conversation). False when this
|
|
159
|
+
* widget has no live-support action. */
|
|
160
|
+
reconnectSupport: () => boolean;
|
|
229
161
|
/** Add/update/remove local-only bubbles used by the live voice capture UI. */
|
|
230
162
|
appendUserDraft: (content: string) => string;
|
|
231
163
|
patchMessage: (id: string, fields: Partial<ChatMessage>) => void;
|
|
@@ -235,9 +167,15 @@ interface ChatApi {
|
|
|
235
167
|
/** Submit an inline action form; persists identity so Case-1 auto-handoff can fire later. */
|
|
236
168
|
submitForm: (type: string, payload: Record<string, unknown>, identity?: Visitor, /** Backend-declared endpoint; authoritative when present. */
|
|
237
169
|
endpointOverride?: string) => Promise<ActionResult>;
|
|
170
|
+
confirmHostedBooking: (inquiryId: string, eventUri: string, inviteeUri: string) => Promise<DemoBooking | undefined>;
|
|
238
171
|
transcribe: (audio: Blob | string, mimeType: string, languageHint?: string, durationSeconds?: number) => Promise<string>;
|
|
239
|
-
|
|
240
|
-
|
|
172
|
+
uploadAttachment: (fileBase64: string, mimeType: string, filename: string, analyze: boolean) => Promise<{
|
|
173
|
+
id: string;
|
|
174
|
+
text: string;
|
|
175
|
+
analysisFailed: boolean;
|
|
176
|
+
}>;
|
|
177
|
+
/** The file attached to a visitor message, for preview. */
|
|
178
|
+
loadAttachment: (message: Pick<ChatMessage, 'id'>, attachment: MessageAttachment, index?: number) => Promise<Blob>;
|
|
241
179
|
searchGifs: (query: string) => Promise<GifResult[]>;
|
|
242
180
|
/** Booking availability in a window (booked slots + connected-calendar busy ranges). */
|
|
243
181
|
demoSlots: (fromISO: string, toISO: string) => Promise<DemoSlotsResult>;
|
|
@@ -272,7 +210,116 @@ interface ChatApi {
|
|
|
272
210
|
}
|
|
273
211
|
declare const useChat: (transport: Transport, config: ResolvedConfig, active?: boolean) => ChatApi;
|
|
274
212
|
//#endregion
|
|
213
|
+
//#region src/components.d.ts
|
|
214
|
+
/** Submit handler shared by the forms + handoff card. */
|
|
215
|
+
type SubmitForm = (type: string, payload: Record<string, unknown>, identity?: Visitor, /** Backend-declared endpoint; authoritative when present. */
|
|
216
|
+
endpointOverride?: string) => Promise<ActionResult>;
|
|
217
|
+
type ConfirmHostedBooking = (inquiryId: string, eventUri: string, inviteeUri: string) => Promise<DemoBooking | undefined>;
|
|
218
|
+
declare const ActionsArea: ({
|
|
219
|
+
actions,
|
|
220
|
+
descriptors,
|
|
221
|
+
visitor,
|
|
222
|
+
onSubmitForm,
|
|
223
|
+
onDemoSlots,
|
|
224
|
+
onConfirmHostedBooking,
|
|
225
|
+
scheduler,
|
|
226
|
+
exclude,
|
|
227
|
+
openAction,
|
|
228
|
+
translations,
|
|
229
|
+
onClose
|
|
230
|
+
}: {
|
|
231
|
+
/** Legacy tool ids. Used only when `descriptors` is absent (older backend). */
|
|
232
|
+
actions?: string[];
|
|
233
|
+
/** Structured descriptors — preferred. */
|
|
234
|
+
descriptors?: PublicChatAction[];
|
|
235
|
+
visitor: Visitor;
|
|
236
|
+
onSubmitForm: SubmitForm;
|
|
237
|
+
onDemoSlots?: (fromISO: string, toISO: string) => Promise<DemoSlotsResult>;
|
|
238
|
+
onConfirmHostedBooking?: ConfirmHostedBooking;
|
|
239
|
+
scheduler?: SchedulerInfo;
|
|
240
|
+
exclude?: string[];
|
|
241
|
+
/** Action id the backend resolved for this turn — opens its form directly. */
|
|
242
|
+
openAction?: string;
|
|
243
|
+
/** Locale-specific copy keyed by stable action ID. */
|
|
244
|
+
translations?: Record<string, WidgetActionTranslation>;
|
|
245
|
+
/** A host that shows the actions in its own panel: closing or cancelling
|
|
246
|
+
* the action closes that panel instead of returning to the action menu. */
|
|
247
|
+
onClose?: () => void;
|
|
248
|
+
}) => JSX.Element | null;
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/style-rules.d.ts
|
|
251
|
+
/**
|
|
252
|
+
* Picks the rules for some components out of a stylesheet, so another
|
|
253
|
+
* surface can render those components without the whole widget stylesheet.
|
|
254
|
+
*
|
|
255
|
+
* A rule is kept when its selector names one of the class prefixes; at-rules
|
|
256
|
+
* such as @media keep only their matching inner rules and are dropped when
|
|
257
|
+
* none match. Comments are removed. This is a small parser for our own,
|
|
258
|
+
* well-formed stylesheet — not a general CSS parser.
|
|
259
|
+
*/
|
|
260
|
+
declare const selectStyleRules: (css: string, classPrefixes: string[]) => string;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/transcript.d.ts
|
|
263
|
+
/** A transcript worth sending as the visitor's turn: annotations stripped,
|
|
264
|
+
* and neither noise, silence nor a leaked transcription prompt. Returns ''
|
|
265
|
+
* when there is nothing to send. */
|
|
266
|
+
declare const usableTranscript: (text: string) => string;
|
|
267
|
+
/** The microphone picked up the AI's own reply from the speakers, not the
|
|
268
|
+
* visitor (shared with every voice surface). */
|
|
269
|
+
declare const looksLikeEcho: (transcript: string, spoken: string) => boolean;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/audio.d.ts
|
|
272
|
+
interface VoiceAudioCapabilities {
|
|
273
|
+
echoCancellation?: boolean;
|
|
274
|
+
noiseSuppression?: boolean;
|
|
275
|
+
autoGainControl?: boolean;
|
|
276
|
+
channelCount?: boolean;
|
|
277
|
+
voiceIsolation?: boolean;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Build a best-effort microphone profile for conversational speech. Every
|
|
281
|
+
* enhancement is capability-driven and optional, so unsupported processing
|
|
282
|
+
* cannot make microphone permission fail.
|
|
283
|
+
*/
|
|
284
|
+
declare const createVoiceAudioConstraints: (deviceId?: string, supported?: VoiceAudioCapabilities) => MediaTrackConstraints;
|
|
285
|
+
interface AdaptiveVoiceActivityOptions {
|
|
286
|
+
calibrationSamples?: number;
|
|
287
|
+
ambientWindowSamples?: number;
|
|
288
|
+
ambientPercentile?: number;
|
|
289
|
+
smoothing?: number;
|
|
290
|
+
minimumNoiseFloor?: number;
|
|
291
|
+
speechToNoiseRatio?: number;
|
|
292
|
+
quietToNoiseRatio?: number;
|
|
293
|
+
minimumEndSilenceMs?: number;
|
|
294
|
+
maximumEndSilenceMs?: number;
|
|
295
|
+
}
|
|
296
|
+
interface VoiceActivitySample {
|
|
297
|
+
speech: boolean;
|
|
298
|
+
quiet: boolean;
|
|
299
|
+
calibrated: boolean;
|
|
300
|
+
noiseFloor: number;
|
|
301
|
+
speechThreshold: number;
|
|
302
|
+
quietThreshold: number;
|
|
303
|
+
endOfSpeechDelayMs: number;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Learn the room's ambient level continuously and classify relative changes.
|
|
307
|
+
* The detector is synchronous and runs on samples already collected for the
|
|
308
|
+
* level meter, so it adds no network request or post-recording delay.
|
|
309
|
+
*/
|
|
310
|
+
declare const createAdaptiveVoiceActivityDetector: (options?: AdaptiveVoiceActivityOptions) => {
|
|
311
|
+
observe: (rms: number) => VoiceActivitySample;
|
|
312
|
+
reset: () => void;
|
|
313
|
+
};
|
|
314
|
+
declare const createPreferredAudioRecorder: (stream: MediaStream) => MediaRecorder;
|
|
315
|
+
declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined) => void;
|
|
316
|
+
//#endregion
|
|
275
317
|
//#region src/runtime.d.ts
|
|
276
|
-
|
|
318
|
+
/**
|
|
319
|
+
* The widget's action buttons, forms and booking picker, for surfaces that
|
|
320
|
+
* render ActionsArea. They read the --cf-* theme variables, which the host
|
|
321
|
+
* surface maps onto its own theme.
|
|
322
|
+
*/
|
|
323
|
+
declare const WIDGET_ACTION_STYLES: string;
|
|
277
324
|
//#endregion
|
|
278
|
-
export { type ActionResult, type AnalyticsVisualization, type BootstrapInfo, type ChatApi, type ChatArtifact, type ChatMessage, type DemoSlotsResult, type HistoryEntry, type PublicChatAction, type PublicChatActionField, type ResolvedConfig, ResultTable, type Source, type Transport, WidgetAnalyticsChart, type WidgetConfig, type WidgetThemeTokens, type WidgetUser, buildWidgetAnalyticsChartModel, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, formatResultCell, renderRich, resolveConfig, serializeResultCsv, stopRecorderWithFlush, useChat };
|
|
325
|
+
export { type ActionResult, ActionsArea, type AnalyticsVisualization, type BootstrapInfo, type ChatApi, type ChatArtifact, type ChatMessage, type DemoSlotsResult, type HistoryEntry, type MessageAttachment, type PublicChatAction, type PublicChatActionField, type ResolvedConfig, ResultTable, type Source, StringsProvider, type Transport, type VoiceReply, WIDGET_ACTION_STYLES, WidgetAnalyticsChart, type WidgetConfig, type WidgetThemeTokens, type WidgetUser, analyticsResultDetails, buildWidgetAnalyticsChartModel, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, looksLikeEcho, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, stopRecorderWithFlush, usableTranscript, useChat };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as e,G as t,J as n,K as r,W as i,X as a,Y as o,_ as s,a as c,c as l,f as u,g as d,i as f,l as p,n as m,o as h,q as g,r as _,s as v,t as y,z as b}from"./styles-DwSTSmZb.mjs";const x=(e,t)=>{let n=e.replace(/\/\*[\s\S]*?\*\//g,``),r=e=>t.some(t=>e.includes(t)),i=[],a=0;for(;a<n.length;){let e=n.indexOf(`{`,a);if(e<0)break;let o=n.slice(a,e).trim(),s=1,c=e+1;for(;c<n.length&&s>0;)n[c]===`{`?s++:n[c]===`}`&&s--,c++;let l=n.slice(e+1,c-1);if(o.startsWith(`@`))if(/^@(media|supports|container)\b/.test(o)){let e=x(l,t);e&&i.push(`${o} {\n${e}\n}`)}else /^@keyframes\b/.test(o)&&r(o)&&i.push(`${o} {${l}}`);else r(o)&&i.push(`${o} {${l}}`);a=c}return i.join(`
|
|
2
|
+
`)},S=(e,t,n)=>i(e,t,n),C=x(y,[`.cf-action`,`.cf-form`,`.cf-booking`]);export{s as ActionsArea,t as ResultTable,b as StringsProvider,C as WIDGET_ACTION_STYLES,n as WidgetAnalyticsChart,S as analyticsResultDetails,o as buildWidgetAnalyticsChartModel,h as createAdaptiveVoiceActivityDetector,a as createChatTransport,v as createPreferredAudioRecorder,l as createVoiceAudioConstraints,_ as findLiveSupportAction,r as formatResultCell,u as looksLikeEcho,f as reconnectableHandbackId,e as renderRich,m as resolveConfig,x as selectStyleRules,g as serializeResultCsv,p as stopRecorderWithFlush,d as usableTranscript,c as useChat};
|