@accurix/centrinfo-widget 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -28
- package/dist/cdn/centrinfo-widget-charts.js +15826 -0
- package/dist/cdn/centrinfo-widget-dev.js +122 -0
- package/dist/cdn/centrinfo-widget.js +224 -621
- package/dist/cdn/manifest.json +20 -6
- package/dist/dev-transports-CuEqYhZT.cjs +1 -0
- package/dist/dev-transports-D6oaj_ri.mjs +1 -0
- package/dist/echarts-runtime-BfpVL8xu.cjs +24 -0
- package/dist/echarts-runtime-Bu1uy4oO.mjs +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/runtime.cjs +2 -2
- package/dist/runtime.d.cts +149 -41
- package/dist/runtime.d.mts +22 -123
- package/dist/runtime.mjs +2 -2
- package/dist/styles-BH7P8Q_3.cjs +3472 -0
- package/dist/styles-DwSTSmZb.mjs +3472 -0
- package/dist/{types-BGKFxmKB.d.cts → types-CYFMH8yg.d.cts} +503 -2
- package/dist/{types-DhmmWqaj.d.mts → types-D82dr33R.d.mts} +713 -4
- package/package.json +2 -5
- package/dist/styles-BgWsSZsR.cjs +0 -7714
- package/dist/styles-CIJFMOKa.mjs +0 -3869
|
@@ -1,7 +1,362 @@
|
|
|
1
1
|
import * as preact0 from "preact";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region ../centrinfo-results/src/analytics-explanation.d.ts
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Framework-agnostic analytics explanation core.
|
|
7
|
+
*
|
|
8
|
+
* Every surface (Liveboard SDK vanilla DOM, the Preact widget and full-page
|
|
9
|
+
* chat app, and the React dashboard) renders an explanation from the SAME
|
|
10
|
+
* display model built here, so wording, order and value-status rules never
|
|
11
|
+
* drift between surfaces. Renderers only map this model onto their own markup
|
|
12
|
+
* and theme tokens.
|
|
13
|
+
*
|
|
14
|
+
* Step-by-step order (fixed):
|
|
15
|
+
* 1. lead plain business answer (headline + summary)
|
|
16
|
+
* 2. comparison each compared period with its value + status chip
|
|
17
|
+
* 3. conclusions what the data supports
|
|
18
|
+
* 4. limits in-progress / unconfirmed zero / missing period / caveats
|
|
19
|
+
* 5. checked "Times in <tz> · Checked <time>"
|
|
20
|
+
* 6. investigate causes, recommendations, outlook, follow-ups (optional
|
|
21
|
+
* disclosure, collapsed by default)
|
|
22
|
+
*
|
|
23
|
+
* Zero is only "confirmed" when the source says so. An empty bucket or an
|
|
24
|
+
* unconfirmed zero reads as "no records yet" and never produces a % change.
|
|
25
|
+
*
|
|
26
|
+
* Pure TypeScript, no DOM or framework imports: safe for every SDK bundle.
|
|
27
|
+
*/
|
|
28
|
+
type AnalyticsExplanationValueStatus = 'observed' | 'confirmed_zero' | 'empty_bucket' | 'unconfirmed_zero' | 'missing';
|
|
29
|
+
interface AnalyticsExplanationPeriodRangeInput {
|
|
30
|
+
label: string;
|
|
31
|
+
start?: string;
|
|
32
|
+
end?: string;
|
|
33
|
+
timezone?: string;
|
|
34
|
+
}
|
|
35
|
+
interface AnalyticsExplanationEvidenceItemInput {
|
|
36
|
+
id: string;
|
|
37
|
+
text: string;
|
|
38
|
+
kind?: string;
|
|
39
|
+
metric?: string;
|
|
40
|
+
period?: AnalyticsExplanationPeriodRangeInput;
|
|
41
|
+
filters?: string[];
|
|
42
|
+
value?: number;
|
|
43
|
+
valueStatus?: AnalyticsExplanationValueStatus | string;
|
|
44
|
+
statusReason?: string;
|
|
45
|
+
source?: {
|
|
46
|
+
kind?: 'card' | 'supporting_query' | string;
|
|
47
|
+
insightId?: string;
|
|
48
|
+
queryRunId?: string;
|
|
49
|
+
liveboardTileId?: string;
|
|
50
|
+
};
|
|
51
|
+
checkedAt?: string;
|
|
52
|
+
}
|
|
53
|
+
interface AnalyticsExplanationPeriodInput {
|
|
54
|
+
evidenceId?: string;
|
|
55
|
+
label: string;
|
|
56
|
+
start?: string;
|
|
57
|
+
end?: string;
|
|
58
|
+
timezone?: string;
|
|
59
|
+
current?: boolean;
|
|
60
|
+
inProgress?: boolean;
|
|
61
|
+
value?: number;
|
|
62
|
+
valueText?: string;
|
|
63
|
+
valueStatus?: AnalyticsExplanationValueStatus | string;
|
|
64
|
+
statusReason?: string;
|
|
65
|
+
source?: string;
|
|
66
|
+
}
|
|
67
|
+
interface AnalyticsExplanationMissingInput {
|
|
68
|
+
evidenceId?: string;
|
|
69
|
+
label: string;
|
|
70
|
+
period?: AnalyticsExplanationPeriodRangeInput;
|
|
71
|
+
reason: string;
|
|
72
|
+
}
|
|
73
|
+
interface AnalyticsExplanationFreshnessInput {
|
|
74
|
+
status?: string;
|
|
75
|
+
dataAsOf?: string;
|
|
76
|
+
expectedThrough?: string;
|
|
77
|
+
lagDays?: number;
|
|
78
|
+
checkedAt?: string;
|
|
79
|
+
timezone?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Structural explanation shape every surface's DTO satisfies. */
|
|
82
|
+
interface AnalyticsExplanationInput {
|
|
83
|
+
explanationId?: string;
|
|
84
|
+
conversationalPreface?: string;
|
|
85
|
+
headline?: string;
|
|
86
|
+
summary?: string;
|
|
87
|
+
evidence?: string[];
|
|
88
|
+
headlineEvidenceIds?: string[];
|
|
89
|
+
summaryEvidenceIds?: string[];
|
|
90
|
+
businessMeaningEvidenceIds?: string[];
|
|
91
|
+
evidenceStatements?: Array<{
|
|
92
|
+
text: string;
|
|
93
|
+
evidenceIds?: string[];
|
|
94
|
+
}>;
|
|
95
|
+
evidenceItems?: AnalyticsExplanationEvidenceItemInput[];
|
|
96
|
+
periods?: AnalyticsExplanationPeriodInput[];
|
|
97
|
+
missing?: AnalyticsExplanationMissingInput[];
|
|
98
|
+
timezone?: string;
|
|
99
|
+
checkedAt?: string;
|
|
100
|
+
currentPeriodInProgress?: boolean;
|
|
101
|
+
cached?: boolean;
|
|
102
|
+
dataFreshness?: AnalyticsExplanationFreshnessInput;
|
|
103
|
+
businessMeaning?: string;
|
|
104
|
+
possibleDrivers?: Array<{
|
|
105
|
+
hypothesis: string;
|
|
106
|
+
howToCheck: string;
|
|
107
|
+
evidenceIds?: string[];
|
|
108
|
+
}>;
|
|
109
|
+
recommendations?: Array<{
|
|
110
|
+
action: string;
|
|
111
|
+
why: string;
|
|
112
|
+
successMetric?: string;
|
|
113
|
+
evidenceIds?: string[];
|
|
114
|
+
}>;
|
|
115
|
+
forecast?: {
|
|
116
|
+
text: string;
|
|
117
|
+
qualityStatus?: string;
|
|
118
|
+
limitations?: string;
|
|
119
|
+
horizon?: string;
|
|
120
|
+
};
|
|
121
|
+
limitations?: string[];
|
|
122
|
+
followUps?: string[];
|
|
123
|
+
source?: string;
|
|
124
|
+
/** "basic" = the free explanation built from the facts; "detailed" = checked AI wording. */
|
|
125
|
+
level?: 'basic' | 'detailed' | string;
|
|
126
|
+
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
127
|
+
aiExplanation?: AnalyticsAIExplanationInput | null;
|
|
128
|
+
}
|
|
129
|
+
/** State of the detailed AI explanation, as returned by every surface. */
|
|
130
|
+
type AnalyticsAIExplanationStatus = 'pending' | 'ready' | 'failed' | 'not_requested';
|
|
131
|
+
interface AnalyticsAIExplanationInput {
|
|
132
|
+
status: AnalyticsAIExplanationStatus | string;
|
|
133
|
+
explanationId?: string;
|
|
134
|
+
retryAvailable?: boolean;
|
|
135
|
+
}
|
|
136
|
+
declare const ANALYTICS_EXPLANATION_COPY: {
|
|
137
|
+
readonly eyebrow: "Answer from your data";
|
|
138
|
+
readonly provenanceAI: "AI-assisted · evidence checked";
|
|
139
|
+
readonly provenanceGoverned: "Based on current values";
|
|
140
|
+
readonly comparison: "Comparison";
|
|
141
|
+
readonly conclusions: "What we can conclude";
|
|
142
|
+
readonly whyItMatters: "Why it matters";
|
|
143
|
+
readonly limits: "Important limits";
|
|
144
|
+
readonly investigate: "Investigate further";
|
|
145
|
+
readonly evidenceList: "Evidence checked";
|
|
146
|
+
readonly causes: "Possible causes";
|
|
147
|
+
readonly causesHint: "Not proven causes";
|
|
148
|
+
readonly howToCheck: "How to check:";
|
|
149
|
+
readonly recommendations: "Recommended next steps";
|
|
150
|
+
readonly watch: "Watch:";
|
|
151
|
+
readonly outlook: "Outlook";
|
|
152
|
+
readonly followUps: "Ask a follow-up";
|
|
153
|
+
readonly sourceNoteAI: "AI-assisted wording, checked against the live values shown here.";
|
|
154
|
+
readonly sourceNoteGoverned: "Based only on the live values shown here.";
|
|
155
|
+
readonly evidence: "Evidence";
|
|
156
|
+
readonly evidenceMetric: "Metric";
|
|
157
|
+
readonly evidencePeriod: "Period";
|
|
158
|
+
readonly evidenceTimezone: "Timezone";
|
|
159
|
+
readonly evidenceFilters: "Filters";
|
|
160
|
+
readonly evidenceValue: "Value";
|
|
161
|
+
readonly evidenceStatus: "Status";
|
|
162
|
+
readonly evidenceSource: "Source";
|
|
163
|
+
readonly evidenceChecked: "Checked";
|
|
164
|
+
readonly openSource: "Open source";
|
|
165
|
+
readonly closeEvidence: "Close evidence details";
|
|
166
|
+
readonly citationLabel: "Show evidence";
|
|
167
|
+
readonly sourceCard: "This card";
|
|
168
|
+
readonly sourceSupportingQuery: "Supporting query";
|
|
169
|
+
readonly feedbackPrompt: "Was this explanation helpful?";
|
|
170
|
+
readonly feedbackHelpful: "Helpful explanation";
|
|
171
|
+
readonly feedbackNotHelpful: "Unhelpful explanation";
|
|
172
|
+
readonly feedbackReasonsPrompt: "What went wrong? (optional)";
|
|
173
|
+
readonly feedbackCommentPlaceholder: "Anything else? (optional)";
|
|
174
|
+
readonly feedbackSubmit: "Send feedback";
|
|
175
|
+
readonly feedbackThanks: "Thanks for the feedback.";
|
|
176
|
+
readonly feedbackUndo: "Undo";
|
|
177
|
+
readonly feedbackError: "Feedback could not be saved. Try again.";
|
|
178
|
+
readonly notComparable: "Not comparable yet";
|
|
179
|
+
readonly basicExplanation: "Basic explanation";
|
|
180
|
+
readonly preparingDetailed: "Preparing a detailed explanation…";
|
|
181
|
+
readonly detailedReady: "Detailed explanation ready.";
|
|
182
|
+
readonly detailedUnavailable: "A detailed explanation is not available right now.";
|
|
183
|
+
readonly detailedRetry: "Try again";
|
|
184
|
+
readonly region: "Explanation";
|
|
185
|
+
readonly inProgress: "in progress";
|
|
186
|
+
readonly expand: "Expand explanation";
|
|
187
|
+
readonly collapse: "Collapse explanation";
|
|
188
|
+
readonly reasonWrongNumbers: "Wrong numbers";
|
|
189
|
+
readonly reasonMissingComparison: "Missing comparison";
|
|
190
|
+
readonly reasonUnclear: "Unclear";
|
|
191
|
+
readonly reasonTooLong: "Too long";
|
|
192
|
+
};
|
|
193
|
+
/** The explanation panel's copy with a host's overrides on top. */
|
|
194
|
+
type AnalyticsExplanationCopyOverrides = Partial<{ -readonly [K in keyof typeof ANALYTICS_EXPLANATION_COPY]: string }>;
|
|
195
|
+
type AnalyticsComparisonBasis = 'complete' | 'like_for_like' | 'current_in_progress_no_time' | 'not_comparable';
|
|
196
|
+
interface AnalyticsComparisonPeriod {
|
|
197
|
+
label: string;
|
|
198
|
+
start?: string;
|
|
199
|
+
end?: string;
|
|
200
|
+
fullEnd?: string;
|
|
201
|
+
inProgress?: boolean;
|
|
202
|
+
toDate?: boolean;
|
|
203
|
+
}
|
|
204
|
+
/** Backend `periodComparison` (reader-safe projection). */
|
|
205
|
+
interface AnalyticsPeriodComparison {
|
|
206
|
+
comparisonBasis: AnalyticsComparisonBasis | string;
|
|
207
|
+
reason?: string;
|
|
208
|
+
grain?: string;
|
|
209
|
+
measureField?: string;
|
|
210
|
+
seriesField?: string;
|
|
211
|
+
currentPeriod?: AnalyticsComparisonPeriod;
|
|
212
|
+
previousPeriod?: AnalyticsComparisonPeriod;
|
|
213
|
+
currentValue?: number;
|
|
214
|
+
previousToDateValue?: number;
|
|
215
|
+
previousFullValue?: number;
|
|
216
|
+
cutoffAt?: string;
|
|
217
|
+
cutoffSource?: 'now' | 'data_as_of' | string;
|
|
218
|
+
timezone?: string;
|
|
219
|
+
series?: Array<{
|
|
220
|
+
key: string;
|
|
221
|
+
currentValue?: number;
|
|
222
|
+
previousToDateValue?: number;
|
|
223
|
+
previousFullValue?: number;
|
|
224
|
+
}>;
|
|
225
|
+
}
|
|
226
|
+
interface AnalyticsComparisonDisplay {
|
|
227
|
+
basis: AnalyticsComparisonBasis | string;
|
|
228
|
+
kind: 'change' | 'neutral';
|
|
229
|
+
/** Set only for like-for-like (or complete) changes: red/green allowed. */
|
|
230
|
+
percent?: number;
|
|
231
|
+
tone: 'positive' | 'negative' | 'neutral';
|
|
232
|
+
/** Badge text: "↑ 50.0%", "Up from 0", "Today so far: 6 · Yesterday: 26 (full day)". */
|
|
233
|
+
label: string;
|
|
234
|
+
/** "vs yesterday at this time" / "vs same point last week". */
|
|
235
|
+
copy: string;
|
|
236
|
+
/** "Yesterday full day: 26". */
|
|
237
|
+
secondary?: string;
|
|
238
|
+
/** Compact one-line form for KPI cards: "Full day: 26". */
|
|
239
|
+
compactSecondary?: string;
|
|
240
|
+
/** Hover text with the cutoff time. */
|
|
241
|
+
title?: string;
|
|
242
|
+
reason?: string;
|
|
243
|
+
}
|
|
244
|
+
interface AnalyticsGroupComparisonPoint {
|
|
245
|
+
side: 'current' | 'previous';
|
|
246
|
+
basis: string;
|
|
247
|
+
/** Value to plot: previous-to-date on a like-for-like previous bucket. */
|
|
248
|
+
plotValue?: number;
|
|
249
|
+
/** Previous bucket: the full previous value (tooltip). */
|
|
250
|
+
fullValue?: number;
|
|
251
|
+
/** Previous bucket plotted at the same point (label "Yesterday at this time"). */
|
|
252
|
+
toDate: boolean;
|
|
253
|
+
/** Current bucket: this group's change, following the KPI basis rules. */
|
|
254
|
+
display?: AnalyticsComparisonDisplay;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Poll response for a detailed AI explanation. `explanation` is set only when
|
|
258
|
+
* `status` is "ready" and is the CHECKED explanation (never raw model text).
|
|
259
|
+
*/
|
|
260
|
+
interface AnalyticsAIExplanationJob<E extends AnalyticsExplanationInput> {
|
|
261
|
+
status: AnalyticsAIExplanationStatus | string;
|
|
262
|
+
explanationId?: string;
|
|
263
|
+
retryAvailable?: boolean;
|
|
264
|
+
explanation?: E | null;
|
|
265
|
+
/**
|
|
266
|
+
* The free basic explanation as updated by the background job (it gains the
|
|
267
|
+
* baseline sentence, e.g. "within the recent range of 22–28"). Present while
|
|
268
|
+
* the AI explanation is pending or after it failed.
|
|
269
|
+
*/
|
|
270
|
+
basic?: E | null;
|
|
271
|
+
}
|
|
272
|
+
interface AnalyticsAIExplanationTransport<E extends AnalyticsExplanationInput> {
|
|
273
|
+
/** GET the job by id with the surface's own credentials. */
|
|
274
|
+
poll: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
275
|
+
/** "Try again": re-request with the retry flag. Omit when retry is impossible. */
|
|
276
|
+
retry?: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
277
|
+
/** The job reached a final status: let the surface remember it (status only, not the payload). */
|
|
278
|
+
settled?: (explanationId: string, status: 'ready' | 'failed' | 'not_requested') => void;
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region ../centrinfo-results/src/labels.d.ts
|
|
282
|
+
type AnalyticsExplanationCopy = Required<AnalyticsExplanationCopyOverrides>;
|
|
283
|
+
/** Every string the shared result renderer shows. Hosts override any subset. */
|
|
284
|
+
interface ResultLabels {
|
|
285
|
+
resultDetails: string;
|
|
286
|
+
liveMetric: string;
|
|
287
|
+
currentValue: string;
|
|
288
|
+
noMatchTitle: string;
|
|
289
|
+
noMatchBody: string;
|
|
290
|
+
chartType: string;
|
|
291
|
+
chooseChartType: string;
|
|
292
|
+
aggregate: string;
|
|
293
|
+
aggregateTitle: string;
|
|
294
|
+
aggregateCharge: string;
|
|
295
|
+
chartFallback: string;
|
|
296
|
+
chartLine: string;
|
|
297
|
+
chartBar: string;
|
|
298
|
+
chartStackedBar: string;
|
|
299
|
+
chartLineHint: string;
|
|
300
|
+
chartBarHint: string;
|
|
301
|
+
chartStackedBarHint: string;
|
|
302
|
+
aggregationSum: string;
|
|
303
|
+
aggregationAvg: string;
|
|
304
|
+
aggregationMin: string;
|
|
305
|
+
aggregationMax: string;
|
|
306
|
+
aggregationCount: string;
|
|
307
|
+
aggregationCountDistinct: string;
|
|
308
|
+
download: string;
|
|
309
|
+
downloadData: string;
|
|
310
|
+
expandTable: string;
|
|
311
|
+
expandChart: string;
|
|
312
|
+
restoreView: string;
|
|
313
|
+
aboutResult: string;
|
|
314
|
+
aboutPeriod: string;
|
|
315
|
+
aboutResults: string;
|
|
316
|
+
aboutChecked: string;
|
|
317
|
+
aboutTimezone: string;
|
|
318
|
+
aboutSourceData: string;
|
|
319
|
+
aboutFilters: string;
|
|
320
|
+
/** `{count}` placeholder. */
|
|
321
|
+
rowOne: string;
|
|
322
|
+
rowMany: string;
|
|
323
|
+
filtersOne: string;
|
|
324
|
+
filtersMany: string;
|
|
325
|
+
filtersApplied: string;
|
|
326
|
+
notSet: string;
|
|
327
|
+
noValue: string;
|
|
328
|
+
yes: string;
|
|
329
|
+
no: string;
|
|
330
|
+
chartValues: string;
|
|
331
|
+
/** `{measure}`, `{dimension}`. */
|
|
332
|
+
chartTitle: string;
|
|
333
|
+
seriesLimited: string;
|
|
334
|
+
summaryLatest: string;
|
|
335
|
+
summaryNoTrend: string;
|
|
336
|
+
summaryHighest: string;
|
|
337
|
+
summaryNoComparison: string;
|
|
338
|
+
zoomControls: string;
|
|
339
|
+
zoomIn: string;
|
|
340
|
+
zoomOut: string;
|
|
341
|
+
zoomReset: string;
|
|
342
|
+
zoomResetShort: string;
|
|
343
|
+
zoomNone: string;
|
|
344
|
+
zoomAllOne: string;
|
|
345
|
+
zoomAllMany: string;
|
|
346
|
+
zoomRange: string;
|
|
347
|
+
inProgress: string;
|
|
348
|
+
newContent: string;
|
|
349
|
+
updatedAt: string;
|
|
350
|
+
liveData: string;
|
|
351
|
+
viewData: string;
|
|
352
|
+
hideData: string;
|
|
353
|
+
inProgressLegend: string;
|
|
354
|
+
/** Overrides for the explanation panel copy. */
|
|
355
|
+
explanation?: Partial<AnalyticsExplanationCopy>;
|
|
356
|
+
governedResult: string;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/i18n.d.ts
|
|
5
360
|
/**
|
|
6
361
|
* Every user-visible chrome string in one place. The widget ships English
|
|
7
362
|
* defaults; a host localises by passing `labels` to `Centrinfo.init()` —
|
|
@@ -11,6 +366,12 @@ import * as preact0 from "preact";
|
|
|
11
366
|
* never produces.
|
|
12
367
|
*/
|
|
13
368
|
interface WidgetStrings {
|
|
369
|
+
/**
|
|
370
|
+
* Labels for analytics answers (KPI, chart, table, details, explanation).
|
|
371
|
+
* Any subset overrides the English defaults; `explanation` holds the
|
|
372
|
+
* explanation panel's wording.
|
|
373
|
+
*/
|
|
374
|
+
analytics?: Partial<ResultLabels>;
|
|
14
375
|
/** Optional full-page labels. Older integrations use the core labels as fallbacks. */
|
|
15
376
|
fullPageNewConversation?: string;
|
|
16
377
|
fullPageHistory?: string;
|
|
@@ -101,6 +462,7 @@ interface WidgetStrings {
|
|
|
101
462
|
/** Per-message 👍/👎 feedback. */
|
|
102
463
|
feedbackHelpful: string;
|
|
103
464
|
feedbackNotHelpful: string;
|
|
465
|
+
feedbackAnswerPrompt: string;
|
|
104
466
|
feedbackThanks: string;
|
|
105
467
|
/** End-of-chat CSAT prompt. */
|
|
106
468
|
csatPrompt: string;
|
|
@@ -116,6 +478,8 @@ interface WidgetStrings {
|
|
|
116
478
|
emptyReply: string;
|
|
117
479
|
errorGeneric: string;
|
|
118
480
|
errorRateLimit: string;
|
|
481
|
+
/** Shown in place of an analytics result that is not kept in local storage. */
|
|
482
|
+
resultExpired: string;
|
|
119
483
|
attaching: string;
|
|
120
484
|
attachTooLarge: string;
|
|
121
485
|
attachFailed: string;
|
|
@@ -296,6 +660,7 @@ interface AnalyticsVisualizationColumn {
|
|
|
296
660
|
dataType: 'text' | 'number' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime';
|
|
297
661
|
semanticRole: 'identifier' | 'dimension' | 'measure' | 'date' | 'geography' | 'boolean';
|
|
298
662
|
aggregation?: 'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max';
|
|
663
|
+
allowedAggregations?: Array<'none' | 'sum' | 'avg' | 'count' | 'count_distinct' | 'min' | 'max'>;
|
|
299
664
|
formatPattern?: string;
|
|
300
665
|
currencyCode?: string;
|
|
301
666
|
description?: string;
|
|
@@ -313,21 +678,101 @@ interface AnalyticsVisualizationRecommendation {
|
|
|
313
678
|
reason?: string;
|
|
314
679
|
confidence?: number;
|
|
315
680
|
}
|
|
681
|
+
type AnalyticsValueStatus = 'observed' | 'confirmed_zero' | 'empty_bucket' | 'unconfirmed_zero' | 'missing';
|
|
682
|
+
interface AnalyticsEvidencePeriod {
|
|
683
|
+
label: string;
|
|
684
|
+
start?: string;
|
|
685
|
+
end?: string;
|
|
686
|
+
timezone?: string;
|
|
687
|
+
}
|
|
688
|
+
interface AnalyticsExplanationEvidenceItem {
|
|
689
|
+
id: string;
|
|
690
|
+
text: string;
|
|
691
|
+
kind?: string;
|
|
692
|
+
metric?: string;
|
|
693
|
+
period?: AnalyticsEvidencePeriod;
|
|
694
|
+
filters?: string[];
|
|
695
|
+
value?: number;
|
|
696
|
+
valueStatus: AnalyticsValueStatus | string;
|
|
697
|
+
statusReason?: string;
|
|
698
|
+
source: {
|
|
699
|
+
kind: 'card' | 'supporting_query' | string;
|
|
700
|
+
insightId?: string;
|
|
701
|
+
queryRunId?: string;
|
|
702
|
+
liveboardTileId?: string;
|
|
703
|
+
};
|
|
704
|
+
checkedAt?: string;
|
|
705
|
+
}
|
|
706
|
+
interface AnalyticsExplanationPeriod {
|
|
707
|
+
evidenceId?: string;
|
|
708
|
+
label: string;
|
|
709
|
+
start?: string;
|
|
710
|
+
end?: string;
|
|
711
|
+
timezone?: string;
|
|
712
|
+
current?: boolean;
|
|
713
|
+
inProgress?: boolean;
|
|
714
|
+
value?: number;
|
|
715
|
+
valueText?: string;
|
|
716
|
+
valueStatus: AnalyticsValueStatus | string;
|
|
717
|
+
statusReason?: string;
|
|
718
|
+
source?: 'card' | 'supporting_query' | string;
|
|
719
|
+
}
|
|
720
|
+
interface AnalyticsExplanationMissing {
|
|
721
|
+
evidenceId?: string;
|
|
722
|
+
label: string;
|
|
723
|
+
period?: AnalyticsEvidencePeriod;
|
|
724
|
+
reason: string;
|
|
725
|
+
}
|
|
726
|
+
interface AnalyticsExplanationDataFreshness {
|
|
727
|
+
status: string;
|
|
728
|
+
dataAsOf?: string;
|
|
729
|
+
expectedThrough?: string;
|
|
730
|
+
lagDays?: number;
|
|
731
|
+
checkedAt?: string;
|
|
732
|
+
timezone?: string;
|
|
733
|
+
}
|
|
734
|
+
interface AnalyticsValueProvenance {
|
|
735
|
+
rowIndex: number;
|
|
736
|
+
field: string;
|
|
737
|
+
period?: string;
|
|
738
|
+
filled: 'empty_bucket' | string;
|
|
739
|
+
status: 'empty_bucket' | 'confirmed_zero' | 'unconfirmed_zero' | string;
|
|
740
|
+
reason?: string;
|
|
741
|
+
}
|
|
316
742
|
interface AnalyticsVisualizationExplanation {
|
|
743
|
+
/** Stable opaque id; used only for "Was this helpful?" feedback. */
|
|
744
|
+
explanationId?: string;
|
|
317
745
|
conversationalPreface?: string;
|
|
318
746
|
metricReference?: string;
|
|
319
747
|
headline: string;
|
|
320
748
|
summary: string;
|
|
321
749
|
evidence?: string[];
|
|
750
|
+
headlineEvidenceIds?: string[];
|
|
751
|
+
summaryEvidenceIds?: string[];
|
|
752
|
+
businessMeaningEvidenceIds?: string[];
|
|
753
|
+
evidenceStatements?: Array<{
|
|
754
|
+
text: string;
|
|
755
|
+
evidenceIds?: string[];
|
|
756
|
+
}>;
|
|
757
|
+
evidenceItems?: AnalyticsExplanationEvidenceItem[];
|
|
758
|
+
periods?: AnalyticsExplanationPeriod[];
|
|
759
|
+
missing?: AnalyticsExplanationMissing[];
|
|
760
|
+
timezone?: string;
|
|
761
|
+
checkedAt?: string;
|
|
762
|
+
currentPeriodInProgress?: boolean;
|
|
763
|
+
cached?: boolean;
|
|
764
|
+
dataFreshness?: AnalyticsExplanationDataFreshness;
|
|
322
765
|
businessMeaning?: string;
|
|
323
766
|
possibleDrivers?: Array<{
|
|
324
767
|
hypothesis: string;
|
|
325
768
|
howToCheck: string;
|
|
769
|
+
evidenceIds?: string[];
|
|
326
770
|
}>;
|
|
327
771
|
recommendations?: Array<{
|
|
328
772
|
action: string;
|
|
329
773
|
why: string;
|
|
330
774
|
successMetric?: string;
|
|
775
|
+
evidenceIds?: string[];
|
|
331
776
|
}>;
|
|
332
777
|
forecast?: {
|
|
333
778
|
text: string;
|
|
@@ -338,6 +783,12 @@ interface AnalyticsVisualizationExplanation {
|
|
|
338
783
|
limitations?: string[];
|
|
339
784
|
followUps?: string[];
|
|
340
785
|
source: 'governed_result' | 'ai_grounded' | 'rag_deterministic_analysis' | 'analysis_contract' | string;
|
|
786
|
+
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
787
|
+
aiExplanation?: {
|
|
788
|
+
status: string;
|
|
789
|
+
explanationId?: string;
|
|
790
|
+
retryAvailable?: boolean;
|
|
791
|
+
} | null;
|
|
341
792
|
}
|
|
342
793
|
interface AnalyticsVisualizationAnalysis {
|
|
343
794
|
summary: string;
|
|
@@ -467,6 +918,7 @@ interface AnalyticsVisualization {
|
|
|
467
918
|
tableAvailable?: boolean;
|
|
468
919
|
downloadAvailable?: boolean;
|
|
469
920
|
explanation?: AnalyticsVisualizationExplanation;
|
|
921
|
+
valueProvenance?: AnalyticsValueProvenance[];
|
|
470
922
|
}
|
|
471
923
|
interface SpeechResult {
|
|
472
924
|
providerReady: boolean;
|
|
@@ -587,6 +1039,31 @@ interface FeedbackInput {
|
|
|
587
1039
|
question?: string;
|
|
588
1040
|
answer?: string;
|
|
589
1041
|
}
|
|
1042
|
+
/** "Was this helpful?" vote on one analytics explanation
|
|
1043
|
+
* (POST /public-chat/explanation-feedback). One vote per visitor session per
|
|
1044
|
+
* explanation; `clear` removes it. Never billed. */
|
|
1045
|
+
interface ExplanationFeedbackInput {
|
|
1046
|
+
sessionId: string;
|
|
1047
|
+
explanationId: string;
|
|
1048
|
+
rating: 'up' | 'down' | 'clear';
|
|
1049
|
+
reasons?: Array<'wrong_numbers' | 'missing_comparison' | 'unclear' | 'too_long'>;
|
|
1050
|
+
comment?: string;
|
|
1051
|
+
modelId?: string;
|
|
1052
|
+
modelVersion?: number;
|
|
1053
|
+
/** Which public surface showed the explanation. */
|
|
1054
|
+
surface?: 'widget' | 'chat_app';
|
|
1055
|
+
}
|
|
1056
|
+
/** Detailed AI explanation job for an analytics answer
|
|
1057
|
+
* (GET /public-chat/analytics-explanations/:id). `explanation` is set only
|
|
1058
|
+
* when ready and is the checked, public-safe explanation. */
|
|
1059
|
+
interface ExplanationJob {
|
|
1060
|
+
status: 'pending' | 'ready' | 'failed' | 'not_requested' | string;
|
|
1061
|
+
explanationId?: string;
|
|
1062
|
+
retryAvailable?: boolean;
|
|
1063
|
+
explanation?: Record<string, unknown> | null;
|
|
1064
|
+
/** The free basic explanation as updated by the job (gains the baseline sentence). */
|
|
1065
|
+
basic?: Record<string, unknown> | null;
|
|
1066
|
+
}
|
|
590
1067
|
/** A [start, end) window the org's calendar is busy. */
|
|
591
1068
|
interface BusyRange {
|
|
592
1069
|
start: string;
|
|
@@ -664,6 +1141,13 @@ interface Transport {
|
|
|
664
1141
|
/** Record a 👍/👎 on an assistant reply (`POST /public-chat/feedback`).
|
|
665
1142
|
* Best-effort — a failed rating never disrupts the chat. */
|
|
666
1143
|
sendFeedback(input: FeedbackInput): Promise<void>;
|
|
1144
|
+
/** Record a vote on an analytics explanation. Rejects on failure so the UI
|
|
1145
|
+
* can offer a retry (unlike `sendFeedback`). Optional for custom transports. */
|
|
1146
|
+
sendExplanationFeedback?(input: ExplanationFeedbackInput): Promise<void>;
|
|
1147
|
+
/** Poll the detailed AI explanation of an analytics answer. Optional. */
|
|
1148
|
+
fetchExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app', signal?: AbortSignal): Promise<ExplanationJob>;
|
|
1149
|
+
/** "Try again" on a failed detailed AI explanation. Optional. */
|
|
1150
|
+
retryExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app'): Promise<ExplanationJob>;
|
|
667
1151
|
}
|
|
668
1152
|
//#endregion
|
|
669
1153
|
//#region src/types.d.ts
|
|
@@ -736,6 +1220,11 @@ interface WidgetConfig {
|
|
|
736
1220
|
labels?: Partial<WidgetStrings>;
|
|
737
1221
|
/** Locale used to select a translation bundle. Defaults to browser locale. */
|
|
738
1222
|
locale?: string;
|
|
1223
|
+
/**
|
|
1224
|
+
* Text direction. `auto` (default) follows the locale: Arabic, Hebrew,
|
|
1225
|
+
* Persian, Urdu and similar scripts render right-to-left.
|
|
1226
|
+
*/
|
|
1227
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
739
1228
|
/**
|
|
740
1229
|
* Translation data keyed by locale (`fr`, `fr-CA`, `yo`, ...). Exact locale
|
|
741
1230
|
* wins, then its base language. Explicit `labels` still wins over the pack.
|
|
@@ -835,6 +1324,14 @@ interface WidgetConfig {
|
|
|
835
1324
|
role: 'user' | 'assistant';
|
|
836
1325
|
content: string;
|
|
837
1326
|
}) => void;
|
|
1327
|
+
/** Called only for a server-cited source in a signed analytics answer.
|
|
1328
|
+
* The host should open it through its authorized analytics client. */
|
|
1329
|
+
onOpenAnalyticsSource?: (source: {
|
|
1330
|
+
kind: 'liveboard_tile' | 'insight';
|
|
1331
|
+
id: string;
|
|
1332
|
+
/** Result filters for a host to validate against the destination board. */
|
|
1333
|
+
appliedFilters?: AnalyticsVisualization['appliedFilters'];
|
|
1334
|
+
}) => void;
|
|
838
1335
|
onAction?: (action: string) => void;
|
|
839
1336
|
onHandoff?: () => void;
|
|
840
1337
|
}
|
|
@@ -998,6 +1495,10 @@ interface ChatMessage {
|
|
|
998
1495
|
feedback?: 'up' | 'down';
|
|
999
1496
|
visualization?: AnalyticsVisualization;
|
|
1000
1497
|
artifacts?: ChatArtifact[];
|
|
1498
|
+
/** Set on a restored message whose analytics result was not kept in local storage. */
|
|
1499
|
+
resultExpired?: {
|
|
1500
|
+
title?: string;
|
|
1501
|
+
};
|
|
1001
1502
|
}
|
|
1002
1503
|
interface Source {
|
|
1003
1504
|
title?: string;
|
|
@@ -1086,4 +1587,4 @@ interface SchedulerInfo {
|
|
|
1086
1587
|
};
|
|
1087
1588
|
}
|
|
1088
1589
|
//#endregion
|
|
1089
|
-
export {
|
|
1590
|
+
export { StringsProvider as C, AnalyticsExplanationInput as D, AnalyticsAIExplanationTransport as E, AnalyticsGroupComparisonPoint as O, Transport as S, ResultLabels 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, AnalyticsPeriodComparison 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 };
|