@accurix/centrinfo-widget 5.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 +173 -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 +224 -621
- 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 -1
- 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 -1
- package/dist/runtime.cjs +2 -2
- package/dist/runtime.d.cts +149 -41
- package/dist/runtime.d.mts +22 -123
- package/dist/runtime.mjs +2 -2
- package/dist/styles-BH7P8Q_3.cjs +3472 -0
- package/dist/styles-DwSTSmZb.mjs +3472 -0
- package/dist/{types-BGKFxmKB.d.cts → types-CYFMH8yg.d.cts} +503 -2
- package/dist/{types-DhmmWqaj.d.mts → types-D82dr33R.d.mts} +713 -4
- package/package.json +2 -5
- package/dist/styles-BgWsSZsR.cjs +0 -7714
- package/dist/styles-CIJFMOKa.mjs +0 -3869
package/dist/runtime.d.cts
CHANGED
|
@@ -1,42 +1,38 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import * as
|
|
1
|
+
import { C as StringsProvider, D as AnalyticsExplanationInput, E as AnalyticsAIExplanationTransport, O as AnalyticsGroupComparisonPoint, S as Transport, T as ResultLabels, _ as DemoSlotsResult, a as MessageAttachment, b as PublicChatAction, c as Visitor, f as WidgetThemeTokens, g as DemoBooking, h as AnalyticsVisualization, i as FeaturedLink, k as AnalyticsPeriodComparison, 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-CYFMH8yg.cjs";
|
|
2
|
+
import * as preact1 from "preact";
|
|
3
3
|
import { JSX } from "preact";
|
|
4
4
|
|
|
5
|
-
//#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'>> {
|
|
7
|
-
accentColor?: string;
|
|
8
|
-
agentName?: string;
|
|
9
|
-
agentAvatarUrl?: string;
|
|
10
|
-
launcherIcon?: string;
|
|
11
|
-
themeTokens?: WidgetConfig['themeTokens'];
|
|
12
|
-
gifApiKey?: string;
|
|
13
|
-
/** Resolved string table (English defaults + host `labels` overrides). */
|
|
14
|
-
strings: WidgetStrings;
|
|
15
|
-
locale: string;
|
|
16
|
-
actionTranslations: Record<string, WidgetActionTranslation>;
|
|
17
|
-
/** Host-app SSO passthrough (see WidgetConfig.user). Optional. */
|
|
18
|
-
user?: WidgetConfig['user'];
|
|
19
|
-
/** Short-lived signed context for governed customer analytics. */
|
|
20
|
-
analyticsContextToken?: WidgetConfig['analyticsContextToken'];
|
|
21
|
-
identityToken?: WidgetConfig['identityToken'];
|
|
22
|
-
getIdentityToken?: WidgetConfig['getIdentityToken'];
|
|
23
|
-
customLauncherSelector?: string;
|
|
24
|
-
proactiveMessage?: string;
|
|
25
|
-
proactiveOnPaths?: string[];
|
|
26
|
-
onOpen?: WidgetConfig['onOpen'];
|
|
27
|
-
onClose?: WidgetConfig['onClose'];
|
|
28
|
-
onShow?: WidgetConfig['onShow'];
|
|
29
|
-
onHide?: WidgetConfig['onHide'];
|
|
30
|
-
onUnreadChange?: WidgetConfig['onUnreadChange'];
|
|
31
|
-
onMessage?: WidgetConfig['onMessage'];
|
|
32
|
-
onAction?: WidgetConfig['onAction'];
|
|
33
|
-
onHandoff?: WidgetConfig['onHandoff'];
|
|
34
|
-
}
|
|
35
|
-
declare const resolveConfig: (cfg: WidgetConfig) => ResolvedConfig;
|
|
36
|
-
//#endregion
|
|
37
5
|
//#region ../centrinfo-results/src/analytics-chart-catalog.d.ts
|
|
38
6
|
type AnalyticsChartCatalogType = 'kpi' | 'table' | 'line' | 'bar' | 'pie' | 'scatter' | 'effectScatter' | 'map' | 'candlestick' | 'boxplot' | 'graph' | 'lines' | 'tree' | 'treemap' | 'sunburst' | 'parallel' | 'sankey' | 'funnel' | 'heatmap' | 'radar' | 'gauge' | 'pictorialBar' | 'themeRiver' | 'matrix' | 'chord' | 'custom' | 'dataset' | 'dataZoom' | 'graphic' | 'richText' | 'globe' | 'bar3D' | 'scatter3D' | 'surface' | 'map3D' | 'lines3D' | 'line3D' | 'scatterGL' | 'linesGL' | 'flowGL' | 'graphGL' | 'polygons3D';
|
|
39
7
|
//#endregion
|
|
8
|
+
//#region ../centrinfo-results/src/format.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* The one place numbers, currency, percentages and dates are formatted, so the
|
|
11
|
+
* chart axis, tooltip, table and KPI show the same value the same way.
|
|
12
|
+
*
|
|
13
|
+
* Rules:
|
|
14
|
+
* - Currency comes from column metadata (`currencyCode`) or the result's fixed
|
|
15
|
+
* currency. With no known code the amount is shown as a plain number.
|
|
16
|
+
* - A `percent` column is read as percentage points (0.5 is "0.5%") unless its
|
|
17
|
+
* `formatPattern` contains `%` (Excel style), which marks a fraction (0.5 is
|
|
18
|
+
* "50%"). Magnitude is never used to guess.
|
|
19
|
+
* - Date-only values (`2024-03-05`) are calendar dates: they are formatted in
|
|
20
|
+
* UTC so they never shift a day. Instants are formatted in the result
|
|
21
|
+
* timezone. Granularity follows column metadata, the result's comparison
|
|
22
|
+
* grain, or the shape of the values — a daily series is never "Mar 2024".
|
|
23
|
+
*/
|
|
24
|
+
type ResultGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
25
|
+
interface ResultFormatContext {
|
|
26
|
+
locale?: string;
|
|
27
|
+
/** IANA zone of the result; used for instants, never for date-only values. */
|
|
28
|
+
timezone?: string;
|
|
29
|
+
grain?: ResultGrain;
|
|
30
|
+
/** Result-level fixed currency, used when the column has none. */
|
|
31
|
+
currencyCode?: string;
|
|
32
|
+
yes?: string;
|
|
33
|
+
no?: string;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
40
36
|
//#region ../centrinfo-results/src/types.d.ts
|
|
41
37
|
interface AnalyticsVisualizationColumn {
|
|
42
38
|
key: string;
|
|
@@ -44,8 +40,11 @@ interface AnalyticsVisualizationColumn {
|
|
|
44
40
|
dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
|
|
45
41
|
semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
|
|
46
42
|
aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
|
|
43
|
+
allowedAggregations?: Array<'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max'>;
|
|
47
44
|
formatPattern?: string;
|
|
48
45
|
currencyCode?: string;
|
|
46
|
+
/** Time granularity of a date column; drives how its values are labelled. */
|
|
47
|
+
grain?: ResultGrain;
|
|
49
48
|
description?: string;
|
|
50
49
|
priority?: 'primary' | 'secondary' | 'detail';
|
|
51
50
|
sortable?: boolean;
|
|
@@ -65,6 +64,10 @@ interface AnalyticsVisualizationRecommendation {
|
|
|
65
64
|
confidence?: number;
|
|
66
65
|
}
|
|
67
66
|
interface AnalyticsVisualization$1 {
|
|
67
|
+
/** The latest time bucket is still in progress (drawn dashed). */
|
|
68
|
+
lastPeriodInProgress?: boolean;
|
|
69
|
+
/** Like-for-like comparison basis (reader-safe). */
|
|
70
|
+
periodComparison?: AnalyticsPeriodComparison;
|
|
68
71
|
version?: number;
|
|
69
72
|
presentation?: 'kpi' | 'chart' | 'table';
|
|
70
73
|
type: AnalyticsChartCatalogType | 'area' | 'stacked_bar';
|
|
@@ -81,6 +84,31 @@ interface AnalyticsVisualization$1 {
|
|
|
81
84
|
rows?: Array<Record<string, unknown>>;
|
|
82
85
|
rowCount?: number;
|
|
83
86
|
timezone?: string;
|
|
87
|
+
freshness?: {
|
|
88
|
+
status?: string;
|
|
89
|
+
answeredAt?: string;
|
|
90
|
+
};
|
|
91
|
+
reportingPeriod?: {
|
|
92
|
+
label?: string;
|
|
93
|
+
start?: string;
|
|
94
|
+
end?: string;
|
|
95
|
+
timezone?: string;
|
|
96
|
+
};
|
|
97
|
+
appliedFilters?: Array<{
|
|
98
|
+
field: string;
|
|
99
|
+
operator: string;
|
|
100
|
+
value: unknown;
|
|
101
|
+
}>;
|
|
102
|
+
explanation?: {
|
|
103
|
+
checkedAt?: string;
|
|
104
|
+
timezone?: string;
|
|
105
|
+
dataFreshness?: {
|
|
106
|
+
status?: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
expandable?: boolean;
|
|
110
|
+
tableAvailable?: boolean;
|
|
111
|
+
downloadAvailable?: boolean;
|
|
84
112
|
columnMetadata?: AnalyticsVisualizationColumn[];
|
|
85
113
|
currency?: {
|
|
86
114
|
code?: string;
|
|
@@ -95,6 +123,8 @@ interface ResultColumn {
|
|
|
95
123
|
label?: string;
|
|
96
124
|
dataType?: AnalyticsVisualizationColumn['dataType'];
|
|
97
125
|
currencyCode?: string;
|
|
126
|
+
formatPattern?: string;
|
|
127
|
+
grain?: ResultGrain;
|
|
98
128
|
}
|
|
99
129
|
interface ResultTableClassNames {
|
|
100
130
|
wrap?: string;
|
|
@@ -108,6 +138,8 @@ type WidgetAnalyticsSeries = {
|
|
|
108
138
|
name: string;
|
|
109
139
|
values: Array<number | null>;
|
|
110
140
|
valueColumn?: AnalyticsVisualizationColumn;
|
|
141
|
+
/** Like-for-like breakdown: per-point comparison (tooltip detail). */
|
|
142
|
+
points?: Array<AnalyticsGroupComparisonPoint | undefined>;
|
|
111
143
|
};
|
|
112
144
|
type WidgetAnalyticsChartType = 'line' | 'bar' | 'stacked_bar';
|
|
113
145
|
type WidgetAnalyticsChartModel = {
|
|
@@ -119,18 +151,34 @@ type WidgetAnalyticsChartModel = {
|
|
|
119
151
|
series: WidgetAnalyticsSeries[];
|
|
120
152
|
summary: string;
|
|
121
153
|
omittedSeriesCount: number;
|
|
154
|
+
/** Index of the in-progress (latest) time bucket, drawn dashed / faded. */
|
|
155
|
+
inProgressIndex?: number;
|
|
156
|
+
/** Like-for-like breakdown: the comparison drawn (previous-to-date bars). */
|
|
157
|
+
comparison?: AnalyticsPeriodComparison;
|
|
158
|
+
/** "Today so far, compared with yesterday at this time". */
|
|
159
|
+
comparisonNote?: string;
|
|
160
|
+
locale?: string;
|
|
161
|
+
/** Resolved copy used by the chart's tooltips, summary and zoom controls. */
|
|
162
|
+
labels: ResultLabels;
|
|
163
|
+
};
|
|
164
|
+
type WidgetAnalyticsChartOptions = {
|
|
165
|
+
locale?: string;
|
|
166
|
+
labels?: Partial<ResultLabels>;
|
|
122
167
|
};
|
|
123
|
-
declare const buildWidgetAnalyticsChartModel: (visualization: AnalyticsVisualization$1, overrideType?: WidgetAnalyticsChartType) => WidgetAnalyticsChartModel | null;
|
|
168
|
+
declare const buildWidgetAnalyticsChartModel: (visualization: AnalyticsVisualization$1, overrideType?: WidgetAnalyticsChartType, options?: WidgetAnalyticsChartOptions) => WidgetAnalyticsChartModel | null;
|
|
124
169
|
declare const WidgetAnalyticsChart: ({
|
|
125
170
|
model,
|
|
126
|
-
expanded
|
|
171
|
+
expanded,
|
|
172
|
+
classPrefix: p
|
|
127
173
|
}: {
|
|
128
174
|
model: WidgetAnalyticsChartModel;
|
|
129
175
|
expanded?: boolean;
|
|
130
|
-
|
|
176
|
+
/** Class prefix of the surface (`cf` widget, `ca` chat app). */
|
|
177
|
+
classPrefix?: string;
|
|
178
|
+
}) => preact1.JSX.Element;
|
|
131
179
|
//#endregion
|
|
132
180
|
//#region ../centrinfo-results/src/result.d.ts
|
|
133
|
-
declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn) => string;
|
|
181
|
+
declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn, context?: ResultFormatContext) => string;
|
|
134
182
|
declare const serializeResultCsv: (rows: Array<Record<string, unknown>>, columns?: Array<string | ResultColumn>) => string;
|
|
135
183
|
//#endregion
|
|
136
184
|
//#region ../centrinfo-results/src/table.d.ts
|
|
@@ -139,6 +187,8 @@ interface ResultTableProps {
|
|
|
139
187
|
columns?: Array<string | ResultColumn>;
|
|
140
188
|
maxRows?: number;
|
|
141
189
|
locale?: string;
|
|
190
|
+
/** Timezone / grain / currency context so cells format like the chart. */
|
|
191
|
+
format?: ResultFormatContext;
|
|
142
192
|
expanded?: boolean;
|
|
143
193
|
classNames?: ResultTableClassNames;
|
|
144
194
|
emptyLabel?: string;
|
|
@@ -148,14 +198,67 @@ declare const ResultTable: ({
|
|
|
148
198
|
columns,
|
|
149
199
|
maxRows,
|
|
150
200
|
locale,
|
|
201
|
+
format,
|
|
151
202
|
expanded,
|
|
152
203
|
classNames,
|
|
153
204
|
emptyLabel
|
|
154
|
-
}: ResultTableProps) =>
|
|
205
|
+
}: ResultTableProps) => preact1.JSX.Element;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region ../centrinfo-results/src/result-details.d.ts
|
|
208
|
+
interface AnalyticsResultDetail {
|
|
209
|
+
label: string;
|
|
210
|
+
value: string;
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/config.d.ts
|
|
214
|
+
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'>> {
|
|
215
|
+
accentColor?: string;
|
|
216
|
+
agentName?: string;
|
|
217
|
+
agentAvatarUrl?: string;
|
|
218
|
+
launcherIcon?: string;
|
|
219
|
+
themeTokens?: WidgetConfig['themeTokens'];
|
|
220
|
+
gifApiKey?: string;
|
|
221
|
+
/** Resolved string table (English defaults + host `labels` overrides). */
|
|
222
|
+
strings: WidgetStrings;
|
|
223
|
+
locale: string;
|
|
224
|
+
/** Resolved text direction (from `dir`, else the locale). */
|
|
225
|
+
dir: 'ltr' | 'rtl';
|
|
226
|
+
actionTranslations: Record<string, WidgetActionTranslation>;
|
|
227
|
+
/** Host-app SSO passthrough (see WidgetConfig.user). Optional. */
|
|
228
|
+
user?: WidgetConfig['user'];
|
|
229
|
+
/** Short-lived signed context for governed customer analytics. */
|
|
230
|
+
analyticsContextToken?: WidgetConfig['analyticsContextToken'];
|
|
231
|
+
identityToken?: WidgetConfig['identityToken'];
|
|
232
|
+
getIdentityToken?: WidgetConfig['getIdentityToken'];
|
|
233
|
+
customLauncherSelector?: string;
|
|
234
|
+
proactiveMessage?: string;
|
|
235
|
+
proactiveOnPaths?: string[];
|
|
236
|
+
onOpen?: WidgetConfig['onOpen'];
|
|
237
|
+
onClose?: WidgetConfig['onClose'];
|
|
238
|
+
onShow?: WidgetConfig['onShow'];
|
|
239
|
+
onHide?: WidgetConfig['onHide'];
|
|
240
|
+
onUnreadChange?: WidgetConfig['onUnreadChange'];
|
|
241
|
+
onMessage?: WidgetConfig['onMessage'];
|
|
242
|
+
onOpenAnalyticsSource?: WidgetConfig['onOpenAnalyticsSource'];
|
|
243
|
+
onAction?: WidgetConfig['onAction'];
|
|
244
|
+
onHandoff?: WidgetConfig['onHandoff'];
|
|
245
|
+
}
|
|
246
|
+
declare const resolveConfig: (cfg: WidgetConfig) => ResolvedConfig;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/api/factory.d.ts
|
|
249
|
+
/**
|
|
250
|
+
* The real client is bundled; the demo and preview transports are fetched the
|
|
251
|
+
* first time they are used, so production widgets never download them.
|
|
252
|
+
*/
|
|
253
|
+
declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
155
254
|
//#endregion
|
|
156
255
|
//#region src/rich.d.ts
|
|
157
256
|
declare const renderRich: (text: string) => JSX.Element[];
|
|
158
257
|
//#endregion
|
|
258
|
+
//#region src/result-details.d.ts
|
|
259
|
+
/** Reader-safe result context shared by the floating widget and chat app. */
|
|
260
|
+
declare const analyticsResultDetails: (result: AnalyticsVisualization, labels?: Partial<ResultLabels>, locale?: string) => AnalyticsResultDetail[];
|
|
261
|
+
//#endregion
|
|
159
262
|
//#region src/useChat.d.ts
|
|
160
263
|
/** One past conversation, for the in-widget history list. */
|
|
161
264
|
interface HistoryEntry {
|
|
@@ -252,6 +355,12 @@ interface ChatApi {
|
|
|
252
355
|
retry: (agentId: string, question: string, opts?: Pick<SendOpts, 'forceVoicePlayback'>) => void;
|
|
253
356
|
/** Record a 👍/👎 on an assistant reply (optional comment on 👎). Optimistic. */
|
|
254
357
|
rateMessage: (messageId: string, rating: 'up' | 'down', comment?: string) => void;
|
|
358
|
+
/** Record a vote on an analytics explanation. Rejects when it could not be
|
|
359
|
+
* saved (or the transport has no explanation feedback) so the UI can retry. */
|
|
360
|
+
rateExplanation: (input: Omit<ExplanationFeedbackInput, 'sessionId' | 'surface'>, surface?: ExplanationFeedbackInput['surface']) => Promise<void>;
|
|
361
|
+
/** Poll / retry the detailed AI explanation of an analytics answer for this
|
|
362
|
+
* session; undefined when the transport cannot. */
|
|
363
|
+
explanationTransport: (surface?: ExplanationFeedbackInput['surface']) => AnalyticsAIExplanationTransport<AnalyticsExplanationInput> | undefined;
|
|
255
364
|
/** Append a proactive assistant message (auto-engagement). No-op duplicate-guarded. */
|
|
256
365
|
injectAssistant: (content: string) => void;
|
|
257
366
|
/** After a teammate handed the chat back to the AI: offer the live-support
|
|
@@ -421,6 +530,5 @@ declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined
|
|
|
421
530
|
* surface maps onto its own theme.
|
|
422
531
|
*/
|
|
423
532
|
declare const WIDGET_ACTION_STYLES: string;
|
|
424
|
-
declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
425
533
|
//#endregion
|
|
426
|
-
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, buildWidgetAnalyticsChartModel, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, looksLikeEcho, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, stopRecorderWithFlush, usableTranscript, useChat };
|
|
534
|
+
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.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { C 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,133 +30,26 @@ 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
|
|
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[];
|
|
52
|
+
//#endregion
|
|
159
53
|
//#region src/useChat.d.ts
|
|
160
54
|
/** One past conversation, for the in-widget history list. */
|
|
161
55
|
interface HistoryEntry {
|
|
@@ -252,6 +146,12 @@ interface ChatApi {
|
|
|
252
146
|
retry: (agentId: string, question: string, opts?: Pick<SendOpts, 'forceVoicePlayback'>) => void;
|
|
253
147
|
/** Record a 👍/👎 on an assistant reply (optional comment on 👎). Optimistic. */
|
|
254
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;
|
|
255
155
|
/** Append a proactive assistant message (auto-engagement). No-op duplicate-guarded. */
|
|
256
156
|
injectAssistant: (content: string) => void;
|
|
257
157
|
/** After a teammate handed the chat back to the AI: offer the live-support
|
|
@@ -421,6 +321,5 @@ declare const stopRecorderWithFlush: (recorder: MediaRecorder | null | undefined
|
|
|
421
321
|
* surface maps onto its own theme.
|
|
422
322
|
*/
|
|
423
323
|
declare const WIDGET_ACTION_STYLES: string;
|
|
424
|
-
declare const createChatTransport: (config: ResolvedConfig) => Transport;
|
|
425
324
|
//#endregion
|
|
426
|
-
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, buildWidgetAnalyticsChartModel, createAdaptiveVoiceActivityDetector, createChatTransport, createPreferredAudioRecorder, createVoiceAudioConstraints, findLiveSupportAction, formatResultCell, looksLikeEcho, reconnectableHandbackId, renderRich, resolveConfig, selectStyleRules, serializeResultCsv, stopRecorderWithFlush, usableTranscript, 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,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)},C=
|
|
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};
|