@accurix/centrinfo-widget 5.2.1 → 5.4.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 +231 -38
- package/dist/bundle-ar-D_Sk4igF.mjs +1 -0
- package/dist/bundle-ar-fKjs-fvS.cjs +1 -0
- package/dist/bundle-de-BST4qEm1.cjs +1 -0
- package/dist/bundle-de-BWnVOyv0.mjs +1 -0
- package/dist/bundle-es-Bes8ddxv.mjs +1 -0
- package/dist/bundle-es-Bfphsx9c.cjs +1 -0
- package/dist/bundle-fr-D1QlfFID.mjs +1 -0
- package/dist/bundle-fr-X5Ian15d.cjs +1 -0
- package/dist/bundle-it-9j6g91Cu.mjs +1 -0
- package/dist/bundle-it-C2HPnGql.cjs +1 -0
- package/dist/bundle-pt-BK9LBxix.mjs +1 -0
- package/dist/bundle-pt-BMcCSSgB.cjs +1 -0
- package/dist/bundle-sw-BKWnwk-0.cjs +1 -0
- package/dist/bundle-sw-DA2XuFS_.mjs +1 -0
- package/dist/cdn/centrinfo-widget-dev.js +35 -23
- package/dist/cdn/centrinfo-widget-locale-ar.js +4 -0
- package/dist/cdn/centrinfo-widget-locale-de.js +4 -0
- package/dist/cdn/centrinfo-widget-locale-es.js +4 -0
- package/dist/cdn/centrinfo-widget-locale-fr.js +4 -0
- package/dist/cdn/centrinfo-widget-locale-it.js +4 -0
- package/dist/cdn/centrinfo-widget-locale-pt.js +4 -0
- package/dist/cdn/centrinfo-widget-locale-sw.js +4 -0
- package/dist/cdn/centrinfo-widget-voice.js +272 -0
- package/dist/cdn/centrinfo-widget.js +154 -128
- package/dist/cdn/manifest.json +57 -9
- package/dist/dev-transports-DP4ilDW1.mjs +13 -0
- package/dist/dev-transports-uGHAao9W.cjs +13 -0
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -1
- package/dist/runtime.cjs +2 -2
- package/dist/runtime.d.cts +128 -11
- package/dist/runtime.d.mts +122 -8
- package/dist/runtime.d.ts +479 -0
- package/dist/runtime.mjs +2 -2
- package/dist/speech-detector-runtime-D5GpV8VJ.cjs +68 -0
- package/dist/speech-detector-runtime-D7gguFpP.mjs +68 -0
- package/dist/styles-BWPJrttg.cjs +3563 -0
- package/dist/styles-C8MXPiR-.mjs +3563 -0
- package/dist/{types-95uGbSpk.d.mts → types-M-juCXr7.d.mts} +558 -93
- package/dist/{types-DAYxNBhI.d.cts → types-sRV3p0Gu.d.cts} +549 -87
- package/package.json +4 -3
- package/dist/dev-transports-DqSPyIEz.mjs +0 -1
- package/dist/dev-transports-KlSdSZpj.cjs +0 -1
- package/dist/styles-CCw1cP6m.cjs +0 -3543
- package/dist/styles-CiqV_OsG.mjs +0 -3543
package/dist/runtime.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`./styles-
|
|
2
|
-
`)},n=(t,n,r)=>e.
|
|
1
|
+
const e=require(`./styles-BWPJrttg.cjs`),t=(e,n)=>{let r=e.replace(/\/\*[\s\S]*?\*\//g,``),i=e=>n.some(t=>e.includes(t)),a=[],o=0;for(;o<r.length;){let e=r.indexOf(`{`,o);if(e<0)break;let s=r.slice(o,e).trim(),c=1,l=e+1;for(;l<r.length&&c>0;)r[l]===`{`?c++:r[l]===`}`&&c--,l++;let u=r.slice(e+1,l-1);if(s.startsWith(`@`))if(/^@(media|supports|container)\b/.test(s)){let e=t(u,n);e&&a.push(`${s} {\n${e}\n}`)}else /^@keyframes\b/.test(s)&&i(s)&&a.push(`${s} {${u}}`);else i(s)&&a.push(`${s} {${u}}`);o=l}return a.join(`
|
|
2
|
+
`)},n=(t,n,r)=>e.lt(t,n,r),r=t(e.t,[`.cf-action`,`.cf-form`,`.cf-booking`]),i=t(e.t,[`cf-typing`]),a=t(e.t,[`cf-assistant-card__stage--local`,`cf-assistant-card__media`,`cf-assistant-card__avatar-stage`,`cf-assistant-card__face`,`cf-assistant-card__initials`,`cf-assistant-card__eye`,`cf-assistant-card__mouth`,`cf-avatar-preset--`,`cf-mouth-talk`,`cf-avatar-nod`]);exports.ANALYTICS_MODEL_SELECTOR_STYLES=e.X,exports.ActionsArea=e.y,exports.AnalyticsModelSelector=e.Z,exports.AssistantAvatarFace=e.x,exports.DEFAULT_STRINGS=e.Q,exports.PendingReply=e.D,exports.ResultTable=e.ut,exports.StringsProvider=e.et,exports.VoiceFormsProvider=e.H,exports.WIDGET_ACTION_STYLES=r,exports.WIDGET_ASSISTANT_AVATAR_STYLES=a,exports.WIDGET_PENDING_STYLES=i,exports.WidgetAnalyticsChart=e.pt,exports.analyticsResultDetails=n,exports.automaticMessageAction=e.U,exports.buildWidgetAnalyticsChartModel=e.mt,exports.copyableChatResponse=e.W,exports.createAdaptiveVoiceActivityDetector=e.u,exports.createChatTransport=e.it,exports.createPreferredAudioRecorder=e.d,exports.createVoiceAudioConstraints=e.f,exports.findLiveSupportAction=e.s,exports.formatResultCell=e.dt,exports.loadWidgetLocale=e.n,exports.localizeConfig=e.i,exports.looksLikeEcho=e.g,exports.mergeStrings=e.tt,exports.normalizeChatCustomization=e.o,exports.reconnectableHandbackId=e.c,exports.renderRich=e.j,exports.resolveConfig=e.a,exports.selectStyleRules=t,exports.serializeResultCsv=e.ft,exports.setWidgetLocaleLoader=e.r,exports.stopRecorderWithFlush=e.p,exports.usableTranscript=e.v,exports.useChat=e.l;
|
package/dist/runtime.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import * as
|
|
1
|
+
import { A as WidgetStrings, B as ResultLabels, C as PublicChatActionField, D as VoiceAnswer, E as LiveVoiceTransport, F as AnalyticsVisualization$1, H as AnalyticsExplanationInput, I as AnalyticsVisualizationColumn, L as ResultColumn, N as SdkLanguage, O as DEFAULT_STRINGS, P as AnalyticsComboModel, R as ResultTableClassNames, S as PublicChatAction, T as VoiceFormField, U as AnalyticsGroupComparisonPoint, V as AnalyticsAIExplanationTransport, W as AnalyticsPeriodComparison, _ as AnalyticsVisualization, a as MessageAttachment, b as ExplanationFeedbackInput, c as Visitor, f as WidgetLocaleUpdate, g as AnalyticsModelOption, h as ActionResult, i as FeaturedLink, j as mergeStrings, k as StringsProvider, l as WidgetActionTranslation, m as WidgetUser, n as ChatArtifact, o as SchedulerInfo, p as WidgetThemeTokens, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as DemoBooking, w as Transport, x as GifResult, y as DemoSlotsResult, z as ResultFormatContext } from "./types-sRV3p0Gu.cjs";
|
|
2
|
+
import * as preact3 from "preact";
|
|
3
3
|
import { JSX } from "preact";
|
|
4
4
|
|
|
5
5
|
//#region ../centrinfo-results/src/chart.d.ts
|
|
@@ -48,7 +48,7 @@ declare const WidgetAnalyticsChart: ({
|
|
|
48
48
|
expanded?: boolean;
|
|
49
49
|
/** Class prefix of the surface (`cf` widget, `ca` chat app). */
|
|
50
50
|
classPrefix?: string;
|
|
51
|
-
}) =>
|
|
51
|
+
}) => preact3.JSX.Element;
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region ../centrinfo-results/src/result.d.ts
|
|
54
54
|
declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn, context?: ResultFormatContext) => string;
|
|
@@ -65,6 +65,8 @@ interface ResultTableProps {
|
|
|
65
65
|
expanded?: boolean;
|
|
66
66
|
classNames?: ResultTableClassNames;
|
|
67
67
|
emptyLabel?: string;
|
|
68
|
+
/** Any subset of the result labels; English fills the rest. */
|
|
69
|
+
labels?: Partial<ResultLabels>;
|
|
68
70
|
}
|
|
69
71
|
declare const ResultTable: ({
|
|
70
72
|
rows,
|
|
@@ -74,8 +76,9 @@ declare const ResultTable: ({
|
|
|
74
76
|
format,
|
|
75
77
|
expanded,
|
|
76
78
|
classNames,
|
|
77
|
-
emptyLabel
|
|
78
|
-
|
|
79
|
+
emptyLabel,
|
|
80
|
+
labels: labelOverrides
|
|
81
|
+
}: ResultTableProps) => preact3.JSX.Element;
|
|
79
82
|
//#endregion
|
|
80
83
|
//#region ../centrinfo-results/src/result-details.d.ts
|
|
81
84
|
interface AnalyticsResultDetail {
|
|
@@ -83,9 +86,33 @@ interface AnalyticsResultDetail {
|
|
|
83
86
|
value: string;
|
|
84
87
|
}
|
|
85
88
|
//#endregion
|
|
89
|
+
//#region src/localization.d.ts
|
|
90
|
+
/** Everything the widget shows for one language: its own chrome + analytics results. */
|
|
91
|
+
interface WidgetLocaleBundle {
|
|
92
|
+
widget: Partial<WidgetStrings>;
|
|
93
|
+
results: Partial<ResultLabels>;
|
|
94
|
+
}
|
|
95
|
+
type WidgetLocaleModule = {
|
|
96
|
+
default: WidgetLocaleBundle;
|
|
97
|
+
};
|
|
98
|
+
type WidgetLocaleLoader = (language: SdkLanguage) => Promise<WidgetLocaleModule>;
|
|
99
|
+
/**
|
|
100
|
+
* Replace how bundled catalogs are fetched. The CDN build points this at the
|
|
101
|
+
* sibling `centrinfo-widget-locale-<lang>.js` chunks.
|
|
102
|
+
*/
|
|
103
|
+
declare const setWidgetLocaleLoader: (next: WidgetLocaleLoader) => void;
|
|
104
|
+
/**
|
|
105
|
+
* The bundled catalogs for a locale (`fr-CA` → `fr`). English, unbundled
|
|
106
|
+
* languages, the empty Yoruba/Hausa/Igbo slots and failed loads resolve to
|
|
107
|
+
* an empty bundle, so every key falls back to English. Never rejects.
|
|
108
|
+
*/
|
|
109
|
+
declare const loadWidgetLocale: (locale: string | undefined) => Promise<WidgetLocaleBundle>;
|
|
110
|
+
//#endregion
|
|
86
111
|
//#region src/config.d.ts
|
|
87
|
-
interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'branding' | 'composer' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'locale' | 'dir' | 'translations' | 'user' | 'analyticsContextToken' | 'analyticsModelId' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onOpenAnalyticsSource' | 'onAction' | 'onHandoff'>> {
|
|
112
|
+
interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'workspaceUrl' | 'analyticsRenderer' | 'branding' | 'composer' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'strings' | 'locale' | 'dir' | 'translations' | 'user' | 'analyticsContextToken' | 'analyticsModelId' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onOpenAnalyticsSource' | 'onAction' | 'onHandoff'>> {
|
|
88
113
|
accentColor?: string;
|
|
114
|
+
workspaceUrl?: string;
|
|
115
|
+
analyticsRenderer?: 'hosted' | 'local';
|
|
89
116
|
composer?: WidgetConfig['composer'];
|
|
90
117
|
agentName?: string;
|
|
91
118
|
agentAvatarUrl?: string;
|
|
@@ -118,6 +145,14 @@ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'br
|
|
|
118
145
|
onAction?: WidgetConfig['onAction'];
|
|
119
146
|
onHandoff?: WidgetConfig['onHandoff'];
|
|
120
147
|
}
|
|
148
|
+
/** The language-dependent part of a resolved config. */
|
|
149
|
+
type LocalizedConfig = Pick<ResolvedConfig, 'strings' | 'locale' | 'dir' | 'actionTranslations'>;
|
|
150
|
+
/**
|
|
151
|
+
* Text for a config in its locale. Layers, lowest first: English, the bundled
|
|
152
|
+
* catalog (`bundle`), `translations[locale]`, `labels`, `strings`. Analytics
|
|
153
|
+
* result labels layer the same way over the results catalog.
|
|
154
|
+
*/
|
|
155
|
+
declare const localizeConfig: (cfg: Pick<WidgetConfig, "locale" | "dir" | "labels" | "strings" | "translations">, bundle?: WidgetLocaleBundle) => LocalizedConfig;
|
|
121
156
|
declare const resolveConfig: (input: WidgetConfig) => ResolvedConfig;
|
|
122
157
|
//#endregion
|
|
123
158
|
//#region src/api/factory.d.ts
|
|
@@ -131,13 +166,59 @@ declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
|
131
166
|
declare const renderRich: (text: string) => JSX.Element[];
|
|
132
167
|
//#endregion
|
|
133
168
|
//#region src/response-content.d.ts
|
|
134
|
-
|
|
135
|
-
|
|
169
|
+
type CopyStrings = Pick<WidgetStrings, 'copyResultData' | 'copyRowsReturned' | 'copyRowsReturnedOf' | 'copyTruncated' | 'copyTotals'>;
|
|
170
|
+
/**
|
|
171
|
+
* The text and structured values actually displayed with a chat reply.
|
|
172
|
+
* `strings` localizes the table summary lines (English by default).
|
|
173
|
+
*/
|
|
174
|
+
declare const copyableChatResponse: (message: ChatMessage, strings?: CopyStrings) => string;
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/message-action.d.ts
|
|
177
|
+
/** An AI proposal never authorizes opening a support form. Manual contact
|
|
178
|
+
* controls still open it; other requested action forms retain their behaviour. */
|
|
179
|
+
declare const automaticMessageAction: (selected: string | undefined, descriptors?: PublicChatAction[], visitorRequested?: boolean) => string | undefined;
|
|
136
180
|
//#endregion
|
|
137
181
|
//#region src/result-details.d.ts
|
|
138
182
|
/** Reader-safe result context shared by the floating widget and chat app. */
|
|
139
183
|
declare const analyticsResultDetails: (result: AnalyticsVisualization, labels?: Partial<ResultLabels>, locale?: string) => AnalyticsResultDetail[];
|
|
140
184
|
//#endregion
|
|
185
|
+
//#region src/voice-forms.d.ts
|
|
186
|
+
interface VoiceFormSnapshot {
|
|
187
|
+
actionId: string;
|
|
188
|
+
submitLabel: string;
|
|
189
|
+
fields: VoiceFormField[];
|
|
190
|
+
values: Record<string, string>;
|
|
191
|
+
ready: boolean;
|
|
192
|
+
notice?: string;
|
|
193
|
+
reviewNote?: string;
|
|
194
|
+
autoStart?: boolean;
|
|
195
|
+
}
|
|
196
|
+
interface VoiceFormTarget {
|
|
197
|
+
key: string;
|
|
198
|
+
scopeId?: string;
|
|
199
|
+
read: () => VoiceFormSnapshot;
|
|
200
|
+
apply: (values: Record<string, string>) => void;
|
|
201
|
+
submit: () => Promise<ActionResult | null>;
|
|
202
|
+
cancel: () => void;
|
|
203
|
+
}
|
|
204
|
+
interface VoiceFormController {
|
|
205
|
+
readonly enabled: boolean;
|
|
206
|
+
readonly busy: boolean;
|
|
207
|
+
readonly activeScope: string | undefined;
|
|
208
|
+
setEnabled: (enabled: boolean, delegated?: boolean) => void;
|
|
209
|
+
register: (target: VoiceFormTarget) => () => void;
|
|
210
|
+
refresh: (key: string) => void;
|
|
211
|
+
handleTranscript: (text: string, messageId?: string) => boolean;
|
|
212
|
+
delegateTranscript: (text: string, signal: AbortSignal) => Promise<VoiceFormDelegation | undefined>;
|
|
213
|
+
stop: () => void;
|
|
214
|
+
onIdle: () => void;
|
|
215
|
+
}
|
|
216
|
+
interface VoiceFormDelegation {
|
|
217
|
+
answer?: string | null;
|
|
218
|
+
userMessageId?: string;
|
|
219
|
+
}
|
|
220
|
+
declare const VoiceFormsProvider: preact3.Provider<VoiceFormController | null>;
|
|
221
|
+
//#endregion
|
|
141
222
|
//#region src/useChat.d.ts
|
|
142
223
|
/** One past conversation, for the in-widget history list. */
|
|
143
224
|
interface HistoryEntry {
|
|
@@ -161,9 +242,21 @@ interface VoiceReply {
|
|
|
161
242
|
agentId?: string;
|
|
162
243
|
}
|
|
163
244
|
interface SendOpts {
|
|
245
|
+
signal?: AbortSignal;
|
|
164
246
|
imageUrl?: string;
|
|
165
247
|
/** Voice-call turns should speak the assistant reply using provider TTS when configured. */
|
|
166
248
|
forceVoicePlayback?: boolean;
|
|
249
|
+
/** The host collects and confirms action fields through its active voice call. */
|
|
250
|
+
voiceFormEntry?: boolean;
|
|
251
|
+
/** Spoken in a voice call whose audio plays elsewhere (realtime voice):
|
|
252
|
+
* the answer may still carry a call control. Implied by forceVoicePlayback. */
|
|
253
|
+
voiceCall?: boolean;
|
|
254
|
+
/** Voice turns only: receives the call control the answer asked for. */
|
|
255
|
+
onVoiceControl?: (value: string) => void;
|
|
256
|
+
/** The call is waiting (the visitor asked the assistant to hold): the
|
|
257
|
+
* answer is quiet — neither shown nor spoken, and the turn is removed —
|
|
258
|
+
* unless it reports that the visitor resumed. */
|
|
259
|
+
voiceWaiting?: boolean;
|
|
167
260
|
/** Existing local user bubble to turn into the sent visitor message. */
|
|
168
261
|
userMessageId?: string;
|
|
169
262
|
/** Display name of an attached file (shown as a chip on the user bubble). */
|
|
@@ -185,6 +278,12 @@ interface OutgoingAttachment {
|
|
|
185
278
|
file?: Blob;
|
|
186
279
|
}
|
|
187
280
|
interface ChatApi {
|
|
281
|
+
voiceForms: VoiceFormController;
|
|
282
|
+
liveVoice?: LiveVoiceTransport;
|
|
283
|
+
delegateVoice: (question: string, signal: AbortSignal, info?: {
|
|
284
|
+
waiting: boolean;
|
|
285
|
+
}) => Promise<VoiceAnswer | null>;
|
|
286
|
+
setLiveSpeaking: (active: boolean) => void;
|
|
188
287
|
analyticsModels: AnalyticsModelOption[];
|
|
189
288
|
analyticsModelId: string;
|
|
190
289
|
selectAnalyticsModel: (id: string) => void;
|
|
@@ -311,6 +410,18 @@ declare const useChat: (transport: Transport, config: ResolvedConfig, active?: b
|
|
|
311
410
|
type SubmitForm = (type: string, payload: Record<string, unknown>, identity?: Visitor, /** Backend-declared endpoint; authoritative when present. */
|
|
312
411
|
endpointOverride?: string) => Promise<ActionResult>;
|
|
313
412
|
type ConfirmHostedBooking = (inquiryId: string, eventUri: string, inviteeUri: string) => Promise<DemoBooking | undefined>;
|
|
413
|
+
declare const AssistantAvatarFace: ({
|
|
414
|
+
persona
|
|
415
|
+
}: {
|
|
416
|
+
persona: BootstrapInfo;
|
|
417
|
+
}) => JSX.Element;
|
|
418
|
+
declare const PendingReply: ({
|
|
419
|
+
className,
|
|
420
|
+
label
|
|
421
|
+
}: {
|
|
422
|
+
className?: string;
|
|
423
|
+
label?: string;
|
|
424
|
+
}) => JSX.Element;
|
|
314
425
|
declare const ActionsArea: ({
|
|
315
426
|
actions,
|
|
316
427
|
descriptors,
|
|
@@ -323,7 +434,9 @@ declare const ActionsArea: ({
|
|
|
323
434
|
openAction,
|
|
324
435
|
showTrigger,
|
|
325
436
|
translations,
|
|
326
|
-
onClose
|
|
437
|
+
onClose,
|
|
438
|
+
voiceAutoStart,
|
|
439
|
+
voiceScopeId
|
|
327
440
|
}: {
|
|
328
441
|
/** Legacy tool ids. Used only when `descriptors` is absent (older backend). */
|
|
329
442
|
actions?: string[];
|
|
@@ -344,6 +457,8 @@ declare const ActionsArea: ({
|
|
|
344
457
|
/** A host that shows the actions in its own panel: closing or cancelling
|
|
345
458
|
* the action closes that panel instead of returning to the action menu. */
|
|
346
459
|
onClose?: () => void;
|
|
460
|
+
voiceAutoStart?: boolean;
|
|
461
|
+
voiceScopeId?: string;
|
|
347
462
|
}) => JSX.Element | null;
|
|
348
463
|
//#endregion
|
|
349
464
|
//#region src/analytics-model-selector.d.ts
|
|
@@ -362,7 +477,7 @@ declare const AnalyticsModelSelector: ({
|
|
|
362
477
|
disabled?: boolean;
|
|
363
478
|
copy?: Partial<WidgetStrings>;
|
|
364
479
|
classPrefix?: string;
|
|
365
|
-
}) =>
|
|
480
|
+
}) => preact3.JSX.Element | null;
|
|
366
481
|
//#endregion
|
|
367
482
|
//#region src/customization.d.ts
|
|
368
483
|
/** Translate the simple options once; explicit advanced options take precedence. */
|
|
@@ -442,5 +557,7 @@ declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined
|
|
|
442
557
|
* surface maps onto its own theme.
|
|
443
558
|
*/
|
|
444
559
|
declare const WIDGET_ACTION_STYLES: string;
|
|
560
|
+
declare const WIDGET_PENDING_STYLES: string;
|
|
561
|
+
declare const WIDGET_ASSISTANT_AVATAR_STYLES: string;
|
|
445
562
|
//#endregion
|
|
446
|
-
export { ANALYTICS_MODEL_SELECTOR_STYLES, type ActionResult, ActionsArea, AnalyticsModelSelector, 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, copyableChatResponse, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, looksLikeEcho, normalizeChatCustomization, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, stopRecorderWithFlush, usableTranscript, useChat };
|
|
563
|
+
export { ANALYTICS_MODEL_SELECTOR_STYLES, type ActionResult, ActionsArea, AnalyticsModelSelector, type AnalyticsVisualization, AssistantAvatarFace, type BootstrapInfo, type ChatApi, type ChatArtifact, type ChatMessage, DEFAULT_STRINGS, type DemoSlotsResult, type HistoryEntry, type LocalizedConfig, type MessageAttachment, PendingReply, type PublicChatAction, type PublicChatActionField, type ResolvedConfig, ResultTable, type Source, StringsProvider, type Transport, VoiceFormsProvider, type VoiceReply, WIDGET_ACTION_STYLES, WIDGET_ASSISTANT_AVATAR_STYLES, WIDGET_PENDING_STYLES, WidgetAnalyticsChart, type WidgetConfig, type WidgetLocaleBundle, type WidgetLocaleLoader, type WidgetLocaleUpdate, type WidgetThemeTokens, type WidgetUser, analyticsResultDetails, automaticMessageAction, buildWidgetAnalyticsChartModel, copyableChatResponse, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, loadWidgetLocale, localizeConfig, looksLikeEcho, mergeStrings, normalizeChatCustomization, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, setWidgetLocaleLoader, stopRecorderWithFlush, usableTranscript, useChat };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import * as
|
|
1
|
+
import { A as WidgetStrings, B as ResultLabels, C as PublicChatActionField, D as VoiceAnswer, E as LiveVoiceTransport, F as ResultTable, H as AnalyticsExplanationInput, I as formatResultCell, L as serializeResultCsv, N as SdkLanguage, O as DEFAULT_STRINGS, P as AnalyticsResultDetail, R as WidgetAnalyticsChart, S as PublicChatAction, T as VoiceFormField, V as AnalyticsAIExplanationTransport, _ as AnalyticsVisualization, a as MessageAttachment, b as ExplanationFeedbackInput, c as Visitor, f as WidgetLocaleUpdate, g as AnalyticsModelOption, h as ActionResult, i as FeaturedLink, j as mergeStrings, k as StringsProvider, l as WidgetActionTranslation, m as WidgetUser, n as ChatArtifact, o as SchedulerInfo, p as WidgetThemeTokens, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as DemoBooking, w as Transport, x as GifResult, y as DemoSlotsResult, z as buildWidgetAnalyticsChartModel } from "./types-M-juCXr7.mjs";
|
|
2
|
+
import * as preact2 from "preact";
|
|
3
3
|
import { JSX } from "preact";
|
|
4
4
|
|
|
5
|
+
//#region src/localization.d.ts
|
|
6
|
+
/** Everything the widget shows for one language: its own chrome + analytics results. */
|
|
7
|
+
interface WidgetLocaleBundle {
|
|
8
|
+
widget: Partial<WidgetStrings>;
|
|
9
|
+
results: Partial<ResultLabels>;
|
|
10
|
+
}
|
|
11
|
+
type WidgetLocaleModule = {
|
|
12
|
+
default: WidgetLocaleBundle;
|
|
13
|
+
};
|
|
14
|
+
type WidgetLocaleLoader = (language: SdkLanguage) => Promise<WidgetLocaleModule>;
|
|
15
|
+
/**
|
|
16
|
+
* Replace how bundled catalogs are fetched. The CDN build points this at the
|
|
17
|
+
* sibling `centrinfo-widget-locale-<lang>.js` chunks.
|
|
18
|
+
*/
|
|
19
|
+
declare const setWidgetLocaleLoader: (next: WidgetLocaleLoader) => void;
|
|
20
|
+
/**
|
|
21
|
+
* The bundled catalogs for a locale (`fr-CA` → `fr`). English, unbundled
|
|
22
|
+
* languages, the empty Yoruba/Hausa/Igbo slots and failed loads resolve to
|
|
23
|
+
* an empty bundle, so every key falls back to English. Never rejects.
|
|
24
|
+
*/
|
|
25
|
+
declare const loadWidgetLocale: (locale: string | undefined) => Promise<WidgetLocaleBundle>;
|
|
26
|
+
//#endregion
|
|
5
27
|
//#region src/config.d.ts
|
|
6
|
-
interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'branding' | 'composer' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'locale' | 'dir' | 'translations' | 'user' | 'analyticsContextToken' | 'analyticsModelId' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onOpenAnalyticsSource' | 'onAction' | 'onHandoff'>> {
|
|
28
|
+
interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'workspaceUrl' | 'analyticsRenderer' | 'branding' | 'composer' | 'agentName' | 'agentAvatarUrl' | 'launcherIcon' | 'themeTokens' | 'gifApiKey' | 'labels' | 'strings' | 'locale' | 'dir' | 'translations' | 'user' | 'analyticsContextToken' | 'analyticsModelId' | 'identityToken' | 'getIdentityToken' | 'customLauncherSelector' | 'proactiveMessage' | 'proactiveOnPaths' | 'onOpen' | 'onClose' | 'onShow' | 'onHide' | 'onUnreadChange' | 'onMessage' | 'onOpenAnalyticsSource' | 'onAction' | 'onHandoff'>> {
|
|
7
29
|
accentColor?: string;
|
|
30
|
+
workspaceUrl?: string;
|
|
31
|
+
analyticsRenderer?: 'hosted' | 'local';
|
|
8
32
|
composer?: WidgetConfig['composer'];
|
|
9
33
|
agentName?: string;
|
|
10
34
|
agentAvatarUrl?: string;
|
|
@@ -37,6 +61,14 @@ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'br
|
|
|
37
61
|
onAction?: WidgetConfig['onAction'];
|
|
38
62
|
onHandoff?: WidgetConfig['onHandoff'];
|
|
39
63
|
}
|
|
64
|
+
/** The language-dependent part of a resolved config. */
|
|
65
|
+
type LocalizedConfig = Pick<ResolvedConfig, 'strings' | 'locale' | 'dir' | 'actionTranslations'>;
|
|
66
|
+
/**
|
|
67
|
+
* Text for a config in its locale. Layers, lowest first: English, the bundled
|
|
68
|
+
* catalog (`bundle`), `translations[locale]`, `labels`, `strings`. Analytics
|
|
69
|
+
* result labels layer the same way over the results catalog.
|
|
70
|
+
*/
|
|
71
|
+
declare const localizeConfig: (cfg: Pick<WidgetConfig, "locale" | "dir" | "labels" | "strings" | "translations">, bundle?: WidgetLocaleBundle) => LocalizedConfig;
|
|
40
72
|
declare const resolveConfig: (input: WidgetConfig) => ResolvedConfig;
|
|
41
73
|
//#endregion
|
|
42
74
|
//#region src/api/factory.d.ts
|
|
@@ -50,13 +82,59 @@ declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
|
50
82
|
declare const renderRich: (text: string) => JSX.Element[];
|
|
51
83
|
//#endregion
|
|
52
84
|
//#region src/response-content.d.ts
|
|
53
|
-
|
|
54
|
-
|
|
85
|
+
type CopyStrings = Pick<WidgetStrings, 'copyResultData' | 'copyRowsReturned' | 'copyRowsReturnedOf' | 'copyTruncated' | 'copyTotals'>;
|
|
86
|
+
/**
|
|
87
|
+
* The text and structured values actually displayed with a chat reply.
|
|
88
|
+
* `strings` localizes the table summary lines (English by default).
|
|
89
|
+
*/
|
|
90
|
+
declare const copyableChatResponse: (message: ChatMessage, strings?: CopyStrings) => string;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/message-action.d.ts
|
|
93
|
+
/** An AI proposal never authorizes opening a support form. Manual contact
|
|
94
|
+
* controls still open it; other requested action forms retain their behaviour. */
|
|
95
|
+
declare const automaticMessageAction: (selected: string | undefined, descriptors?: PublicChatAction[], visitorRequested?: boolean) => string | undefined;
|
|
55
96
|
//#endregion
|
|
56
97
|
//#region src/result-details.d.ts
|
|
57
98
|
/** Reader-safe result context shared by the floating widget and chat app. */
|
|
58
99
|
declare const analyticsResultDetails: (result: AnalyticsVisualization, labels?: Partial<ResultLabels>, locale?: string) => AnalyticsResultDetail[];
|
|
59
100
|
//#endregion
|
|
101
|
+
//#region src/voice-forms.d.ts
|
|
102
|
+
interface VoiceFormSnapshot {
|
|
103
|
+
actionId: string;
|
|
104
|
+
submitLabel: string;
|
|
105
|
+
fields: VoiceFormField[];
|
|
106
|
+
values: Record<string, string>;
|
|
107
|
+
ready: boolean;
|
|
108
|
+
notice?: string;
|
|
109
|
+
reviewNote?: string;
|
|
110
|
+
autoStart?: boolean;
|
|
111
|
+
}
|
|
112
|
+
interface VoiceFormTarget {
|
|
113
|
+
key: string;
|
|
114
|
+
scopeId?: string;
|
|
115
|
+
read: () => VoiceFormSnapshot;
|
|
116
|
+
apply: (values: Record<string, string>) => void;
|
|
117
|
+
submit: () => Promise<ActionResult | null>;
|
|
118
|
+
cancel: () => void;
|
|
119
|
+
}
|
|
120
|
+
interface VoiceFormController {
|
|
121
|
+
readonly enabled: boolean;
|
|
122
|
+
readonly busy: boolean;
|
|
123
|
+
readonly activeScope: string | undefined;
|
|
124
|
+
setEnabled: (enabled: boolean, delegated?: boolean) => void;
|
|
125
|
+
register: (target: VoiceFormTarget) => () => void;
|
|
126
|
+
refresh: (key: string) => void;
|
|
127
|
+
handleTranscript: (text: string, messageId?: string) => boolean;
|
|
128
|
+
delegateTranscript: (text: string, signal: AbortSignal) => Promise<VoiceFormDelegation | undefined>;
|
|
129
|
+
stop: () => void;
|
|
130
|
+
onIdle: () => void;
|
|
131
|
+
}
|
|
132
|
+
interface VoiceFormDelegation {
|
|
133
|
+
answer?: string | null;
|
|
134
|
+
userMessageId?: string;
|
|
135
|
+
}
|
|
136
|
+
declare const VoiceFormsProvider: preact2.Provider<VoiceFormController | null>;
|
|
137
|
+
//#endregion
|
|
60
138
|
//#region src/useChat.d.ts
|
|
61
139
|
/** One past conversation, for the in-widget history list. */
|
|
62
140
|
interface HistoryEntry {
|
|
@@ -80,9 +158,21 @@ interface VoiceReply {
|
|
|
80
158
|
agentId?: string;
|
|
81
159
|
}
|
|
82
160
|
interface SendOpts {
|
|
161
|
+
signal?: AbortSignal;
|
|
83
162
|
imageUrl?: string;
|
|
84
163
|
/** Voice-call turns should speak the assistant reply using provider TTS when configured. */
|
|
85
164
|
forceVoicePlayback?: boolean;
|
|
165
|
+
/** The host collects and confirms action fields through its active voice call. */
|
|
166
|
+
voiceFormEntry?: boolean;
|
|
167
|
+
/** Spoken in a voice call whose audio plays elsewhere (realtime voice):
|
|
168
|
+
* the answer may still carry a call control. Implied by forceVoicePlayback. */
|
|
169
|
+
voiceCall?: boolean;
|
|
170
|
+
/** Voice turns only: receives the call control the answer asked for. */
|
|
171
|
+
onVoiceControl?: (value: string) => void;
|
|
172
|
+
/** The call is waiting (the visitor asked the assistant to hold): the
|
|
173
|
+
* answer is quiet — neither shown nor spoken, and the turn is removed —
|
|
174
|
+
* unless it reports that the visitor resumed. */
|
|
175
|
+
voiceWaiting?: boolean;
|
|
86
176
|
/** Existing local user bubble to turn into the sent visitor message. */
|
|
87
177
|
userMessageId?: string;
|
|
88
178
|
/** Display name of an attached file (shown as a chip on the user bubble). */
|
|
@@ -104,6 +194,12 @@ interface OutgoingAttachment {
|
|
|
104
194
|
file?: Blob;
|
|
105
195
|
}
|
|
106
196
|
interface ChatApi {
|
|
197
|
+
voiceForms: VoiceFormController;
|
|
198
|
+
liveVoice?: LiveVoiceTransport;
|
|
199
|
+
delegateVoice: (question: string, signal: AbortSignal, info?: {
|
|
200
|
+
waiting: boolean;
|
|
201
|
+
}) => Promise<VoiceAnswer | null>;
|
|
202
|
+
setLiveSpeaking: (active: boolean) => void;
|
|
107
203
|
analyticsModels: AnalyticsModelOption[];
|
|
108
204
|
analyticsModelId: string;
|
|
109
205
|
selectAnalyticsModel: (id: string) => void;
|
|
@@ -230,6 +326,18 @@ declare const useChat: (transport: Transport, config: ResolvedConfig, active?: b
|
|
|
230
326
|
type SubmitForm = (type: string, payload: Record<string, unknown>, identity?: Visitor, /** Backend-declared endpoint; authoritative when present. */
|
|
231
327
|
endpointOverride?: string) => Promise<ActionResult>;
|
|
232
328
|
type ConfirmHostedBooking = (inquiryId: string, eventUri: string, inviteeUri: string) => Promise<DemoBooking | undefined>;
|
|
329
|
+
declare const AssistantAvatarFace: ({
|
|
330
|
+
persona
|
|
331
|
+
}: {
|
|
332
|
+
persona: BootstrapInfo;
|
|
333
|
+
}) => JSX.Element;
|
|
334
|
+
declare const PendingReply: ({
|
|
335
|
+
className,
|
|
336
|
+
label
|
|
337
|
+
}: {
|
|
338
|
+
className?: string;
|
|
339
|
+
label?: string;
|
|
340
|
+
}) => JSX.Element;
|
|
233
341
|
declare const ActionsArea: ({
|
|
234
342
|
actions,
|
|
235
343
|
descriptors,
|
|
@@ -242,7 +350,9 @@ declare const ActionsArea: ({
|
|
|
242
350
|
openAction,
|
|
243
351
|
showTrigger,
|
|
244
352
|
translations,
|
|
245
|
-
onClose
|
|
353
|
+
onClose,
|
|
354
|
+
voiceAutoStart,
|
|
355
|
+
voiceScopeId
|
|
246
356
|
}: {
|
|
247
357
|
/** Legacy tool ids. Used only when `descriptors` is absent (older backend). */
|
|
248
358
|
actions?: string[];
|
|
@@ -263,6 +373,8 @@ declare const ActionsArea: ({
|
|
|
263
373
|
/** A host that shows the actions in its own panel: closing or cancelling
|
|
264
374
|
* the action closes that panel instead of returning to the action menu. */
|
|
265
375
|
onClose?: () => void;
|
|
376
|
+
voiceAutoStart?: boolean;
|
|
377
|
+
voiceScopeId?: string;
|
|
266
378
|
}) => JSX.Element | null;
|
|
267
379
|
//#endregion
|
|
268
380
|
//#region src/analytics-model-selector.d.ts
|
|
@@ -281,7 +393,7 @@ declare const AnalyticsModelSelector: ({
|
|
|
281
393
|
disabled?: boolean;
|
|
282
394
|
copy?: Partial<WidgetStrings>;
|
|
283
395
|
classPrefix?: string;
|
|
284
|
-
}) =>
|
|
396
|
+
}) => preact2.JSX.Element | null;
|
|
285
397
|
//#endregion
|
|
286
398
|
//#region src/customization.d.ts
|
|
287
399
|
/** Translate the simple options once; explicit advanced options take precedence. */
|
|
@@ -361,5 +473,7 @@ declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined
|
|
|
361
473
|
* surface maps onto its own theme.
|
|
362
474
|
*/
|
|
363
475
|
declare const WIDGET_ACTION_STYLES: string;
|
|
476
|
+
declare const WIDGET_PENDING_STYLES: string;
|
|
477
|
+
declare const WIDGET_ASSISTANT_AVATAR_STYLES: string;
|
|
364
478
|
//#endregion
|
|
365
|
-
export { ANALYTICS_MODEL_SELECTOR_STYLES, type ActionResult, ActionsArea, AnalyticsModelSelector, 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, copyableChatResponse, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, looksLikeEcho, normalizeChatCustomization, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, stopRecorderWithFlush, usableTranscript, useChat };
|
|
479
|
+
export { ANALYTICS_MODEL_SELECTOR_STYLES, type ActionResult, ActionsArea, AnalyticsModelSelector, type AnalyticsVisualization, AssistantAvatarFace, type BootstrapInfo, type ChatApi, type ChatArtifact, type ChatMessage, DEFAULT_STRINGS, type DemoSlotsResult, type HistoryEntry, type LocalizedConfig, type MessageAttachment, PendingReply, type PublicChatAction, type PublicChatActionField, type ResolvedConfig, ResultTable, type Source, StringsProvider, type Transport, VoiceFormsProvider, type VoiceReply, WIDGET_ACTION_STYLES, WIDGET_ASSISTANT_AVATAR_STYLES, WIDGET_PENDING_STYLES, WidgetAnalyticsChart, type WidgetConfig, type WidgetLocaleBundle, type WidgetLocaleLoader, type WidgetLocaleUpdate, type WidgetThemeTokens, type WidgetUser, analyticsResultDetails, automaticMessageAction, buildWidgetAnalyticsChartModel, copyableChatResponse, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, loadWidgetLocale, localizeConfig, looksLikeEcho, mergeStrings, normalizeChatCustomization, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, setWidgetLocaleLoader, stopRecorderWithFlush, usableTranscript, useChat };
|