@accurix/centrinfo-widget 5.0.0 → 5.1.1
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 +182 -30
- package/dist/cdn/centrinfo-widget-charts.js +15826 -0
- package/dist/cdn/centrinfo-widget-dev.js +122 -0
- package/dist/cdn/centrinfo-widget.js +272 -629
- package/dist/cdn/manifest.json +20 -6
- package/dist/dev-transports-DqSPyIEz.mjs +1 -0
- package/dist/dev-transports-KlSdSZpj.cjs +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 +152 -41
- package/dist/runtime.d.mts +25 -123
- package/dist/runtime.mjs +2 -2
- package/dist/styles-CvzR5bT8.cjs +3516 -0
- package/dist/styles-mW_qo6Ed.mjs +3516 -0
- package/dist/{types-BGKFxmKB.d.cts → types-D0VIOagk.d.cts} +514 -2
- package/dist/{types-DhmmWqaj.d.mts → types-k3nQBQjf.d.mts} +724 -4
- package/package.json +2 -5
- package/dist/styles-BgWsSZsR.cjs +0 -7714
- package/dist/styles-CIJFMOKa.mjs +0 -3869
|
@@ -1,7 +1,570 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as preact3 from "preact";
|
|
2
|
+
import { JSX } from "preact";
|
|
2
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
|
+
}) => preact3.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) => preact3.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
|
|
3
567
|
//#region src/i18n.d.ts
|
|
4
|
-
|
|
5
568
|
/**
|
|
6
569
|
* Every user-visible chrome string in one place. The widget ships English
|
|
7
570
|
* defaults; a host localises by passing `labels` to `Centrinfo.init()` —
|
|
@@ -11,6 +574,12 @@ import * as preact0 from "preact";
|
|
|
11
574
|
* never produces.
|
|
12
575
|
*/
|
|
13
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>;
|
|
14
583
|
/** Optional full-page labels. Older integrations use the core labels as fallbacks. */
|
|
15
584
|
fullPageNewConversation?: string;
|
|
16
585
|
fullPageHistory?: string;
|
|
@@ -101,6 +670,7 @@ interface WidgetStrings {
|
|
|
101
670
|
/** Per-message 👍/👎 feedback. */
|
|
102
671
|
feedbackHelpful: string;
|
|
103
672
|
feedbackNotHelpful: string;
|
|
673
|
+
feedbackAnswerPrompt: string;
|
|
104
674
|
feedbackThanks: string;
|
|
105
675
|
/** End-of-chat CSAT prompt. */
|
|
106
676
|
csatPrompt: string;
|
|
@@ -116,6 +686,8 @@ interface WidgetStrings {
|
|
|
116
686
|
emptyReply: string;
|
|
117
687
|
errorGeneric: string;
|
|
118
688
|
errorRateLimit: string;
|
|
689
|
+
/** Shown in place of an analytics result that is not kept in local storage. */
|
|
690
|
+
resultExpired: string;
|
|
119
691
|
attaching: string;
|
|
120
692
|
attachTooLarge: string;
|
|
121
693
|
attachFailed: string;
|
|
@@ -198,6 +770,7 @@ interface WidgetStrings {
|
|
|
198
770
|
bookingLoadingScheduler: string;
|
|
199
771
|
bookingMeetingLink: string;
|
|
200
772
|
bookingManageLink: string;
|
|
773
|
+
bookingUnverifiedLink: string;
|
|
201
774
|
bookingCheckingDetails: string;
|
|
202
775
|
bookingDetailsUnavailable: string;
|
|
203
776
|
bookingRetryDetails: string;
|
|
@@ -206,7 +779,7 @@ interface WidgetStrings {
|
|
|
206
779
|
previewActionNote: string;
|
|
207
780
|
previewBanner: string;
|
|
208
781
|
}
|
|
209
|
-
declare const StringsProvider:
|
|
782
|
+
declare const StringsProvider: preact3.Provider<WidgetStrings>;
|
|
210
783
|
//#endregion
|
|
211
784
|
//#region src/api/types.d.ts
|
|
212
785
|
/** The result metadata that arrives with (or after) an answer. */
|
|
@@ -296,6 +869,7 @@ interface AnalyticsVisualizationColumn {
|
|
|
296
869
|
dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
|
|
297
870
|
semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
|
|
298
871
|
aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
|
|
872
|
+
allowedAggregations?: Array<'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max'>;
|
|
299
873
|
formatPattern?: string;
|
|
300
874
|
currencyCode?: string;
|
|
301
875
|
description?: string;
|
|
@@ -313,21 +887,101 @@ interface AnalyticsVisualizationRecommendation {
|
|
|
313
887
|
reason?: string;
|
|
314
888
|
confidence?: number;
|
|
315
889
|
}
|
|
890
|
+
type AnalyticsValueStatus = 'observed' | 'confirmed_zero' | 'empty_bucket' | 'unconfirmed_zero' | 'missing';
|
|
891
|
+
interface AnalyticsEvidencePeriod {
|
|
892
|
+
label: string;
|
|
893
|
+
start?: string;
|
|
894
|
+
end?: string;
|
|
895
|
+
timezone?: string;
|
|
896
|
+
}
|
|
897
|
+
interface AnalyticsExplanationEvidenceItem {
|
|
898
|
+
id: string;
|
|
899
|
+
text: string;
|
|
900
|
+
kind?: string;
|
|
901
|
+
metric?: string;
|
|
902
|
+
period?: AnalyticsEvidencePeriod;
|
|
903
|
+
filters?: string[];
|
|
904
|
+
value?: number;
|
|
905
|
+
valueStatus: AnalyticsValueStatus | string;
|
|
906
|
+
statusReason?: string;
|
|
907
|
+
source: {
|
|
908
|
+
kind: 'card' | 'supporting_query' | string;
|
|
909
|
+
insightId?: string;
|
|
910
|
+
queryRunId?: string;
|
|
911
|
+
liveboardTileId?: string;
|
|
912
|
+
};
|
|
913
|
+
checkedAt?: string;
|
|
914
|
+
}
|
|
915
|
+
interface AnalyticsExplanationPeriod {
|
|
916
|
+
evidenceId?: string;
|
|
917
|
+
label: string;
|
|
918
|
+
start?: string;
|
|
919
|
+
end?: string;
|
|
920
|
+
timezone?: string;
|
|
921
|
+
current?: boolean;
|
|
922
|
+
inProgress?: boolean;
|
|
923
|
+
value?: number;
|
|
924
|
+
valueText?: string;
|
|
925
|
+
valueStatus: AnalyticsValueStatus | string;
|
|
926
|
+
statusReason?: string;
|
|
927
|
+
source?: 'card' | 'supporting_query' | string;
|
|
928
|
+
}
|
|
929
|
+
interface AnalyticsExplanationMissing {
|
|
930
|
+
evidenceId?: string;
|
|
931
|
+
label: string;
|
|
932
|
+
period?: AnalyticsEvidencePeriod;
|
|
933
|
+
reason: string;
|
|
934
|
+
}
|
|
935
|
+
interface AnalyticsExplanationDataFreshness {
|
|
936
|
+
status: string;
|
|
937
|
+
dataAsOf?: string;
|
|
938
|
+
expectedThrough?: string;
|
|
939
|
+
lagDays?: number;
|
|
940
|
+
checkedAt?: string;
|
|
941
|
+
timezone?: string;
|
|
942
|
+
}
|
|
943
|
+
interface AnalyticsValueProvenance {
|
|
944
|
+
rowIndex: number;
|
|
945
|
+
field: string;
|
|
946
|
+
period?: string;
|
|
947
|
+
filled: 'empty_bucket' | string;
|
|
948
|
+
status: 'empty_bucket' | 'confirmed_zero' | 'unconfirmed_zero' | string;
|
|
949
|
+
reason?: string;
|
|
950
|
+
}
|
|
316
951
|
interface AnalyticsVisualizationExplanation {
|
|
952
|
+
/** Stable opaque id; used only for "Was this helpful?" feedback. */
|
|
953
|
+
explanationId?: string;
|
|
317
954
|
conversationalPreface?: string;
|
|
318
955
|
metricReference?: string;
|
|
319
956
|
headline: string;
|
|
320
957
|
summary: string;
|
|
321
958
|
evidence?: string[];
|
|
959
|
+
headlineEvidenceIds?: string[];
|
|
960
|
+
summaryEvidenceIds?: string[];
|
|
961
|
+
businessMeaningEvidenceIds?: string[];
|
|
962
|
+
evidenceStatements?: Array<{
|
|
963
|
+
text: string;
|
|
964
|
+
evidenceIds?: string[];
|
|
965
|
+
}>;
|
|
966
|
+
evidenceItems?: AnalyticsExplanationEvidenceItem[];
|
|
967
|
+
periods?: AnalyticsExplanationPeriod[];
|
|
968
|
+
missing?: AnalyticsExplanationMissing[];
|
|
969
|
+
timezone?: string;
|
|
970
|
+
checkedAt?: string;
|
|
971
|
+
currentPeriodInProgress?: boolean;
|
|
972
|
+
cached?: boolean;
|
|
973
|
+
dataFreshness?: AnalyticsExplanationDataFreshness;
|
|
322
974
|
businessMeaning?: string;
|
|
323
975
|
possibleDrivers?: Array<{
|
|
324
976
|
hypothesis: string;
|
|
325
977
|
howToCheck: string;
|
|
978
|
+
evidenceIds?: string[];
|
|
326
979
|
}>;
|
|
327
980
|
recommendations?: Array<{
|
|
328
981
|
action: string;
|
|
329
982
|
why: string;
|
|
330
983
|
successMetric?: string;
|
|
984
|
+
evidenceIds?: string[];
|
|
331
985
|
}>;
|
|
332
986
|
forecast?: {
|
|
333
987
|
text: string;
|
|
@@ -338,6 +992,12 @@ interface AnalyticsVisualizationExplanation {
|
|
|
338
992
|
limitations?: string[];
|
|
339
993
|
followUps?: string[];
|
|
340
994
|
source: 'governed_result' | 'ai_grounded' | 'rag_deterministic_analysis' | 'analysis_contract' | string;
|
|
995
|
+
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
996
|
+
aiExplanation?: {
|
|
997
|
+
status: string;
|
|
998
|
+
explanationId?: string;
|
|
999
|
+
retryAvailable?: boolean;
|
|
1000
|
+
} | null;
|
|
341
1001
|
}
|
|
342
1002
|
interface AnalyticsVisualizationAnalysis {
|
|
343
1003
|
summary: string;
|
|
@@ -467,6 +1127,7 @@ interface AnalyticsVisualization {
|
|
|
467
1127
|
tableAvailable?: boolean;
|
|
468
1128
|
downloadAvailable?: boolean;
|
|
469
1129
|
explanation?: AnalyticsVisualizationExplanation;
|
|
1130
|
+
valueProvenance?: AnalyticsValueProvenance[];
|
|
470
1131
|
}
|
|
471
1132
|
interface SpeechResult {
|
|
472
1133
|
providerReady: boolean;
|
|
@@ -543,6 +1204,11 @@ interface StreamCallbacks {
|
|
|
543
1204
|
interface ActionResult {
|
|
544
1205
|
ok: boolean;
|
|
545
1206
|
note?: string;
|
|
1207
|
+
/** Saved conversation message for this completed action. */
|
|
1208
|
+
receipt?: {
|
|
1209
|
+
id: string;
|
|
1210
|
+
content: string;
|
|
1211
|
+
};
|
|
546
1212
|
/** Present on book-a-demo when a connected scheduler fulfilled it live —
|
|
547
1213
|
* a real calendar event was created (event mode) or a Calendly link was
|
|
548
1214
|
* resolved (link mode). Absent when it fell back to a staff-follow-up request. */
|
|
@@ -568,6 +1234,11 @@ interface DemoBooking {
|
|
|
568
1234
|
endAt?: string;
|
|
569
1235
|
timezone?: string;
|
|
570
1236
|
title?: string;
|
|
1237
|
+
/** Returned with hosted booking confirmation for immediate chat display. */
|
|
1238
|
+
receipt?: {
|
|
1239
|
+
id: string;
|
|
1240
|
+
content: string;
|
|
1241
|
+
};
|
|
571
1242
|
}
|
|
572
1243
|
interface HostedBookingConfirmation {
|
|
573
1244
|
sessionId: string;
|
|
@@ -587,6 +1258,31 @@ interface FeedbackInput {
|
|
|
587
1258
|
question?: string;
|
|
588
1259
|
answer?: string;
|
|
589
1260
|
}
|
|
1261
|
+
/** "Was this helpful?" vote on one analytics explanation
|
|
1262
|
+
* (POST /public-chat/explanation-feedback). One vote per visitor session per
|
|
1263
|
+
* explanation; `clear` removes it. Never billed. */
|
|
1264
|
+
interface ExplanationFeedbackInput {
|
|
1265
|
+
sessionId: string;
|
|
1266
|
+
explanationId: string;
|
|
1267
|
+
rating: 'up' | 'down' | 'clear';
|
|
1268
|
+
reasons?: Array<'wrong_numbers' | 'missing_comparison' | 'unclear' | 'too_long'>;
|
|
1269
|
+
comment?: string;
|
|
1270
|
+
modelId?: string;
|
|
1271
|
+
modelVersion?: number;
|
|
1272
|
+
/** Which public surface showed the explanation. */
|
|
1273
|
+
surface?: 'widget' | 'chat_app';
|
|
1274
|
+
}
|
|
1275
|
+
/** Detailed AI explanation job for an analytics answer
|
|
1276
|
+
* (GET /public-chat/analytics-explanations/:id). `explanation` is set only
|
|
1277
|
+
* when ready and is the checked, public-safe explanation. */
|
|
1278
|
+
interface ExplanationJob {
|
|
1279
|
+
status: 'pending' | 'ready' | 'failed' | 'not_requested' | string;
|
|
1280
|
+
explanationId?: string;
|
|
1281
|
+
retryAvailable?: boolean;
|
|
1282
|
+
explanation?: Record<string, unknown> | null;
|
|
1283
|
+
/** The free basic explanation as updated by the job (gains the baseline sentence). */
|
|
1284
|
+
basic?: Record<string, unknown> | null;
|
|
1285
|
+
}
|
|
590
1286
|
/** A [start, end) window the org's calendar is busy. */
|
|
591
1287
|
interface BusyRange {
|
|
592
1288
|
start: string;
|
|
@@ -664,6 +1360,13 @@ interface Transport {
|
|
|
664
1360
|
/** Record a 👍/👎 on an assistant reply (`POST /public-chat/feedback`).
|
|
665
1361
|
* Best-effort — a failed rating never disrupts the chat. */
|
|
666
1362
|
sendFeedback(input: FeedbackInput): Promise<void>;
|
|
1363
|
+
/** Record a vote on an analytics explanation. Rejects on failure so the UI
|
|
1364
|
+
* can offer a retry (unlike `sendFeedback`). Optional for custom transports. */
|
|
1365
|
+
sendExplanationFeedback?(input: ExplanationFeedbackInput): Promise<void>;
|
|
1366
|
+
/** Poll the detailed AI explanation of an analytics answer. Optional. */
|
|
1367
|
+
fetchExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app', signal?: AbortSignal): Promise<ExplanationJob>;
|
|
1368
|
+
/** "Try again" on a failed detailed AI explanation. Optional. */
|
|
1369
|
+
retryExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app'): Promise<ExplanationJob>;
|
|
667
1370
|
}
|
|
668
1371
|
//#endregion
|
|
669
1372
|
//#region src/types.d.ts
|
|
@@ -736,6 +1439,11 @@ interface WidgetConfig {
|
|
|
736
1439
|
labels?: Partial<WidgetStrings>;
|
|
737
1440
|
/** Locale used to select a translation bundle. Defaults to browser locale. */
|
|
738
1441
|
locale?: string;
|
|
1442
|
+
/**
|
|
1443
|
+
* Text direction. `auto` (default) follows the locale: Arabic, Hebrew,
|
|
1444
|
+
* Persian, Urdu and similar scripts render right-to-left.
|
|
1445
|
+
*/
|
|
1446
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
739
1447
|
/**
|
|
740
1448
|
* Translation data keyed by locale (`fr`, `fr-CA`, `yo`, ...). Exact locale
|
|
741
1449
|
* wins, then its base language. Explicit `labels` still wins over the pack.
|
|
@@ -835,6 +1543,14 @@ interface WidgetConfig {
|
|
|
835
1543
|
role: 'user' | 'assistant';
|
|
836
1544
|
content: string;
|
|
837
1545
|
}) => void;
|
|
1546
|
+
/** Called only for a server-cited source in a signed analytics answer.
|
|
1547
|
+
* The host should open it through its authorized analytics client. */
|
|
1548
|
+
onOpenAnalyticsSource?: (source: {
|
|
1549
|
+
kind: 'liveboard_tile' | 'insight';
|
|
1550
|
+
id: string;
|
|
1551
|
+
/** Result filters for a host to validate against the destination board. */
|
|
1552
|
+
appliedFilters?: AnalyticsVisualization['appliedFilters'];
|
|
1553
|
+
}) => void;
|
|
838
1554
|
onAction?: (action: string) => void;
|
|
839
1555
|
onHandoff?: () => void;
|
|
840
1556
|
}
|
|
@@ -998,6 +1714,10 @@ interface ChatMessage {
|
|
|
998
1714
|
feedback?: 'up' | 'down';
|
|
999
1715
|
visualization?: AnalyticsVisualization;
|
|
1000
1716
|
artifacts?: ChatArtifact[];
|
|
1717
|
+
/** Set on a restored message whose analytics result was not kept in local storage. */
|
|
1718
|
+
resultExpired?: {
|
|
1719
|
+
title?: string;
|
|
1720
|
+
};
|
|
1001
1721
|
}
|
|
1002
1722
|
interface Source {
|
|
1003
1723
|
title?: string;
|
|
@@ -1086,4 +1806,4 @@ interface SchedulerInfo {
|
|
|
1086
1806
|
};
|
|
1087
1807
|
}
|
|
1088
1808
|
//#endregion
|
|
1089
|
-
export {
|
|
1809
|
+
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 };
|