@accurix/centrinfo-widget 5.3.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 +229 -37
- 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 +171 -145
- 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 +126 -11
- package/dist/runtime.d.mts +120 -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-CSrYnsOp.d.mts → types-M-juCXr7.d.mts} +551 -98
- package/dist/{types-eBuee08Q.d.cts → types-sRV3p0Gu.d.cts} +542 -92
- package/package.json +4 -3
- package/dist/dev-transports-DqSPyIEz.mjs +0 -1
- package/dist/dev-transports-KlSdSZpj.cjs +0 -1
- package/dist/styles-BUK2S5l_.mjs +0 -3543
- package/dist/styles-BVQRcZkH.cjs +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,8 +86,30 @@ 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' | 'workspaceUrl' | 'analyticsRenderer' | '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;
|
|
89
114
|
workspaceUrl?: string;
|
|
90
115
|
analyticsRenderer?: 'hosted' | 'local';
|
|
@@ -120,6 +145,14 @@ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'wo
|
|
|
120
145
|
onAction?: WidgetConfig['onAction'];
|
|
121
146
|
onHandoff?: WidgetConfig['onHandoff'];
|
|
122
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;
|
|
123
156
|
declare const resolveConfig: (input: WidgetConfig) => ResolvedConfig;
|
|
124
157
|
//#endregion
|
|
125
158
|
//#region src/api/factory.d.ts
|
|
@@ -133,13 +166,59 @@ declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
|
133
166
|
declare const renderRich: (text: string) => JSX.Element[];
|
|
134
167
|
//#endregion
|
|
135
168
|
//#region src/response-content.d.ts
|
|
136
|
-
|
|
137
|
-
|
|
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;
|
|
138
180
|
//#endregion
|
|
139
181
|
//#region src/result-details.d.ts
|
|
140
182
|
/** Reader-safe result context shared by the floating widget and chat app. */
|
|
141
183
|
declare const analyticsResultDetails: (result: AnalyticsVisualization, labels?: Partial<ResultLabels>, locale?: string) => AnalyticsResultDetail[];
|
|
142
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
|
|
143
222
|
//#region src/useChat.d.ts
|
|
144
223
|
/** One past conversation, for the in-widget history list. */
|
|
145
224
|
interface HistoryEntry {
|
|
@@ -163,9 +242,21 @@ interface VoiceReply {
|
|
|
163
242
|
agentId?: string;
|
|
164
243
|
}
|
|
165
244
|
interface SendOpts {
|
|
245
|
+
signal?: AbortSignal;
|
|
166
246
|
imageUrl?: string;
|
|
167
247
|
/** Voice-call turns should speak the assistant reply using provider TTS when configured. */
|
|
168
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;
|
|
169
260
|
/** Existing local user bubble to turn into the sent visitor message. */
|
|
170
261
|
userMessageId?: string;
|
|
171
262
|
/** Display name of an attached file (shown as a chip on the user bubble). */
|
|
@@ -187,6 +278,12 @@ interface OutgoingAttachment {
|
|
|
187
278
|
file?: Blob;
|
|
188
279
|
}
|
|
189
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;
|
|
190
287
|
analyticsModels: AnalyticsModelOption[];
|
|
191
288
|
analyticsModelId: string;
|
|
192
289
|
selectAnalyticsModel: (id: string) => void;
|
|
@@ -313,6 +410,18 @@ declare const useChat: (transport: Transport, config: ResolvedConfig, active?: b
|
|
|
313
410
|
type SubmitForm = (type: string, payload: Record<string, unknown>, identity?: Visitor, /** Backend-declared endpoint; authoritative when present. */
|
|
314
411
|
endpointOverride?: string) => Promise<ActionResult>;
|
|
315
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;
|
|
316
425
|
declare const ActionsArea: ({
|
|
317
426
|
actions,
|
|
318
427
|
descriptors,
|
|
@@ -325,7 +434,9 @@ declare const ActionsArea: ({
|
|
|
325
434
|
openAction,
|
|
326
435
|
showTrigger,
|
|
327
436
|
translations,
|
|
328
|
-
onClose
|
|
437
|
+
onClose,
|
|
438
|
+
voiceAutoStart,
|
|
439
|
+
voiceScopeId
|
|
329
440
|
}: {
|
|
330
441
|
/** Legacy tool ids. Used only when `descriptors` is absent (older backend). */
|
|
331
442
|
actions?: string[];
|
|
@@ -346,6 +457,8 @@ declare const ActionsArea: ({
|
|
|
346
457
|
/** A host that shows the actions in its own panel: closing or cancelling
|
|
347
458
|
* the action closes that panel instead of returning to the action menu. */
|
|
348
459
|
onClose?: () => void;
|
|
460
|
+
voiceAutoStart?: boolean;
|
|
461
|
+
voiceScopeId?: string;
|
|
349
462
|
}) => JSX.Element | null;
|
|
350
463
|
//#endregion
|
|
351
464
|
//#region src/analytics-model-selector.d.ts
|
|
@@ -364,7 +477,7 @@ declare const AnalyticsModelSelector: ({
|
|
|
364
477
|
disabled?: boolean;
|
|
365
478
|
copy?: Partial<WidgetStrings>;
|
|
366
479
|
classPrefix?: string;
|
|
367
|
-
}) =>
|
|
480
|
+
}) => preact3.JSX.Element | null;
|
|
368
481
|
//#endregion
|
|
369
482
|
//#region src/customization.d.ts
|
|
370
483
|
/** Translate the simple options once; explicit advanced options take precedence. */
|
|
@@ -444,5 +557,7 @@ declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined
|
|
|
444
557
|
* surface maps onto its own theme.
|
|
445
558
|
*/
|
|
446
559
|
declare const WIDGET_ACTION_STYLES: string;
|
|
560
|
+
declare const WIDGET_PENDING_STYLES: string;
|
|
561
|
+
declare const WIDGET_ASSISTANT_AVATAR_STYLES: string;
|
|
447
562
|
//#endregion
|
|
448
|
-
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,9 +1,31 @@
|
|
|
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' | 'workspaceUrl' | 'analyticsRenderer' | '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;
|
|
8
30
|
workspaceUrl?: string;
|
|
9
31
|
analyticsRenderer?: 'hosted' | 'local';
|
|
@@ -39,6 +61,14 @@ interface ResolvedConfig extends Required<Omit<WidgetConfig, 'accentColor' | 'wo
|
|
|
39
61
|
onAction?: WidgetConfig['onAction'];
|
|
40
62
|
onHandoff?: WidgetConfig['onHandoff'];
|
|
41
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;
|
|
42
72
|
declare const resolveConfig: (input: WidgetConfig) => ResolvedConfig;
|
|
43
73
|
//#endregion
|
|
44
74
|
//#region src/api/factory.d.ts
|
|
@@ -52,13 +82,59 @@ declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
|
52
82
|
declare const renderRich: (text: string) => JSX.Element[];
|
|
53
83
|
//#endregion
|
|
54
84
|
//#region src/response-content.d.ts
|
|
55
|
-
|
|
56
|
-
|
|
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;
|
|
57
96
|
//#endregion
|
|
58
97
|
//#region src/result-details.d.ts
|
|
59
98
|
/** Reader-safe result context shared by the floating widget and chat app. */
|
|
60
99
|
declare const analyticsResultDetails: (result: AnalyticsVisualization, labels?: Partial<ResultLabels>, locale?: string) => AnalyticsResultDetail[];
|
|
61
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
|
|
62
138
|
//#region src/useChat.d.ts
|
|
63
139
|
/** One past conversation, for the in-widget history list. */
|
|
64
140
|
interface HistoryEntry {
|
|
@@ -82,9 +158,21 @@ interface VoiceReply {
|
|
|
82
158
|
agentId?: string;
|
|
83
159
|
}
|
|
84
160
|
interface SendOpts {
|
|
161
|
+
signal?: AbortSignal;
|
|
85
162
|
imageUrl?: string;
|
|
86
163
|
/** Voice-call turns should speak the assistant reply using provider TTS when configured. */
|
|
87
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;
|
|
88
176
|
/** Existing local user bubble to turn into the sent visitor message. */
|
|
89
177
|
userMessageId?: string;
|
|
90
178
|
/** Display name of an attached file (shown as a chip on the user bubble). */
|
|
@@ -106,6 +194,12 @@ interface OutgoingAttachment {
|
|
|
106
194
|
file?: Blob;
|
|
107
195
|
}
|
|
108
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;
|
|
109
203
|
analyticsModels: AnalyticsModelOption[];
|
|
110
204
|
analyticsModelId: string;
|
|
111
205
|
selectAnalyticsModel: (id: string) => void;
|
|
@@ -232,6 +326,18 @@ declare const useChat: (transport: Transport, config: ResolvedConfig, active?: b
|
|
|
232
326
|
type SubmitForm = (type: string, payload: Record<string, unknown>, identity?: Visitor, /** Backend-declared endpoint; authoritative when present. */
|
|
233
327
|
endpointOverride?: string) => Promise<ActionResult>;
|
|
234
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;
|
|
235
341
|
declare const ActionsArea: ({
|
|
236
342
|
actions,
|
|
237
343
|
descriptors,
|
|
@@ -244,7 +350,9 @@ declare const ActionsArea: ({
|
|
|
244
350
|
openAction,
|
|
245
351
|
showTrigger,
|
|
246
352
|
translations,
|
|
247
|
-
onClose
|
|
353
|
+
onClose,
|
|
354
|
+
voiceAutoStart,
|
|
355
|
+
voiceScopeId
|
|
248
356
|
}: {
|
|
249
357
|
/** Legacy tool ids. Used only when `descriptors` is absent (older backend). */
|
|
250
358
|
actions?: string[];
|
|
@@ -265,6 +373,8 @@ declare const ActionsArea: ({
|
|
|
265
373
|
/** A host that shows the actions in its own panel: closing or cancelling
|
|
266
374
|
* the action closes that panel instead of returning to the action menu. */
|
|
267
375
|
onClose?: () => void;
|
|
376
|
+
voiceAutoStart?: boolean;
|
|
377
|
+
voiceScopeId?: string;
|
|
268
378
|
}) => JSX.Element | null;
|
|
269
379
|
//#endregion
|
|
270
380
|
//#region src/analytics-model-selector.d.ts
|
|
@@ -283,7 +393,7 @@ declare const AnalyticsModelSelector: ({
|
|
|
283
393
|
disabled?: boolean;
|
|
284
394
|
copy?: Partial<WidgetStrings>;
|
|
285
395
|
classPrefix?: string;
|
|
286
|
-
}) =>
|
|
396
|
+
}) => preact2.JSX.Element | null;
|
|
287
397
|
//#endregion
|
|
288
398
|
//#region src/customization.d.ts
|
|
289
399
|
/** Translate the simple options once; explicit advanced options take precedence. */
|
|
@@ -363,5 +473,7 @@ declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined
|
|
|
363
473
|
* surface maps onto its own theme.
|
|
364
474
|
*/
|
|
365
475
|
declare const WIDGET_ACTION_STYLES: string;
|
|
476
|
+
declare const WIDGET_PENDING_STYLES: string;
|
|
477
|
+
declare const WIDGET_ASSISTANT_AVATAR_STYLES: string;
|
|
366
478
|
//#endregion
|
|
367
|
-
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 };
|