@accurix/centrinfo-widget 4.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -28
- package/dist/cdn/centrinfo-widget-charts.js +15826 -0
- package/dist/cdn/centrinfo-widget-dev.js +122 -0
- package/dist/cdn/centrinfo-widget.js +568 -641
- package/dist/cdn/manifest.json +20 -6
- package/dist/dev-transports-CuEqYhZT.cjs +1 -0
- package/dist/dev-transports-D6oaj_ri.mjs +1 -0
- package/dist/echarts-runtime-BfpVL8xu.cjs +24 -0
- package/dist/echarts-runtime-Bu1uy4oO.mjs +18 -0
- package/dist/index.cjs +1 -3519
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -3519
- package/dist/runtime.cjs +2 -1
- package/dist/runtime.d.cts +315 -59
- package/dist/runtime.d.mts +189 -142
- package/dist/runtime.mjs +2 -1
- package/dist/styles-BH7P8Q_3.cjs +3472 -0
- package/dist/styles-DwSTSmZb.mjs +3472 -0
- package/dist/{types-1ZJJY7Da.d.mts → types-CYFMH8yg.d.cts} +615 -12
- package/dist/{types-B0r4SXaT.d.cts → types-D82dr33R.d.mts} +824 -10
- package/package.json +5 -7
- package/dist/config-CkU4urQY.mjs +0 -30
- package/dist/config-DsNMbdKp.cjs +0 -36
|
@@ -1,3 +1,569 @@
|
|
|
1
|
+
import * as preact1 from "preact";
|
|
2
|
+
import { JSX } from "preact";
|
|
3
|
+
|
|
4
|
+
//#region ../centrinfo-results/src/analytics-chart-catalog.d.ts
|
|
5
|
+
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';
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../centrinfo-results/src/analytics-explanation.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Framework-agnostic analytics explanation core.
|
|
10
|
+
*
|
|
11
|
+
* Every surface (Liveboard SDK vanilla DOM, the Preact widget and full-page
|
|
12
|
+
* chat app, and the React dashboard) renders an explanation from the SAME
|
|
13
|
+
* display model built here, so wording, order and value-status rules never
|
|
14
|
+
* drift between surfaces. Renderers only map this model onto their own markup
|
|
15
|
+
* and theme tokens.
|
|
16
|
+
*
|
|
17
|
+
* Step-by-step order (fixed):
|
|
18
|
+
* 1. lead plain business answer (headline + summary)
|
|
19
|
+
* 2. comparison each compared period with its value + status chip
|
|
20
|
+
* 3. conclusions what the data supports
|
|
21
|
+
* 4. limits in-progress / unconfirmed zero / missing period / caveats
|
|
22
|
+
* 5. checked "Times in <tz> · Checked <time>"
|
|
23
|
+
* 6. investigate causes, recommendations, outlook, follow-ups (optional
|
|
24
|
+
* disclosure, collapsed by default)
|
|
25
|
+
*
|
|
26
|
+
* Zero is only "confirmed" when the source says so. An empty bucket or an
|
|
27
|
+
* unconfirmed zero reads as "no records yet" and never produces a % change.
|
|
28
|
+
*
|
|
29
|
+
* Pure TypeScript, no DOM or framework imports: safe for every SDK bundle.
|
|
30
|
+
*/
|
|
31
|
+
type AnalyticsExplanationValueStatus = 'observed' | 'confirmed_zero' | 'empty_bucket' | 'unconfirmed_zero' | 'missing';
|
|
32
|
+
interface AnalyticsExplanationPeriodRangeInput {
|
|
33
|
+
label: string;
|
|
34
|
+
start?: string;
|
|
35
|
+
end?: string;
|
|
36
|
+
timezone?: string;
|
|
37
|
+
}
|
|
38
|
+
interface AnalyticsExplanationEvidenceItemInput {
|
|
39
|
+
id: string;
|
|
40
|
+
text: string;
|
|
41
|
+
kind?: string;
|
|
42
|
+
metric?: string;
|
|
43
|
+
period?: AnalyticsExplanationPeriodRangeInput;
|
|
44
|
+
filters?: string[];
|
|
45
|
+
value?: number;
|
|
46
|
+
valueStatus?: AnalyticsExplanationValueStatus | string;
|
|
47
|
+
statusReason?: string;
|
|
48
|
+
source?: {
|
|
49
|
+
kind?: 'card' | 'supporting_query' | string;
|
|
50
|
+
insightId?: string;
|
|
51
|
+
queryRunId?: string;
|
|
52
|
+
liveboardTileId?: string;
|
|
53
|
+
};
|
|
54
|
+
checkedAt?: string;
|
|
55
|
+
}
|
|
56
|
+
interface AnalyticsExplanationPeriodInput {
|
|
57
|
+
evidenceId?: string;
|
|
58
|
+
label: string;
|
|
59
|
+
start?: string;
|
|
60
|
+
end?: string;
|
|
61
|
+
timezone?: string;
|
|
62
|
+
current?: boolean;
|
|
63
|
+
inProgress?: boolean;
|
|
64
|
+
value?: number;
|
|
65
|
+
valueText?: string;
|
|
66
|
+
valueStatus?: AnalyticsExplanationValueStatus | string;
|
|
67
|
+
statusReason?: string;
|
|
68
|
+
source?: string;
|
|
69
|
+
}
|
|
70
|
+
interface AnalyticsExplanationMissingInput {
|
|
71
|
+
evidenceId?: string;
|
|
72
|
+
label: string;
|
|
73
|
+
period?: AnalyticsExplanationPeriodRangeInput;
|
|
74
|
+
reason: string;
|
|
75
|
+
}
|
|
76
|
+
interface AnalyticsExplanationFreshnessInput {
|
|
77
|
+
status?: string;
|
|
78
|
+
dataAsOf?: string;
|
|
79
|
+
expectedThrough?: string;
|
|
80
|
+
lagDays?: number;
|
|
81
|
+
checkedAt?: string;
|
|
82
|
+
timezone?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Structural explanation shape every surface's DTO satisfies. */
|
|
85
|
+
interface AnalyticsExplanationInput {
|
|
86
|
+
explanationId?: string;
|
|
87
|
+
conversationalPreface?: string;
|
|
88
|
+
headline?: string;
|
|
89
|
+
summary?: string;
|
|
90
|
+
evidence?: string[];
|
|
91
|
+
headlineEvidenceIds?: string[];
|
|
92
|
+
summaryEvidenceIds?: string[];
|
|
93
|
+
businessMeaningEvidenceIds?: string[];
|
|
94
|
+
evidenceStatements?: Array<{
|
|
95
|
+
text: string;
|
|
96
|
+
evidenceIds?: string[];
|
|
97
|
+
}>;
|
|
98
|
+
evidenceItems?: AnalyticsExplanationEvidenceItemInput[];
|
|
99
|
+
periods?: AnalyticsExplanationPeriodInput[];
|
|
100
|
+
missing?: AnalyticsExplanationMissingInput[];
|
|
101
|
+
timezone?: string;
|
|
102
|
+
checkedAt?: string;
|
|
103
|
+
currentPeriodInProgress?: boolean;
|
|
104
|
+
cached?: boolean;
|
|
105
|
+
dataFreshness?: AnalyticsExplanationFreshnessInput;
|
|
106
|
+
businessMeaning?: string;
|
|
107
|
+
possibleDrivers?: Array<{
|
|
108
|
+
hypothesis: string;
|
|
109
|
+
howToCheck: string;
|
|
110
|
+
evidenceIds?: string[];
|
|
111
|
+
}>;
|
|
112
|
+
recommendations?: Array<{
|
|
113
|
+
action: string;
|
|
114
|
+
why: string;
|
|
115
|
+
successMetric?: string;
|
|
116
|
+
evidenceIds?: string[];
|
|
117
|
+
}>;
|
|
118
|
+
forecast?: {
|
|
119
|
+
text: string;
|
|
120
|
+
qualityStatus?: string;
|
|
121
|
+
limitations?: string;
|
|
122
|
+
horizon?: string;
|
|
123
|
+
};
|
|
124
|
+
limitations?: string[];
|
|
125
|
+
followUps?: string[];
|
|
126
|
+
source?: string;
|
|
127
|
+
/** "basic" = the free explanation built from the facts; "detailed" = checked AI wording. */
|
|
128
|
+
level?: 'basic' | 'detailed' | string;
|
|
129
|
+
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
130
|
+
aiExplanation?: AnalyticsAIExplanationInput | null;
|
|
131
|
+
}
|
|
132
|
+
/** State of the detailed AI explanation, as returned by every surface. */
|
|
133
|
+
type AnalyticsAIExplanationStatus = 'pending' | 'ready' | 'failed' | 'not_requested';
|
|
134
|
+
interface AnalyticsAIExplanationInput {
|
|
135
|
+
status: AnalyticsAIExplanationStatus | string;
|
|
136
|
+
explanationId?: string;
|
|
137
|
+
retryAvailable?: boolean;
|
|
138
|
+
}
|
|
139
|
+
declare const ANALYTICS_EXPLANATION_COPY: {
|
|
140
|
+
readonly eyebrow: "Answer from your data";
|
|
141
|
+
readonly provenanceAI: "AI-assisted · evidence checked";
|
|
142
|
+
readonly provenanceGoverned: "Based on current values";
|
|
143
|
+
readonly comparison: "Comparison";
|
|
144
|
+
readonly conclusions: "What we can conclude";
|
|
145
|
+
readonly whyItMatters: "Why it matters";
|
|
146
|
+
readonly limits: "Important limits";
|
|
147
|
+
readonly investigate: "Investigate further";
|
|
148
|
+
readonly evidenceList: "Evidence checked";
|
|
149
|
+
readonly causes: "Possible causes";
|
|
150
|
+
readonly causesHint: "Not proven causes";
|
|
151
|
+
readonly howToCheck: "How to check:";
|
|
152
|
+
readonly recommendations: "Recommended next steps";
|
|
153
|
+
readonly watch: "Watch:";
|
|
154
|
+
readonly outlook: "Outlook";
|
|
155
|
+
readonly followUps: "Ask a follow-up";
|
|
156
|
+
readonly sourceNoteAI: "AI-assisted wording, checked against the live values shown here.";
|
|
157
|
+
readonly sourceNoteGoverned: "Based only on the live values shown here.";
|
|
158
|
+
readonly evidence: "Evidence";
|
|
159
|
+
readonly evidenceMetric: "Metric";
|
|
160
|
+
readonly evidencePeriod: "Period";
|
|
161
|
+
readonly evidenceTimezone: "Timezone";
|
|
162
|
+
readonly evidenceFilters: "Filters";
|
|
163
|
+
readonly evidenceValue: "Value";
|
|
164
|
+
readonly evidenceStatus: "Status";
|
|
165
|
+
readonly evidenceSource: "Source";
|
|
166
|
+
readonly evidenceChecked: "Checked";
|
|
167
|
+
readonly openSource: "Open source";
|
|
168
|
+
readonly closeEvidence: "Close evidence details";
|
|
169
|
+
readonly citationLabel: "Show evidence";
|
|
170
|
+
readonly sourceCard: "This card";
|
|
171
|
+
readonly sourceSupportingQuery: "Supporting query";
|
|
172
|
+
readonly feedbackPrompt: "Was this explanation helpful?";
|
|
173
|
+
readonly feedbackHelpful: "Helpful explanation";
|
|
174
|
+
readonly feedbackNotHelpful: "Unhelpful explanation";
|
|
175
|
+
readonly feedbackReasonsPrompt: "What went wrong? (optional)";
|
|
176
|
+
readonly feedbackCommentPlaceholder: "Anything else? (optional)";
|
|
177
|
+
readonly feedbackSubmit: "Send feedback";
|
|
178
|
+
readonly feedbackThanks: "Thanks for the feedback.";
|
|
179
|
+
readonly feedbackUndo: "Undo";
|
|
180
|
+
readonly feedbackError: "Feedback could not be saved. Try again.";
|
|
181
|
+
readonly notComparable: "Not comparable yet";
|
|
182
|
+
readonly basicExplanation: "Basic explanation";
|
|
183
|
+
readonly preparingDetailed: "Preparing a detailed explanation…";
|
|
184
|
+
readonly detailedReady: "Detailed explanation ready.";
|
|
185
|
+
readonly detailedUnavailable: "A detailed explanation is not available right now.";
|
|
186
|
+
readonly detailedRetry: "Try again";
|
|
187
|
+
readonly region: "Explanation";
|
|
188
|
+
readonly inProgress: "in progress";
|
|
189
|
+
readonly expand: "Expand explanation";
|
|
190
|
+
readonly collapse: "Collapse explanation";
|
|
191
|
+
readonly reasonWrongNumbers: "Wrong numbers";
|
|
192
|
+
readonly reasonMissingComparison: "Missing comparison";
|
|
193
|
+
readonly reasonUnclear: "Unclear";
|
|
194
|
+
readonly reasonTooLong: "Too long";
|
|
195
|
+
};
|
|
196
|
+
/** The explanation panel's copy with a host's overrides on top. */
|
|
197
|
+
type AnalyticsExplanationCopyOverrides = Partial<{ -readonly [K in keyof typeof ANALYTICS_EXPLANATION_COPY]: string }>;
|
|
198
|
+
type AnalyticsComparisonBasis = 'complete' | 'like_for_like' | 'current_in_progress_no_time' | 'not_comparable';
|
|
199
|
+
interface AnalyticsComparisonPeriod {
|
|
200
|
+
label: string;
|
|
201
|
+
start?: string;
|
|
202
|
+
end?: string;
|
|
203
|
+
fullEnd?: string;
|
|
204
|
+
inProgress?: boolean;
|
|
205
|
+
toDate?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/** Backend `periodComparison` (reader-safe projection). */
|
|
208
|
+
interface AnalyticsPeriodComparison {
|
|
209
|
+
comparisonBasis: AnalyticsComparisonBasis | string;
|
|
210
|
+
reason?: string;
|
|
211
|
+
grain?: string;
|
|
212
|
+
measureField?: string;
|
|
213
|
+
seriesField?: string;
|
|
214
|
+
currentPeriod?: AnalyticsComparisonPeriod;
|
|
215
|
+
previousPeriod?: AnalyticsComparisonPeriod;
|
|
216
|
+
currentValue?: number;
|
|
217
|
+
previousToDateValue?: number;
|
|
218
|
+
previousFullValue?: number;
|
|
219
|
+
cutoffAt?: string;
|
|
220
|
+
cutoffSource?: 'now' | 'data_as_of' | string;
|
|
221
|
+
timezone?: string;
|
|
222
|
+
series?: Array<{
|
|
223
|
+
key: string;
|
|
224
|
+
currentValue?: number;
|
|
225
|
+
previousToDateValue?: number;
|
|
226
|
+
previousFullValue?: number;
|
|
227
|
+
}>;
|
|
228
|
+
}
|
|
229
|
+
interface AnalyticsComparisonDisplay {
|
|
230
|
+
basis: AnalyticsComparisonBasis | string;
|
|
231
|
+
kind: 'change' | 'neutral';
|
|
232
|
+
/** Set only for like-for-like (or complete) changes: red/green allowed. */
|
|
233
|
+
percent?: number;
|
|
234
|
+
tone: 'positive' | 'negative' | 'neutral';
|
|
235
|
+
/** Badge text: "↑ 50.0%", "Up from 0", "Today so far: 6 · Yesterday: 26 (full day)". */
|
|
236
|
+
label: string;
|
|
237
|
+
/** "vs yesterday at this time" / "vs same point last week". */
|
|
238
|
+
copy: string;
|
|
239
|
+
/** "Yesterday full day: 26". */
|
|
240
|
+
secondary?: string;
|
|
241
|
+
/** Compact one-line form for KPI cards: "Full day: 26". */
|
|
242
|
+
compactSecondary?: string;
|
|
243
|
+
/** Hover text with the cutoff time. */
|
|
244
|
+
title?: string;
|
|
245
|
+
reason?: string;
|
|
246
|
+
}
|
|
247
|
+
interface AnalyticsGroupComparisonPoint {
|
|
248
|
+
side: 'current' | 'previous';
|
|
249
|
+
basis: string;
|
|
250
|
+
/** Value to plot: previous-to-date on a like-for-like previous bucket. */
|
|
251
|
+
plotValue?: number;
|
|
252
|
+
/** Previous bucket: the full previous value (tooltip). */
|
|
253
|
+
fullValue?: number;
|
|
254
|
+
/** Previous bucket plotted at the same point (label "Yesterday at this time"). */
|
|
255
|
+
toDate: boolean;
|
|
256
|
+
/** Current bucket: this group's change, following the KPI basis rules. */
|
|
257
|
+
display?: AnalyticsComparisonDisplay;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Poll response for a detailed AI explanation. `explanation` is set only when
|
|
261
|
+
* `status` is "ready" and is the CHECKED explanation (never raw model text).
|
|
262
|
+
*/
|
|
263
|
+
interface AnalyticsAIExplanationJob<E extends AnalyticsExplanationInput> {
|
|
264
|
+
status: AnalyticsAIExplanationStatus | string;
|
|
265
|
+
explanationId?: string;
|
|
266
|
+
retryAvailable?: boolean;
|
|
267
|
+
explanation?: E | null;
|
|
268
|
+
/**
|
|
269
|
+
* The free basic explanation as updated by the background job (it gains the
|
|
270
|
+
* baseline sentence, e.g. "within the recent range of 22–28"). Present while
|
|
271
|
+
* the AI explanation is pending or after it failed.
|
|
272
|
+
*/
|
|
273
|
+
basic?: E | null;
|
|
274
|
+
}
|
|
275
|
+
interface AnalyticsAIExplanationTransport<E extends AnalyticsExplanationInput> {
|
|
276
|
+
/** GET the job by id with the surface's own credentials. */
|
|
277
|
+
poll: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
278
|
+
/** "Try again": re-request with the retry flag. Omit when retry is impossible. */
|
|
279
|
+
retry?: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
280
|
+
/** The job reached a final status: let the surface remember it (status only, not the payload). */
|
|
281
|
+
settled?: (explanationId: string, status: 'ready' | 'failed' | 'not_requested') => void;
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region ../centrinfo-results/src/labels.d.ts
|
|
285
|
+
type AnalyticsExplanationCopy = Required<AnalyticsExplanationCopyOverrides>;
|
|
286
|
+
/** Every string the shared result renderer shows. Hosts override any subset. */
|
|
287
|
+
interface ResultLabels {
|
|
288
|
+
resultDetails: string;
|
|
289
|
+
liveMetric: string;
|
|
290
|
+
currentValue: string;
|
|
291
|
+
noMatchTitle: string;
|
|
292
|
+
noMatchBody: string;
|
|
293
|
+
chartType: string;
|
|
294
|
+
chooseChartType: string;
|
|
295
|
+
aggregate: string;
|
|
296
|
+
aggregateTitle: string;
|
|
297
|
+
aggregateCharge: string;
|
|
298
|
+
chartFallback: string;
|
|
299
|
+
chartLine: string;
|
|
300
|
+
chartBar: string;
|
|
301
|
+
chartStackedBar: string;
|
|
302
|
+
chartLineHint: string;
|
|
303
|
+
chartBarHint: string;
|
|
304
|
+
chartStackedBarHint: string;
|
|
305
|
+
aggregationSum: string;
|
|
306
|
+
aggregationAvg: string;
|
|
307
|
+
aggregationMin: string;
|
|
308
|
+
aggregationMax: string;
|
|
309
|
+
aggregationCount: string;
|
|
310
|
+
aggregationCountDistinct: string;
|
|
311
|
+
download: string;
|
|
312
|
+
downloadData: string;
|
|
313
|
+
expandTable: string;
|
|
314
|
+
expandChart: string;
|
|
315
|
+
restoreView: string;
|
|
316
|
+
aboutResult: string;
|
|
317
|
+
aboutPeriod: string;
|
|
318
|
+
aboutResults: string;
|
|
319
|
+
aboutChecked: string;
|
|
320
|
+
aboutTimezone: string;
|
|
321
|
+
aboutSourceData: string;
|
|
322
|
+
aboutFilters: string;
|
|
323
|
+
/** `{count}` placeholder. */
|
|
324
|
+
rowOne: string;
|
|
325
|
+
rowMany: string;
|
|
326
|
+
filtersOne: string;
|
|
327
|
+
filtersMany: string;
|
|
328
|
+
filtersApplied: string;
|
|
329
|
+
notSet: string;
|
|
330
|
+
noValue: string;
|
|
331
|
+
yes: string;
|
|
332
|
+
no: string;
|
|
333
|
+
chartValues: string;
|
|
334
|
+
/** `{measure}`, `{dimension}`. */
|
|
335
|
+
chartTitle: string;
|
|
336
|
+
seriesLimited: string;
|
|
337
|
+
summaryLatest: string;
|
|
338
|
+
summaryNoTrend: string;
|
|
339
|
+
summaryHighest: string;
|
|
340
|
+
summaryNoComparison: string;
|
|
341
|
+
zoomControls: string;
|
|
342
|
+
zoomIn: string;
|
|
343
|
+
zoomOut: string;
|
|
344
|
+
zoomReset: string;
|
|
345
|
+
zoomResetShort: string;
|
|
346
|
+
zoomNone: string;
|
|
347
|
+
zoomAllOne: string;
|
|
348
|
+
zoomAllMany: string;
|
|
349
|
+
zoomRange: string;
|
|
350
|
+
inProgress: string;
|
|
351
|
+
newContent: string;
|
|
352
|
+
updatedAt: string;
|
|
353
|
+
liveData: string;
|
|
354
|
+
viewData: string;
|
|
355
|
+
hideData: string;
|
|
356
|
+
inProgressLegend: string;
|
|
357
|
+
/** Overrides for the explanation panel copy. */
|
|
358
|
+
explanation?: Partial<AnalyticsExplanationCopy>;
|
|
359
|
+
governedResult: string;
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region ../centrinfo-results/src/format.d.ts
|
|
363
|
+
/**
|
|
364
|
+
* The one place numbers, currency, percentages and dates are formatted, so the
|
|
365
|
+
* chart axis, tooltip, table and KPI show the same value the same way.
|
|
366
|
+
*
|
|
367
|
+
* Rules:
|
|
368
|
+
* - Currency comes from column metadata (`currencyCode`) or the result's fixed
|
|
369
|
+
* currency. With no known code the amount is shown as a plain number.
|
|
370
|
+
* - A `percent` column is read as percentage points (0.5 is "0.5%") unless its
|
|
371
|
+
* `formatPattern` contains `%` (Excel style), which marks a fraction (0.5 is
|
|
372
|
+
* "50%"). Magnitude is never used to guess.
|
|
373
|
+
* - Date-only values (`2024-03-05`) are calendar dates: they are formatted in
|
|
374
|
+
* UTC so they never shift a day. Instants are formatted in the result
|
|
375
|
+
* timezone. Granularity follows column metadata, the result's comparison
|
|
376
|
+
* grain, or the shape of the values — a daily series is never "Mar 2024".
|
|
377
|
+
*/
|
|
378
|
+
type ResultGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
379
|
+
interface ResultFormatContext {
|
|
380
|
+
locale?: string;
|
|
381
|
+
/** IANA zone of the result; used for instants, never for date-only values. */
|
|
382
|
+
timezone?: string;
|
|
383
|
+
grain?: ResultGrain;
|
|
384
|
+
/** Result-level fixed currency, used when the column has none. */
|
|
385
|
+
currencyCode?: string;
|
|
386
|
+
yes?: string;
|
|
387
|
+
no?: string;
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region ../centrinfo-results/src/types.d.ts
|
|
391
|
+
interface AnalyticsVisualizationColumn$1 {
|
|
392
|
+
key: string;
|
|
393
|
+
label: string;
|
|
394
|
+
dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
|
|
395
|
+
semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
|
|
396
|
+
aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
|
|
397
|
+
allowedAggregations?: Array<'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max'>;
|
|
398
|
+
formatPattern?: string;
|
|
399
|
+
currencyCode?: string;
|
|
400
|
+
/** Time granularity of a date column; drives how its values are labelled. */
|
|
401
|
+
grain?: ResultGrain;
|
|
402
|
+
description?: string;
|
|
403
|
+
priority?: 'primary' | 'secondary' | 'detail';
|
|
404
|
+
sortable?: boolean;
|
|
405
|
+
filterable?: boolean;
|
|
406
|
+
groupable?: boolean;
|
|
407
|
+
}
|
|
408
|
+
interface AnalyticsVisualizationRecommendation$1 {
|
|
409
|
+
type: AnalyticsChartCatalogType | 'area' | 'stacked_bar';
|
|
410
|
+
mode: string;
|
|
411
|
+
categoryField?: string;
|
|
412
|
+
latitudeField?: string;
|
|
413
|
+
longitudeField?: string;
|
|
414
|
+
geometryField?: string;
|
|
415
|
+
valueFields?: string[];
|
|
416
|
+
seriesField?: string;
|
|
417
|
+
reason?: string;
|
|
418
|
+
confidence?: number;
|
|
419
|
+
}
|
|
420
|
+
interface AnalyticsVisualization$1 {
|
|
421
|
+
/** The latest time bucket is still in progress (drawn dashed). */
|
|
422
|
+
lastPeriodInProgress?: boolean;
|
|
423
|
+
/** Like-for-like comparison basis (reader-safe). */
|
|
424
|
+
periodComparison?: AnalyticsPeriodComparison;
|
|
425
|
+
version?: number;
|
|
426
|
+
presentation?: 'kpi' | 'chart' | 'table';
|
|
427
|
+
type: AnalyticsChartCatalogType | 'area' | 'stacked_bar';
|
|
428
|
+
title?: string;
|
|
429
|
+
label?: string;
|
|
430
|
+
value?: string;
|
|
431
|
+
latitudeField?: string;
|
|
432
|
+
longitudeField?: string;
|
|
433
|
+
geometryField?: string;
|
|
434
|
+
valueFields?: string[];
|
|
435
|
+
series?: string;
|
|
436
|
+
seriesField?: string;
|
|
437
|
+
columns?: string[];
|
|
438
|
+
rows?: Array<Record<string, unknown>>;
|
|
439
|
+
rowCount?: number;
|
|
440
|
+
timezone?: string;
|
|
441
|
+
freshness?: {
|
|
442
|
+
status?: string;
|
|
443
|
+
answeredAt?: string;
|
|
444
|
+
};
|
|
445
|
+
reportingPeriod?: {
|
|
446
|
+
label?: string;
|
|
447
|
+
start?: string;
|
|
448
|
+
end?: string;
|
|
449
|
+
timezone?: string;
|
|
450
|
+
};
|
|
451
|
+
appliedFilters?: Array<{
|
|
452
|
+
field: string;
|
|
453
|
+
operator: string;
|
|
454
|
+
value: unknown;
|
|
455
|
+
}>;
|
|
456
|
+
explanation?: {
|
|
457
|
+
checkedAt?: string;
|
|
458
|
+
timezone?: string;
|
|
459
|
+
dataFreshness?: {
|
|
460
|
+
status?: string;
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
expandable?: boolean;
|
|
464
|
+
tableAvailable?: boolean;
|
|
465
|
+
downloadAvailable?: boolean;
|
|
466
|
+
columnMetadata?: AnalyticsVisualizationColumn$1[];
|
|
467
|
+
currency?: {
|
|
468
|
+
code?: string;
|
|
469
|
+
field?: string;
|
|
470
|
+
source?: 'fixed_metadata' | 'source_field';
|
|
471
|
+
isMixed: boolean;
|
|
472
|
+
};
|
|
473
|
+
chartRecommendation?: AnalyticsVisualizationRecommendation$1;
|
|
474
|
+
}
|
|
475
|
+
interface ResultColumn {
|
|
476
|
+
key: string;
|
|
477
|
+
label?: string;
|
|
478
|
+
dataType?: AnalyticsVisualizationColumn$1['dataType'];
|
|
479
|
+
currencyCode?: string;
|
|
480
|
+
formatPattern?: string;
|
|
481
|
+
grain?: ResultGrain;
|
|
482
|
+
}
|
|
483
|
+
interface ResultTableClassNames {
|
|
484
|
+
wrap?: string;
|
|
485
|
+
table?: string;
|
|
486
|
+
note?: string;
|
|
487
|
+
}
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region ../centrinfo-results/src/chart.d.ts
|
|
490
|
+
type WidgetAnalyticsSeries = {
|
|
491
|
+
field: string;
|
|
492
|
+
name: string;
|
|
493
|
+
values: Array<number | null>;
|
|
494
|
+
valueColumn?: AnalyticsVisualizationColumn$1;
|
|
495
|
+
/** Like-for-like breakdown: per-point comparison (tooltip detail). */
|
|
496
|
+
points?: Array<AnalyticsGroupComparisonPoint | undefined>;
|
|
497
|
+
};
|
|
498
|
+
type WidgetAnalyticsChartType = 'line' | 'bar' | 'stacked_bar';
|
|
499
|
+
type WidgetAnalyticsChartModel = {
|
|
500
|
+
type: WidgetAnalyticsChartType;
|
|
501
|
+
title: string;
|
|
502
|
+
xAxisTitle: string;
|
|
503
|
+
yAxisTitle: string;
|
|
504
|
+
categories: string[];
|
|
505
|
+
series: WidgetAnalyticsSeries[];
|
|
506
|
+
summary: string;
|
|
507
|
+
omittedSeriesCount: number;
|
|
508
|
+
/** Index of the in-progress (latest) time bucket, drawn dashed / faded. */
|
|
509
|
+
inProgressIndex?: number;
|
|
510
|
+
/** Like-for-like breakdown: the comparison drawn (previous-to-date bars). */
|
|
511
|
+
comparison?: AnalyticsPeriodComparison;
|
|
512
|
+
/** "Today so far, compared with yesterday at this time". */
|
|
513
|
+
comparisonNote?: string;
|
|
514
|
+
locale?: string;
|
|
515
|
+
/** Resolved copy used by the chart's tooltips, summary and zoom controls. */
|
|
516
|
+
labels: ResultLabels;
|
|
517
|
+
};
|
|
518
|
+
type WidgetAnalyticsChartOptions = {
|
|
519
|
+
locale?: string;
|
|
520
|
+
labels?: Partial<ResultLabels>;
|
|
521
|
+
};
|
|
522
|
+
declare const buildWidgetAnalyticsChartModel: (visualization: AnalyticsVisualization$1, overrideType?: WidgetAnalyticsChartType, options?: WidgetAnalyticsChartOptions) => WidgetAnalyticsChartModel | null;
|
|
523
|
+
declare const WidgetAnalyticsChart: ({
|
|
524
|
+
model,
|
|
525
|
+
expanded,
|
|
526
|
+
classPrefix: p
|
|
527
|
+
}: {
|
|
528
|
+
model: WidgetAnalyticsChartModel;
|
|
529
|
+
expanded?: boolean;
|
|
530
|
+
/** Class prefix of the surface (`cf` widget, `ca` chat app). */
|
|
531
|
+
classPrefix?: string;
|
|
532
|
+
}) => preact1.JSX.Element;
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region ../centrinfo-results/src/result.d.ts
|
|
535
|
+
declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn, context?: ResultFormatContext) => string;
|
|
536
|
+
declare const serializeResultCsv: (rows: Array<Record<string, unknown>>, columns?: Array<string | ResultColumn>) => string;
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region ../centrinfo-results/src/table.d.ts
|
|
539
|
+
interface ResultTableProps {
|
|
540
|
+
rows: Array<Record<string, unknown>>;
|
|
541
|
+
columns?: Array<string | ResultColumn>;
|
|
542
|
+
maxRows?: number;
|
|
543
|
+
locale?: string;
|
|
544
|
+
/** Timezone / grain / currency context so cells format like the chart. */
|
|
545
|
+
format?: ResultFormatContext;
|
|
546
|
+
expanded?: boolean;
|
|
547
|
+
classNames?: ResultTableClassNames;
|
|
548
|
+
emptyLabel?: string;
|
|
549
|
+
}
|
|
550
|
+
declare const ResultTable: ({
|
|
551
|
+
rows,
|
|
552
|
+
columns,
|
|
553
|
+
maxRows,
|
|
554
|
+
locale,
|
|
555
|
+
format,
|
|
556
|
+
expanded,
|
|
557
|
+
classNames,
|
|
558
|
+
emptyLabel
|
|
559
|
+
}: ResultTableProps) => preact1.JSX.Element;
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region ../centrinfo-results/src/result-details.d.ts
|
|
562
|
+
interface AnalyticsResultDetail {
|
|
563
|
+
label: string;
|
|
564
|
+
value: string;
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
1
567
|
//#region src/i18n.d.ts
|
|
2
568
|
/**
|
|
3
569
|
* Every user-visible chrome string in one place. The widget ships English
|
|
@@ -8,6 +574,12 @@
|
|
|
8
574
|
* never produces.
|
|
9
575
|
*/
|
|
10
576
|
interface WidgetStrings {
|
|
577
|
+
/**
|
|
578
|
+
* Labels for analytics answers (KPI, chart, table, details, explanation).
|
|
579
|
+
* Any subset overrides the English defaults; `explanation` holds the
|
|
580
|
+
* explanation panel's wording.
|
|
581
|
+
*/
|
|
582
|
+
analytics?: Partial<ResultLabels>;
|
|
11
583
|
/** Optional full-page labels. Older integrations use the core labels as fallbacks. */
|
|
12
584
|
fullPageNewConversation?: string;
|
|
13
585
|
fullPageHistory?: string;
|
|
@@ -33,6 +605,10 @@ interface WidgetStrings {
|
|
|
33
605
|
/** Header presence line when bootstrap was loaded with `offline`. */
|
|
34
606
|
statusOffline: string;
|
|
35
607
|
liveSupport: string;
|
|
608
|
+
/** Button on the "teammate left, the AI is back" notice. */
|
|
609
|
+
reconnectSupport: string;
|
|
610
|
+
/** Message that opens the live-support form again after reconnecting. */
|
|
611
|
+
reconnectPrompt: string;
|
|
36
612
|
waitingForTeam: string;
|
|
37
613
|
assistantName: string;
|
|
38
614
|
chatName: string;
|
|
@@ -56,6 +632,8 @@ interface WidgetStrings {
|
|
|
56
632
|
reopenVoiceChat: string;
|
|
57
633
|
voiceConnecting: string;
|
|
58
634
|
voiceListening: string;
|
|
635
|
+
voiceHearing: string;
|
|
636
|
+
voiceUnavailable: string;
|
|
59
637
|
voiceProcessing: string;
|
|
60
638
|
voiceSpeaking: string;
|
|
61
639
|
voiceNoise: string;
|
|
@@ -92,6 +670,7 @@ interface WidgetStrings {
|
|
|
92
670
|
/** Per-message 👍/👎 feedback. */
|
|
93
671
|
feedbackHelpful: string;
|
|
94
672
|
feedbackNotHelpful: string;
|
|
673
|
+
feedbackAnswerPrompt: string;
|
|
95
674
|
feedbackThanks: string;
|
|
96
675
|
/** End-of-chat CSAT prompt. */
|
|
97
676
|
csatPrompt: string;
|
|
@@ -107,10 +686,23 @@ interface WidgetStrings {
|
|
|
107
686
|
emptyReply: string;
|
|
108
687
|
errorGeneric: string;
|
|
109
688
|
errorRateLimit: string;
|
|
689
|
+
/** Shown in place of an analytics result that is not kept in local storage. */
|
|
690
|
+
resultExpired: string;
|
|
110
691
|
attaching: string;
|
|
111
692
|
attachTooLarge: string;
|
|
112
693
|
attachFailed: string;
|
|
694
|
+
attachPreviewTitle: string;
|
|
695
|
+
attachOpen: string;
|
|
696
|
+
attachDownload: string;
|
|
697
|
+
attachPreviewClose: string;
|
|
698
|
+
attachPreviewLoading: string;
|
|
699
|
+
attachPreviewFailed: string;
|
|
700
|
+
attachPreviewUnsupported: string;
|
|
701
|
+
attachAnalysisFailed: string;
|
|
113
702
|
removeAttachment: string;
|
|
703
|
+
attachLimit: string;
|
|
704
|
+
attachedFiles: string;
|
|
705
|
+
removeAttachmentNamed: string;
|
|
114
706
|
dropFileHere: string;
|
|
115
707
|
clearDeviceData: string;
|
|
116
708
|
clearDeviceDataBody: string;
|
|
@@ -126,6 +718,8 @@ interface WidgetStrings {
|
|
|
126
718
|
/** Generic action-form success fallback + error. */
|
|
127
719
|
formThanks: string;
|
|
128
720
|
formError: string;
|
|
721
|
+
/** Case number appended to a confirmation. `{reference}` is the case number. */
|
|
722
|
+
caseReference: string;
|
|
129
723
|
/** Public action drawer chrome. Action-specific copy remains descriptor data. */
|
|
130
724
|
actionContactOptions: string;
|
|
131
725
|
actionGetInTouch: string;
|
|
@@ -143,6 +737,7 @@ interface WidgetStrings {
|
|
|
143
737
|
bookingPickDay: string;
|
|
144
738
|
bookingPickTimeLabel: string;
|
|
145
739
|
bookingDuration: string;
|
|
740
|
+
bookingCallbackDuration: string;
|
|
146
741
|
bookingTimezone: string;
|
|
147
742
|
bookingSchedulerFallback: string;
|
|
148
743
|
bookingCheckingAvailability: string;
|
|
@@ -154,6 +749,11 @@ interface WidgetStrings {
|
|
|
154
749
|
bookingNotOffered: string;
|
|
155
750
|
/** Confirmation after requesting a demo. `{when}` = the chosen slot. */
|
|
156
751
|
bookingRequested: string;
|
|
752
|
+
/** The request was retained but the calendar provider did not confirm it. */
|
|
753
|
+
bookingVerificationPending: string;
|
|
754
|
+
/** Confirmation after requesting a callback. `{when}` = the chosen slot. */
|
|
755
|
+
bookingCallbackRequested: string;
|
|
756
|
+
bookingCallbackConfirmed: string;
|
|
157
757
|
/** Confirmation when a real calendar event was created. `{when}` = slot. */
|
|
158
758
|
bookingConfirmed: string;
|
|
159
759
|
/** Shown when the chosen slot was just taken by someone else. */
|
|
@@ -163,12 +763,22 @@ interface WidgetStrings {
|
|
|
163
763
|
bookingViaProvider: string;
|
|
164
764
|
bookingOpenScheduler: string;
|
|
165
765
|
bookingLinkOpened: string;
|
|
766
|
+
bookingScheduled: string;
|
|
767
|
+
bookingBackToChat: string;
|
|
768
|
+
bookingOpenNewTab: string;
|
|
769
|
+
bookingCloseScheduler: string;
|
|
770
|
+
bookingLoadingScheduler: string;
|
|
166
771
|
bookingMeetingLink: string;
|
|
772
|
+
bookingManageLink: string;
|
|
773
|
+
bookingCheckingDetails: string;
|
|
774
|
+
bookingDetailsUnavailable: string;
|
|
775
|
+
bookingRetryDetails: string;
|
|
167
776
|
/** Preview mode (data-preview): canned reply, action note, top banner. */
|
|
168
777
|
previewReply: string;
|
|
169
778
|
previewActionNote: string;
|
|
170
779
|
previewBanner: string;
|
|
171
780
|
}
|
|
781
|
+
declare const StringsProvider: preact1.Provider<WidgetStrings>;
|
|
172
782
|
//#endregion
|
|
173
783
|
//#region src/api/types.d.ts
|
|
174
784
|
/** The result metadata that arrives with (or after) an answer. */
|
|
@@ -205,6 +815,9 @@ interface PublicChatAction {
|
|
|
205
815
|
submitLabel: string;
|
|
206
816
|
fields: PublicChatActionField[];
|
|
207
817
|
delivery: string;
|
|
818
|
+
/** True when submitting brings a teammate into this chat; false for a
|
|
819
|
+
* follow-up by email or phone. Several actions share an endpoint. */
|
|
820
|
+
liveHandoff?: boolean;
|
|
208
821
|
prompt: string;
|
|
209
822
|
shortLabel: string;
|
|
210
823
|
enabled: boolean;
|
|
@@ -214,7 +827,17 @@ interface PublicChatAction {
|
|
|
214
827
|
/** Client-only compatibility marker. Never emitted by the production catalogue. */
|
|
215
828
|
legacyFallback?: boolean;
|
|
216
829
|
}
|
|
830
|
+
interface LiveAudioSegment {
|
|
831
|
+
seq: number;
|
|
832
|
+
/** Empty when the server could not voice the piece; speak `text` instead. */
|
|
833
|
+
audioBase64: string;
|
|
834
|
+
mimeType?: string;
|
|
835
|
+
/** The piece as spoken (no links or markdown). */
|
|
836
|
+
text?: string;
|
|
837
|
+
}
|
|
217
838
|
interface TurnResult {
|
|
839
|
+
/** True when the reply was spoken in live pieces (onAudioSegment). */
|
|
840
|
+
liveAudio?: boolean;
|
|
218
841
|
answer: string;
|
|
219
842
|
sources: Source[];
|
|
220
843
|
suggestedReplies: string[];
|
|
@@ -245,6 +868,7 @@ interface AnalyticsVisualizationColumn {
|
|
|
245
868
|
dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
|
|
246
869
|
semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
|
|
247
870
|
aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
|
|
871
|
+
allowedAggregations?: Array<'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max'>;
|
|
248
872
|
formatPattern?: string;
|
|
249
873
|
currencyCode?: string;
|
|
250
874
|
description?: string;
|
|
@@ -262,21 +886,101 @@ interface AnalyticsVisualizationRecommendation {
|
|
|
262
886
|
reason?: string;
|
|
263
887
|
confidence?: number;
|
|
264
888
|
}
|
|
889
|
+
type AnalyticsValueStatus = 'observed' | 'confirmed_zero' | 'empty_bucket' | 'unconfirmed_zero' | 'missing';
|
|
890
|
+
interface AnalyticsEvidencePeriod {
|
|
891
|
+
label: string;
|
|
892
|
+
start?: string;
|
|
893
|
+
end?: string;
|
|
894
|
+
timezone?: string;
|
|
895
|
+
}
|
|
896
|
+
interface AnalyticsExplanationEvidenceItem {
|
|
897
|
+
id: string;
|
|
898
|
+
text: string;
|
|
899
|
+
kind?: string;
|
|
900
|
+
metric?: string;
|
|
901
|
+
period?: AnalyticsEvidencePeriod;
|
|
902
|
+
filters?: string[];
|
|
903
|
+
value?: number;
|
|
904
|
+
valueStatus: AnalyticsValueStatus | string;
|
|
905
|
+
statusReason?: string;
|
|
906
|
+
source: {
|
|
907
|
+
kind: 'card' | 'supporting_query' | string;
|
|
908
|
+
insightId?: string;
|
|
909
|
+
queryRunId?: string;
|
|
910
|
+
liveboardTileId?: string;
|
|
911
|
+
};
|
|
912
|
+
checkedAt?: string;
|
|
913
|
+
}
|
|
914
|
+
interface AnalyticsExplanationPeriod {
|
|
915
|
+
evidenceId?: string;
|
|
916
|
+
label: string;
|
|
917
|
+
start?: string;
|
|
918
|
+
end?: string;
|
|
919
|
+
timezone?: string;
|
|
920
|
+
current?: boolean;
|
|
921
|
+
inProgress?: boolean;
|
|
922
|
+
value?: number;
|
|
923
|
+
valueText?: string;
|
|
924
|
+
valueStatus: AnalyticsValueStatus | string;
|
|
925
|
+
statusReason?: string;
|
|
926
|
+
source?: 'card' | 'supporting_query' | string;
|
|
927
|
+
}
|
|
928
|
+
interface AnalyticsExplanationMissing {
|
|
929
|
+
evidenceId?: string;
|
|
930
|
+
label: string;
|
|
931
|
+
period?: AnalyticsEvidencePeriod;
|
|
932
|
+
reason: string;
|
|
933
|
+
}
|
|
934
|
+
interface AnalyticsExplanationDataFreshness {
|
|
935
|
+
status: string;
|
|
936
|
+
dataAsOf?: string;
|
|
937
|
+
expectedThrough?: string;
|
|
938
|
+
lagDays?: number;
|
|
939
|
+
checkedAt?: string;
|
|
940
|
+
timezone?: string;
|
|
941
|
+
}
|
|
942
|
+
interface AnalyticsValueProvenance {
|
|
943
|
+
rowIndex: number;
|
|
944
|
+
field: string;
|
|
945
|
+
period?: string;
|
|
946
|
+
filled: 'empty_bucket' | string;
|
|
947
|
+
status: 'empty_bucket' | 'confirmed_zero' | 'unconfirmed_zero' | string;
|
|
948
|
+
reason?: string;
|
|
949
|
+
}
|
|
265
950
|
interface AnalyticsVisualizationExplanation {
|
|
951
|
+
/** Stable opaque id; used only for "Was this helpful?" feedback. */
|
|
952
|
+
explanationId?: string;
|
|
266
953
|
conversationalPreface?: string;
|
|
267
954
|
metricReference?: string;
|
|
268
955
|
headline: string;
|
|
269
956
|
summary: string;
|
|
270
957
|
evidence?: string[];
|
|
958
|
+
headlineEvidenceIds?: string[];
|
|
959
|
+
summaryEvidenceIds?: string[];
|
|
960
|
+
businessMeaningEvidenceIds?: string[];
|
|
961
|
+
evidenceStatements?: Array<{
|
|
962
|
+
text: string;
|
|
963
|
+
evidenceIds?: string[];
|
|
964
|
+
}>;
|
|
965
|
+
evidenceItems?: AnalyticsExplanationEvidenceItem[];
|
|
966
|
+
periods?: AnalyticsExplanationPeriod[];
|
|
967
|
+
missing?: AnalyticsExplanationMissing[];
|
|
968
|
+
timezone?: string;
|
|
969
|
+
checkedAt?: string;
|
|
970
|
+
currentPeriodInProgress?: boolean;
|
|
971
|
+
cached?: boolean;
|
|
972
|
+
dataFreshness?: AnalyticsExplanationDataFreshness;
|
|
271
973
|
businessMeaning?: string;
|
|
272
974
|
possibleDrivers?: Array<{
|
|
273
975
|
hypothesis: string;
|
|
274
976
|
howToCheck: string;
|
|
977
|
+
evidenceIds?: string[];
|
|
275
978
|
}>;
|
|
276
979
|
recommendations?: Array<{
|
|
277
980
|
action: string;
|
|
278
981
|
why: string;
|
|
279
982
|
successMetric?: string;
|
|
983
|
+
evidenceIds?: string[];
|
|
280
984
|
}>;
|
|
281
985
|
forecast?: {
|
|
282
986
|
text: string;
|
|
@@ -287,6 +991,12 @@ interface AnalyticsVisualizationExplanation {
|
|
|
287
991
|
limitations?: string[];
|
|
288
992
|
followUps?: string[];
|
|
289
993
|
source: 'governed_result' | 'ai_grounded' | 'rag_deterministic_analysis' | 'analysis_contract' | string;
|
|
994
|
+
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
995
|
+
aiExplanation?: {
|
|
996
|
+
status: string;
|
|
997
|
+
explanationId?: string;
|
|
998
|
+
retryAvailable?: boolean;
|
|
999
|
+
} | null;
|
|
290
1000
|
}
|
|
291
1001
|
interface AnalyticsVisualizationAnalysis {
|
|
292
1002
|
summary: string;
|
|
@@ -416,6 +1126,7 @@ interface AnalyticsVisualization {
|
|
|
416
1126
|
tableAvailable?: boolean;
|
|
417
1127
|
downloadAvailable?: boolean;
|
|
418
1128
|
explanation?: AnalyticsVisualizationExplanation;
|
|
1129
|
+
valueProvenance?: AnalyticsValueProvenance[];
|
|
419
1130
|
}
|
|
420
1131
|
interface SpeechResult {
|
|
421
1132
|
providerReady: boolean;
|
|
@@ -430,6 +1141,9 @@ interface LiveEvent {
|
|
|
430
1141
|
content: string;
|
|
431
1142
|
authorName?: string;
|
|
432
1143
|
createdAt: string;
|
|
1144
|
+
/** On an ai_handback notice: the visitor had asked for a person, so offer
|
|
1145
|
+
* to bring one back. */
|
|
1146
|
+
reconnectOffered?: boolean;
|
|
433
1147
|
}
|
|
434
1148
|
interface LiveEventsResult {
|
|
435
1149
|
mode: 'ai' | 'queued' | 'human';
|
|
@@ -445,6 +1159,8 @@ interface AuthenticatedHistoryMessage {
|
|
|
445
1159
|
content: string;
|
|
446
1160
|
authorName?: string;
|
|
447
1161
|
messageType?: string;
|
|
1162
|
+
/** On an ai_handback notice: the visitor had asked for a person. */
|
|
1163
|
+
reconnectOffered?: boolean;
|
|
448
1164
|
sources?: Array<{
|
|
449
1165
|
title?: string;
|
|
450
1166
|
url?: string;
|
|
@@ -467,9 +1183,22 @@ interface AuthenticatedHistoryResult {
|
|
|
467
1183
|
interface StreamCallbacks {
|
|
468
1184
|
/** Called with each incremental text chunk. */
|
|
469
1185
|
onChunk: (text: string) => void;
|
|
1186
|
+
/** The answer text and metadata have arrived; optional reply audio may follow. */
|
|
1187
|
+
onTextReady?: () => void;
|
|
1188
|
+
/** Live answers: what was streamed so far is replaced by a newer answer. */
|
|
1189
|
+
onReset?: () => void;
|
|
1190
|
+
/** Live answers: one spoken piece of the reply, in order, while it is still
|
|
1191
|
+
* being written. Older backends send a single whole-reply clip instead. */
|
|
1192
|
+
onAudioSegment?: (segment: LiveAudioSegment) => void;
|
|
470
1193
|
signal?: AbortSignal;
|
|
471
1194
|
/** True only for turns sent from the active Speak-with-AI call. */
|
|
472
1195
|
voicePlaybackRequested?: boolean;
|
|
1196
|
+
/** Stable id of the visitor's message. A retry sends the same id, so the
|
|
1197
|
+
* backend answers and bills the turn once. */
|
|
1198
|
+
clientMessageId?: string;
|
|
1199
|
+
attachmentId?: string;
|
|
1200
|
+
/** Every stored file sent with this message. */
|
|
1201
|
+
attachmentIds?: string[];
|
|
473
1202
|
}
|
|
474
1203
|
interface ActionResult {
|
|
475
1204
|
ok: boolean;
|
|
@@ -478,15 +1207,33 @@ interface ActionResult {
|
|
|
478
1207
|
* a real calendar event was created (event mode) or a Calendly link was
|
|
479
1208
|
* resolved (link mode). Absent when it fell back to a staff-follow-up request. */
|
|
480
1209
|
booking?: DemoBooking;
|
|
1210
|
+
/** Case number for a request staff will follow up on (support, demo, callback). */
|
|
1211
|
+
caseReference?: string;
|
|
1212
|
+
/** Inquiry receiving this booking receipt; used to confirm hosted Calendly completion. */
|
|
1213
|
+
inquiryId?: string;
|
|
481
1214
|
}
|
|
482
1215
|
/** Outcome of a live book-a-demo (mirrors backend services.PublicDemoBooking). */
|
|
483
1216
|
interface DemoBooking {
|
|
484
1217
|
mode: 'event' | 'link';
|
|
485
1218
|
provider: string;
|
|
486
1219
|
confirmed?: boolean;
|
|
1220
|
+
/** The request and slot were retained, but the provider outcome could not be verified. */
|
|
1221
|
+
verificationPending?: boolean;
|
|
487
1222
|
eventLink?: string;
|
|
488
1223
|
meetingUrl?: string;
|
|
489
1224
|
schedulingLink?: string;
|
|
1225
|
+
cancelUrl?: string;
|
|
1226
|
+
rescheduleUrl?: string;
|
|
1227
|
+
startAt?: string;
|
|
1228
|
+
endAt?: string;
|
|
1229
|
+
timezone?: string;
|
|
1230
|
+
title?: string;
|
|
1231
|
+
}
|
|
1232
|
+
interface HostedBookingConfirmation {
|
|
1233
|
+
sessionId: string;
|
|
1234
|
+
inquiryId: string;
|
|
1235
|
+
eventUri: string;
|
|
1236
|
+
inviteeUri: string;
|
|
490
1237
|
}
|
|
491
1238
|
/** A 👍/👎 a visitor left on one assistant reply (POST /public-chat/feedback). */
|
|
492
1239
|
interface FeedbackInput {
|
|
@@ -500,6 +1247,31 @@ interface FeedbackInput {
|
|
|
500
1247
|
question?: string;
|
|
501
1248
|
answer?: string;
|
|
502
1249
|
}
|
|
1250
|
+
/** "Was this helpful?" vote on one analytics explanation
|
|
1251
|
+
* (POST /public-chat/explanation-feedback). One vote per visitor session per
|
|
1252
|
+
* explanation; `clear` removes it. Never billed. */
|
|
1253
|
+
interface ExplanationFeedbackInput {
|
|
1254
|
+
sessionId: string;
|
|
1255
|
+
explanationId: string;
|
|
1256
|
+
rating: 'up' | 'down' | 'clear';
|
|
1257
|
+
reasons?: Array<'wrong_numbers' | 'missing_comparison' | 'unclear' | 'too_long'>;
|
|
1258
|
+
comment?: string;
|
|
1259
|
+
modelId?: string;
|
|
1260
|
+
modelVersion?: number;
|
|
1261
|
+
/** Which public surface showed the explanation. */
|
|
1262
|
+
surface?: 'widget' | 'chat_app';
|
|
1263
|
+
}
|
|
1264
|
+
/** Detailed AI explanation job for an analytics answer
|
|
1265
|
+
* (GET /public-chat/analytics-explanations/:id). `explanation` is set only
|
|
1266
|
+
* when ready and is the checked, public-safe explanation. */
|
|
1267
|
+
interface ExplanationJob {
|
|
1268
|
+
status: 'pending' | 'ready' | 'failed' | 'not_requested' | string;
|
|
1269
|
+
explanationId?: string;
|
|
1270
|
+
retryAvailable?: boolean;
|
|
1271
|
+
explanation?: Record<string, unknown> | null;
|
|
1272
|
+
/** The free basic explanation as updated by the job (gains the baseline sentence). */
|
|
1273
|
+
basic?: Record<string, unknown> | null;
|
|
1274
|
+
}
|
|
503
1275
|
/** A [start, end) window the org's calendar is busy. */
|
|
504
1276
|
interface BusyRange {
|
|
505
1277
|
start: string;
|
|
@@ -538,21 +1310,24 @@ interface Transport {
|
|
|
538
1310
|
stream(question: string, sessionId: string, cb: StreamCallbacks): Promise<TurnResult>;
|
|
539
1311
|
/** Poll for staff/system events after a timestamp during live handoff. */
|
|
540
1312
|
liveEvents(sessionId: string, after: string): Promise<LiveEventsResult>;
|
|
1313
|
+
/** Short-lived signal that this chat is open in a visible browser tab. */
|
|
1314
|
+
presence(sessionId: string): Promise<void>;
|
|
541
1315
|
/** Soft visitor typing hint for the staff console. */
|
|
542
1316
|
typing(sessionId: string, isTyping: boolean): Promise<void>;
|
|
543
1317
|
action(type: string, payload: Record<string, unknown>, endpointOverride?: string): Promise<ActionResult>;
|
|
1318
|
+
confirmHostedBooking?(input: HostedBookingConfirmation): Promise<DemoBooking>;
|
|
544
1319
|
/** Synthesize short widget UI prompts through the token's configured TTS voice. */
|
|
545
1320
|
speak(text: string): Promise<SpeechResult>;
|
|
546
1321
|
transcribe(audioBase64: string, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
|
|
547
1322
|
/** Preferred binary voice upload. Optional for backward-compatible custom transports. */
|
|
1323
|
+
/** A file the visitor attached to this conversation, for preview. */
|
|
1324
|
+
fetchAttachment?(attachmentId: string, sessionId: string): Promise<Blob>;
|
|
548
1325
|
transcribeAudio?(audio: Blob, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
*/
|
|
555
|
-
extract(fileBase64: string, mimeType: string, filename?: string): Promise<string>;
|
|
1326
|
+
uploadAttachment?(fileBase64: string, mimeType: string, filename: string, sessionId: string, analyze: boolean): Promise<{
|
|
1327
|
+
id: string;
|
|
1328
|
+
text: string;
|
|
1329
|
+
analysisFailed: boolean;
|
|
1330
|
+
}>;
|
|
556
1331
|
/** Search GIFs (Tenor). Returns [] when no key is configured. */
|
|
557
1332
|
searchGifs(query: string): Promise<GifResult[]>;
|
|
558
1333
|
/**
|
|
@@ -574,6 +1349,13 @@ interface Transport {
|
|
|
574
1349
|
/** Record a 👍/👎 on an assistant reply (`POST /public-chat/feedback`).
|
|
575
1350
|
* Best-effort — a failed rating never disrupts the chat. */
|
|
576
1351
|
sendFeedback(input: FeedbackInput): Promise<void>;
|
|
1352
|
+
/** Record a vote on an analytics explanation. Rejects on failure so the UI
|
|
1353
|
+
* can offer a retry (unlike `sendFeedback`). Optional for custom transports. */
|
|
1354
|
+
sendExplanationFeedback?(input: ExplanationFeedbackInput): Promise<void>;
|
|
1355
|
+
/** Poll the detailed AI explanation of an analytics answer. Optional. */
|
|
1356
|
+
fetchExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app', signal?: AbortSignal): Promise<ExplanationJob>;
|
|
1357
|
+
/** "Try again" on a failed detailed AI explanation. Optional. */
|
|
1358
|
+
retryExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app'): Promise<ExplanationJob>;
|
|
577
1359
|
}
|
|
578
1360
|
//#endregion
|
|
579
1361
|
//#region src/types.d.ts
|
|
@@ -646,6 +1428,11 @@ interface WidgetConfig {
|
|
|
646
1428
|
labels?: Partial<WidgetStrings>;
|
|
647
1429
|
/** Locale used to select a translation bundle. Defaults to browser locale. */
|
|
648
1430
|
locale?: string;
|
|
1431
|
+
/**
|
|
1432
|
+
* Text direction. `auto` (default) follows the locale: Arabic, Hebrew,
|
|
1433
|
+
* Persian, Urdu and similar scripts render right-to-left.
|
|
1434
|
+
*/
|
|
1435
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
649
1436
|
/**
|
|
650
1437
|
* Translation data keyed by locale (`fr`, `fr-CA`, `yo`, ...). Exact locale
|
|
651
1438
|
* wins, then its base language. Explicit `labels` still wins over the pack.
|
|
@@ -745,6 +1532,14 @@ interface WidgetConfig {
|
|
|
745
1532
|
role: 'user' | 'assistant';
|
|
746
1533
|
content: string;
|
|
747
1534
|
}) => void;
|
|
1535
|
+
/** Called only for a server-cited source in a signed analytics answer.
|
|
1536
|
+
* The host should open it through its authorized analytics client. */
|
|
1537
|
+
onOpenAnalyticsSource?: (source: {
|
|
1538
|
+
kind: 'liveboard_tile' | 'insight';
|
|
1539
|
+
id: string;
|
|
1540
|
+
/** Result filters for a host to validate against the destination board. */
|
|
1541
|
+
appliedFilters?: AnalyticsVisualization['appliedFilters'];
|
|
1542
|
+
}) => void;
|
|
748
1543
|
onAction?: (action: string) => void;
|
|
749
1544
|
onHandoff?: () => void;
|
|
750
1545
|
}
|
|
@@ -845,7 +1640,7 @@ interface WidgetHandle {
|
|
|
845
1640
|
}
|
|
846
1641
|
/** A rendered chat message. */
|
|
847
1642
|
interface ChatArtifact {
|
|
848
|
-
type: 'image' | 'resource_link' | 'visualization';
|
|
1643
|
+
type: 'image' | 'video' | 'resource_link' | 'visualization';
|
|
849
1644
|
name?: string;
|
|
850
1645
|
title?: string;
|
|
851
1646
|
caption?: string;
|
|
@@ -857,6 +1652,12 @@ interface ChatArtifact {
|
|
|
857
1652
|
/** Local compatibility bridge for the existing governed analytics result. */
|
|
858
1653
|
visualization?: AnalyticsVisualization;
|
|
859
1654
|
}
|
|
1655
|
+
/** A file sent with a visitor message. */
|
|
1656
|
+
interface MessageAttachment {
|
|
1657
|
+
/** The stored attachment, when it was uploaded. */
|
|
1658
|
+
id?: string;
|
|
1659
|
+
name: string;
|
|
1660
|
+
}
|
|
860
1661
|
interface ChatMessage {
|
|
861
1662
|
id: string;
|
|
862
1663
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -865,12 +1666,21 @@ interface ChatMessage {
|
|
|
865
1666
|
authorName?: string;
|
|
866
1667
|
/** Live handoff event type from the backend, e.g. agent_joined. */
|
|
867
1668
|
liveEventType?: string;
|
|
1669
|
+
/** An ai_handback notice that may offer "Reconnect to support". */
|
|
1670
|
+
offerReconnect?: boolean;
|
|
1671
|
+
/** Local assistant message opened by "Reconnect to support". */
|
|
1672
|
+
reconnectOffer?: boolean;
|
|
868
1673
|
/** ISO timestamp for server-originated live events. */
|
|
869
1674
|
createdAt?: string;
|
|
870
1675
|
/** Inline image (e.g. a GIF the visitor sent). Rendered in the bubble. */
|
|
871
1676
|
imageUrl?: string;
|
|
872
1677
|
/** Name of a file the visitor attached (rendered as a chip on their bubble). */
|
|
873
1678
|
attachmentName?: string;
|
|
1679
|
+
/** The stored attachment behind attachmentName, for preview. */
|
|
1680
|
+
attachmentId?: string;
|
|
1681
|
+
/** Every file sent with this message (newer messages; older ones use
|
|
1682
|
+
* attachmentName / attachmentId). */
|
|
1683
|
+
attachments?: MessageAttachment[];
|
|
874
1684
|
sources?: Source[];
|
|
875
1685
|
suggestedReplies?: string[];
|
|
876
1686
|
availableActions?: string[];
|
|
@@ -893,6 +1703,10 @@ interface ChatMessage {
|
|
|
893
1703
|
feedback?: 'up' | 'down';
|
|
894
1704
|
visualization?: AnalyticsVisualization;
|
|
895
1705
|
artifacts?: ChatArtifact[];
|
|
1706
|
+
/** Set on a restored message whose analytics result was not kept in local storage. */
|
|
1707
|
+
resultExpired?: {
|
|
1708
|
+
title?: string;
|
|
1709
|
+
};
|
|
896
1710
|
}
|
|
897
1711
|
interface Source {
|
|
898
1712
|
title?: string;
|
|
@@ -956,7 +1770,7 @@ interface BootstrapInfo {
|
|
|
956
1770
|
offline?: boolean;
|
|
957
1771
|
/** Book-a-demo scheduler status (present only when book-a-demo is enabled).
|
|
958
1772
|
* Drives the demo UX: event-mode → in-widget slot picker that creates a real
|
|
959
|
-
* calendar event; link-mode → a
|
|
1773
|
+
* calendar event or Calendly invitee; link-mode → a hosted scheduler; absent/!connected →
|
|
960
1774
|
* slot picker that just files a request for staff to confirm. */
|
|
961
1775
|
scheduler?: SchedulerInfo;
|
|
962
1776
|
}
|
|
@@ -981,4 +1795,4 @@ interface SchedulerInfo {
|
|
|
981
1795
|
};
|
|
982
1796
|
}
|
|
983
1797
|
//#endregion
|
|
984
|
-
export {
|
|
1798
|
+
export { buildWidgetAnalyticsChartModel as A, StringsProvider as C, formatResultCell as D, ResultTable as E, AnalyticsAIExplanationTransport as M, AnalyticsExplanationInput as N, serializeResultCsv as O, Transport as S, AnalyticsResultDetail as T, DemoSlotsResult as _, MessageAttachment as a, PublicChatAction as b, Visitor as c, WidgetHandle as d, WidgetThemeTokens as f, DemoBooking as g, AnalyticsVisualization as h, FeaturedLink as i, ResultLabels as j, WidgetAnalyticsChart as k, WidgetActionTranslation as l, ActionResult as m, ChatArtifact as n, SchedulerInfo as o, WidgetUser as p, ChatMessage as r, Source as s, BootstrapInfo as t, WidgetConfig as u, ExplanationFeedbackInput as v, WidgetStrings as w, PublicChatActionField as x, GifResult as y };
|