@accurix/centrinfo-widget 5.1.1 → 5.2.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 +83 -8
- package/dist/cdn/centrinfo-widget.js +80 -52
- package/dist/cdn/manifest.json +6 -6
- 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 +45 -8
- package/dist/runtime.d.mts +42 -5
- package/dist/runtime.mjs +2 -2
- package/dist/styles-BNPs-1he.mjs +3539 -0
- package/dist/styles-Bp-0ZpvF.cjs +3539 -0
- package/dist/{types-D0VIOagk.d.cts → types-CCk7I1fM.d.cts} +117 -16
- package/dist/{types-k3nQBQjf.d.mts → types-CmLbqY23.d.mts} +122 -19
- package/package.json +2 -2
- package/dist/styles-CvzR5bT8.cjs +0 -3516
- package/dist/styles-mW_qo6Ed.mjs +0 -3516
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import * as preact0 from "preact";
|
|
2
2
|
|
|
3
|
+
//#region ../centrinfo-results/src/answer.d.ts
|
|
4
|
+
interface CentrinfoAnswer<Visualization = unknown, Source$1 = unknown, Artifact = unknown, Presentation = unknown> {
|
|
5
|
+
version: number;
|
|
6
|
+
kind: string;
|
|
7
|
+
status: string;
|
|
8
|
+
text: string;
|
|
9
|
+
explanation?: Record<string, unknown>;
|
|
10
|
+
visualization?: Visualization;
|
|
11
|
+
sources?: Source$1[];
|
|
12
|
+
artifacts?: Artifact[];
|
|
13
|
+
presentation?: Presentation;
|
|
14
|
+
feedbackId?: string;
|
|
15
|
+
generatedAt?: string;
|
|
16
|
+
timezone?: string;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
3
19
|
//#region ../centrinfo-results/src/analytics-explanation.d.ts
|
|
4
|
-
|
|
5
20
|
/**
|
|
6
21
|
* Framework-agnostic analytics explanation core.
|
|
7
22
|
*
|
|
@@ -80,6 +95,8 @@ interface AnalyticsExplanationFreshnessInput {
|
|
|
80
95
|
}
|
|
81
96
|
/** Structural explanation shape every surface's DTO satisfies. */
|
|
82
97
|
interface AnalyticsExplanationInput {
|
|
98
|
+
/** Set only when the backend verified every requested fact. */
|
|
99
|
+
answerComplete?: boolean;
|
|
83
100
|
explanationId?: string;
|
|
84
101
|
conversationalPreface?: string;
|
|
85
102
|
headline?: string;
|
|
@@ -110,6 +127,7 @@ interface AnalyticsExplanationInput {
|
|
|
110
127
|
action: string;
|
|
111
128
|
why: string;
|
|
112
129
|
successMetric?: string;
|
|
130
|
+
segment?: string;
|
|
113
131
|
evidenceIds?: string[];
|
|
114
132
|
}>;
|
|
115
133
|
forecast?: {
|
|
@@ -125,24 +143,63 @@ interface AnalyticsExplanationInput {
|
|
|
125
143
|
level?: 'basic' | 'detailed' | string;
|
|
126
144
|
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
127
145
|
aiExplanation?: AnalyticsAIExplanationInput | null;
|
|
146
|
+
/** Ranked measured drivers (association, never proof of cause). */
|
|
147
|
+
drivers?: Array<{
|
|
148
|
+
text: string;
|
|
149
|
+
basis?: string;
|
|
150
|
+
evidenceIds?: string[];
|
|
151
|
+
}>;
|
|
152
|
+
/** Cited unusual values. */
|
|
153
|
+
anomalies?: Array<{
|
|
154
|
+
text: string;
|
|
155
|
+
evidenceIds?: string[];
|
|
156
|
+
}>;
|
|
157
|
+
/** General business guidance, NOT from the customer's data (label "guidance"). */
|
|
158
|
+
frameworks?: Array<{
|
|
159
|
+
name: string;
|
|
160
|
+
label?: string;
|
|
161
|
+
guidance: string;
|
|
162
|
+
fieldMapping?: Array<{
|
|
163
|
+
concept: string;
|
|
164
|
+
field?: string;
|
|
165
|
+
status: string;
|
|
166
|
+
}>;
|
|
167
|
+
evidenceIds?: string[];
|
|
168
|
+
}>;
|
|
169
|
+
/** Business concepts the answer needed that the data does not hold. */
|
|
170
|
+
dataGaps?: Array<{
|
|
171
|
+
concept: string;
|
|
172
|
+
text: string;
|
|
173
|
+
}>;
|
|
174
|
+
/** Governed facts the AI wording did not cover, added beside it. */
|
|
175
|
+
supplementaryFindings?: string[];
|
|
128
176
|
}
|
|
129
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* State of the detailed AI explanation, as returned by every surface. The
|
|
179
|
+
* backend may also send "governed" (the checked governed explanation is
|
|
180
|
+
* final); it is read as `not_requested` — not a failure.
|
|
181
|
+
*/
|
|
130
182
|
type AnalyticsAIExplanationStatus = 'pending' | 'ready' | 'failed' | 'not_requested';
|
|
131
183
|
interface AnalyticsAIExplanationInput {
|
|
132
184
|
status: AnalyticsAIExplanationStatus | string;
|
|
133
185
|
explanationId?: string;
|
|
134
186
|
retryAvailable?: boolean;
|
|
187
|
+
/** Pending only: when the backend job's budget ends (ISO time). */
|
|
188
|
+
deadlineAt?: string;
|
|
189
|
+
/** Pending only: seconds left in the job's budget at response time (clock-skew safe). */
|
|
190
|
+
waitSeconds?: number;
|
|
135
191
|
}
|
|
136
192
|
declare const ANALYTICS_EXPLANATION_COPY: {
|
|
137
193
|
readonly eyebrow: "Answer from your data";
|
|
138
194
|
readonly provenanceAI: "AI-assisted · evidence checked";
|
|
195
|
+
readonly provenanceCalculated: "Calculated results";
|
|
139
196
|
readonly provenanceGoverned: "Based on current values";
|
|
140
197
|
readonly comparison: "Comparison";
|
|
141
198
|
readonly conclusions: "What we can conclude";
|
|
142
199
|
readonly whyItMatters: "Why it matters";
|
|
143
200
|
readonly limits: "Important limits";
|
|
144
201
|
readonly investigate: "Investigate further";
|
|
145
|
-
readonly evidenceList: "
|
|
202
|
+
readonly evidenceList: "Supporting evidence";
|
|
146
203
|
readonly causes: "Possible causes";
|
|
147
204
|
readonly causesHint: "Not proven causes";
|
|
148
205
|
readonly howToCheck: "How to check:";
|
|
@@ -151,6 +208,7 @@ declare const ANALYTICS_EXPLANATION_COPY: {
|
|
|
151
208
|
readonly outlook: "Outlook";
|
|
152
209
|
readonly followUps: "Ask a follow-up";
|
|
153
210
|
readonly sourceNoteAI: "AI-assisted wording, checked against the live values shown here.";
|
|
211
|
+
readonly sourceNoteCalculated: "AI-assisted wording based on calculated results.";
|
|
154
212
|
readonly sourceNoteGoverned: "Based only on the live values shown here.";
|
|
155
213
|
readonly evidence: "Evidence";
|
|
156
214
|
readonly evidenceMetric: "Metric";
|
|
@@ -178,10 +236,20 @@ declare const ANALYTICS_EXPLANATION_COPY: {
|
|
|
178
236
|
readonly notComparable: "Not comparable yet";
|
|
179
237
|
readonly basicExplanation: "Basic explanation";
|
|
180
238
|
readonly preparingDetailed: "Preparing a detailed explanation…";
|
|
239
|
+
readonly stillWorkingDetailed: "Still working on the detailed explanation…";
|
|
181
240
|
readonly detailedReady: "Detailed explanation ready.";
|
|
182
241
|
readonly detailedUnavailable: "A detailed explanation is not available right now.";
|
|
183
242
|
readonly detailedRetry: "Try again";
|
|
184
243
|
readonly region: "Explanation";
|
|
244
|
+
readonly details: "What this means";
|
|
245
|
+
readonly drivers: "What is driving it";
|
|
246
|
+
readonly driversHint: "Measured association, not proof of cause";
|
|
247
|
+
readonly anomalies: "Unusual values";
|
|
248
|
+
readonly supplementaryFindings: "Also in the data";
|
|
249
|
+
readonly frameworks: "General guidance, not from your data";
|
|
250
|
+
readonly dataGaps: "Missing data";
|
|
251
|
+
readonly segment: "Segment:";
|
|
252
|
+
readonly tasks: "Tasks";
|
|
185
253
|
readonly inProgress: "in progress";
|
|
186
254
|
readonly expand: "Expand explanation";
|
|
187
255
|
readonly collapse: "Collapse explanation";
|
|
@@ -261,6 +329,9 @@ interface AnalyticsAIExplanationJob<E extends AnalyticsExplanationInput> {
|
|
|
261
329
|
status: AnalyticsAIExplanationStatus | string;
|
|
262
330
|
explanationId?: string;
|
|
263
331
|
retryAvailable?: boolean;
|
|
332
|
+
/** Pending only: the job's deadline (ISO) and seconds left (see AnalyticsAIExplanationInput). */
|
|
333
|
+
deadlineAt?: string;
|
|
334
|
+
waitSeconds?: number;
|
|
264
335
|
explanation?: E | null;
|
|
265
336
|
/**
|
|
266
337
|
* The free basic explanation as updated by the background job (it gains the
|
|
@@ -274,8 +345,8 @@ interface AnalyticsAIExplanationTransport<E extends AnalyticsExplanationInput> {
|
|
|
274
345
|
poll: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
275
346
|
/** "Try again": re-request with the retry flag. Omit when retry is impossible. */
|
|
276
347
|
retry?: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
277
|
-
/**
|
|
278
|
-
settled?: (explanationId: string, status: 'ready' | 'failed' | 'not_requested') => void;
|
|
348
|
+
/** Remember the checked explanation alongside its final status. */
|
|
349
|
+
settled?: (explanationId: string, status: 'ready' | 'failed' | 'not_requested', explanation?: E) => void;
|
|
279
350
|
}
|
|
280
351
|
//#endregion
|
|
281
352
|
//#region ../centrinfo-results/src/labels.d.ts
|
|
@@ -366,6 +437,10 @@ interface ResultLabels {
|
|
|
366
437
|
* never produces.
|
|
367
438
|
*/
|
|
368
439
|
interface WidgetStrings {
|
|
440
|
+
analyticsModelLabel: string;
|
|
441
|
+
analyticsModelAutomatic: string;
|
|
442
|
+
analyticsModelUnavailable: string;
|
|
443
|
+
testMode?: string;
|
|
369
444
|
/**
|
|
370
445
|
* Labels for analytics answers (KPI, chart, table, details, explanation).
|
|
371
446
|
* Any subset overrides the English defaults; `explanation` holds the
|
|
@@ -442,6 +517,8 @@ interface WidgetStrings {
|
|
|
442
517
|
stop: string;
|
|
443
518
|
copy: string;
|
|
444
519
|
copied: string;
|
|
520
|
+
doubleCheckResponse: string;
|
|
521
|
+
retryResponse: string;
|
|
445
522
|
retry: string;
|
|
446
523
|
clearChat: string;
|
|
447
524
|
clearChatConfirm: string;
|
|
@@ -629,6 +706,7 @@ interface LiveAudioSegment {
|
|
|
629
706
|
text?: string;
|
|
630
707
|
}
|
|
631
708
|
interface TurnResult {
|
|
709
|
+
answerResult?: CentrinfoAnswer<AnalyticsVisualization, Source, ChatArtifact>;
|
|
632
710
|
/** True when the reply was spoken in live pieces (onAudioSegment). */
|
|
633
711
|
liveAudio?: boolean;
|
|
634
712
|
answer: string;
|
|
@@ -741,6 +819,7 @@ interface AnalyticsValueProvenance {
|
|
|
741
819
|
reason?: string;
|
|
742
820
|
}
|
|
743
821
|
interface AnalyticsVisualizationExplanation {
|
|
822
|
+
answerComplete?: boolean;
|
|
744
823
|
/** Stable opaque id; used only for "Was this helpful?" feedback. */
|
|
745
824
|
explanationId?: string;
|
|
746
825
|
conversationalPreface?: string;
|
|
@@ -785,11 +864,7 @@ interface AnalyticsVisualizationExplanation {
|
|
|
785
864
|
followUps?: string[];
|
|
786
865
|
source: 'governed_result' | 'ai_grounded' | 'rag_deterministic_analysis' | 'analysis_contract' | string;
|
|
787
866
|
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
788
|
-
aiExplanation?:
|
|
789
|
-
status: string;
|
|
790
|
-
explanationId?: string;
|
|
791
|
-
retryAvailable?: boolean;
|
|
792
|
-
} | null;
|
|
867
|
+
aiExplanation?: AnalyticsAIExplanationInput | null;
|
|
793
868
|
}
|
|
794
869
|
interface AnalyticsVisualizationAnalysis {
|
|
795
870
|
summary: string;
|
|
@@ -947,6 +1022,10 @@ interface LiveEventsResult {
|
|
|
947
1022
|
events: LiveEvent[];
|
|
948
1023
|
}
|
|
949
1024
|
interface AuthenticatedHistoryMessage {
|
|
1025
|
+
answerResult?: CentrinfoAnswer<AnalyticsVisualization, {
|
|
1026
|
+
title?: string;
|
|
1027
|
+
url?: string;
|
|
1028
|
+
}, ChatArtifact>;
|
|
950
1029
|
id: string;
|
|
951
1030
|
role: 'user' | 'assistant' | 'system';
|
|
952
1031
|
content: string;
|
|
@@ -974,6 +1053,7 @@ interface AuthenticatedHistoryResult {
|
|
|
974
1053
|
conversations: AuthenticatedHistoryConversation[];
|
|
975
1054
|
}
|
|
976
1055
|
interface StreamCallbacks {
|
|
1056
|
+
analyticsModelId?: string;
|
|
977
1057
|
/** Called with each incremental text chunk. */
|
|
978
1058
|
onChunk: (text: string) => void;
|
|
979
1059
|
/** The answer text and metadata have arrived; optional reply audio may follow. */
|
|
@@ -1067,10 +1147,7 @@ interface ExplanationFeedbackInput {
|
|
|
1067
1147
|
/** Detailed AI explanation job for an analytics answer
|
|
1068
1148
|
* (GET /public-chat/analytics-explanations/:id). `explanation` is set only
|
|
1069
1149
|
* when ready and is the checked, public-safe explanation. */
|
|
1070
|
-
interface ExplanationJob {
|
|
1071
|
-
status: 'pending' | 'ready' | 'failed' | 'not_requested' | string;
|
|
1072
|
-
explanationId?: string;
|
|
1073
|
-
retryAvailable?: boolean;
|
|
1150
|
+
interface ExplanationJob extends AnalyticsAIExplanationInput {
|
|
1074
1151
|
explanation?: Record<string, unknown> | null;
|
|
1075
1152
|
/** The free basic explanation as updated by the job (gains the baseline sentence). */
|
|
1076
1153
|
basic?: Record<string, unknown> | null;
|
|
@@ -1106,9 +1183,11 @@ interface GifResult {
|
|
|
1106
1183
|
* backend (`ApiClient`) or the in-memory demo (`MockTransport`).
|
|
1107
1184
|
*/
|
|
1108
1185
|
interface Transport {
|
|
1186
|
+
analyticsModels?(): Promise<AnalyticsModelOption[]>;
|
|
1109
1187
|
bootstrap(): Promise<BootstrapInfo>;
|
|
1110
1188
|
/** Server-backed history for the verified SDK customer. Anonymous returns empty. */
|
|
1111
1189
|
history(): Promise<AuthenticatedHistoryResult>;
|
|
1190
|
+
updateHistory?(sessionId: string, action: 'rename' | 'delete', title?: string): Promise<void>;
|
|
1112
1191
|
/** Stream a turn; resolves with final metadata once `done`. */
|
|
1113
1192
|
stream(question: string, sessionId: string, cb: StreamCallbacks): Promise<TurnResult>;
|
|
1114
1193
|
/** Poll for staff/system events after a timestamp during live handoff. */
|
|
@@ -1160,6 +1239,10 @@ interface Transport {
|
|
|
1160
1239
|
/** "Try again" on a failed detailed AI explanation. Optional. */
|
|
1161
1240
|
retryExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app'): Promise<ExplanationJob>;
|
|
1162
1241
|
}
|
|
1242
|
+
interface AnalyticsModelOption {
|
|
1243
|
+
id: string;
|
|
1244
|
+
name: string;
|
|
1245
|
+
}
|
|
1163
1246
|
//#endregion
|
|
1164
1247
|
//#region src/types.d.ts
|
|
1165
1248
|
type ChatSurface = 'floating' | 'full-page';
|
|
@@ -1184,6 +1267,23 @@ interface WidgetTranslationBundle {
|
|
|
1184
1267
|
}
|
|
1185
1268
|
/** Public configuration surface passed to `Centrinfo.init()` / <CentrinfoWidget>. */
|
|
1186
1269
|
interface WidgetConfig {
|
|
1270
|
+
/** Simple brand settings shared by the floating widget and full-page chat. */
|
|
1271
|
+
branding?: {
|
|
1272
|
+
name?: string;
|
|
1273
|
+
logo?: string;
|
|
1274
|
+
color?: string;
|
|
1275
|
+
};
|
|
1276
|
+
/** Simple composer options. Hiding a control does not change backend permissions. */
|
|
1277
|
+
composer?: {
|
|
1278
|
+
placeholder?: string;
|
|
1279
|
+
attachments?: boolean;
|
|
1280
|
+
voice?: boolean;
|
|
1281
|
+
modelSelector?: boolean;
|
|
1282
|
+
};
|
|
1283
|
+
/** Show the permitted analytics data models in chat. Defaults to true. */
|
|
1284
|
+
showAnalyticsModelSelector?: boolean;
|
|
1285
|
+
/** Initial analytics data model; backend permissions are always enforced. */
|
|
1286
|
+
analyticsModelId?: string;
|
|
1187
1287
|
/** The org's public chat token (`pub_*`). Required. It IS the org identity. */
|
|
1188
1288
|
token: string;
|
|
1189
1289
|
/** Conversation namespace. Set by the SDK surface mounting the chat. */
|
|
@@ -1308,7 +1408,7 @@ interface WidgetConfig {
|
|
|
1308
1408
|
/**
|
|
1309
1409
|
* How often the open widget refreshes its public token configuration
|
|
1310
1410
|
* (branding, greeting, starter questions, allowed actions, pause/offline
|
|
1311
|
-
* state) from `/public-chat/bootstrap`. Default
|
|
1411
|
+
* state) from `/public-chat/bootstrap`. Default 300 seconds; set 0 to
|
|
1312
1412
|
* disable live config refresh for strict traffic budgets.
|
|
1313
1413
|
*/
|
|
1314
1414
|
configRefreshSeconds?: number;
|
|
@@ -1527,6 +1627,7 @@ interface Visitor {
|
|
|
1527
1627
|
}
|
|
1528
1628
|
/** Persona + capabilities returned by `GET /public-chat/bootstrap`. */
|
|
1529
1629
|
interface BootstrapInfo {
|
|
1630
|
+
testMode?: boolean;
|
|
1530
1631
|
agentName: string;
|
|
1531
1632
|
agentAvatarUrl?: string;
|
|
1532
1633
|
greeting: string;
|
|
@@ -1598,4 +1699,4 @@ interface SchedulerInfo {
|
|
|
1598
1699
|
};
|
|
1599
1700
|
}
|
|
1600
1701
|
//#endregion
|
|
1601
|
-
export {
|
|
1702
|
+
export { AnalyticsPeriodComparison as A, Transport as C, AnalyticsAIExplanationTransport as D, ResultLabels as E, AnalyticsExplanationInput as O, PublicChatActionField as S, WidgetStrings as T, DemoBooking as _, MessageAttachment as a, GifResult as b, Visitor as c, WidgetHandle as d, WidgetThemeTokens as f, AnalyticsVisualization as g, AnalyticsModelOption as h, FeaturedLink as i, AnalyticsGroupComparisonPoint 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, DemoSlotsResult as v, StringsProvider as w, PublicChatAction as x, ExplanationFeedbackInput as y };
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as preact2 from "preact";
|
|
2
2
|
import { JSX } from "preact";
|
|
3
3
|
|
|
4
|
+
//#region ../centrinfo-results/src/answer.d.ts
|
|
5
|
+
interface CentrinfoAnswer<Visualization = unknown, Source$1 = unknown, Artifact = unknown, Presentation = unknown> {
|
|
6
|
+
version: number;
|
|
7
|
+
kind: string;
|
|
8
|
+
status: string;
|
|
9
|
+
text: string;
|
|
10
|
+
explanation?: Record<string, unknown>;
|
|
11
|
+
visualization?: Visualization;
|
|
12
|
+
sources?: Source$1[];
|
|
13
|
+
artifacts?: Artifact[];
|
|
14
|
+
presentation?: Presentation;
|
|
15
|
+
feedbackId?: string;
|
|
16
|
+
generatedAt?: string;
|
|
17
|
+
timezone?: string;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
4
20
|
//#region ../centrinfo-results/src/analytics-chart-catalog.d.ts
|
|
5
21
|
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
22
|
//#endregion
|
|
@@ -83,6 +99,8 @@ interface AnalyticsExplanationFreshnessInput {
|
|
|
83
99
|
}
|
|
84
100
|
/** Structural explanation shape every surface's DTO satisfies. */
|
|
85
101
|
interface AnalyticsExplanationInput {
|
|
102
|
+
/** Set only when the backend verified every requested fact. */
|
|
103
|
+
answerComplete?: boolean;
|
|
86
104
|
explanationId?: string;
|
|
87
105
|
conversationalPreface?: string;
|
|
88
106
|
headline?: string;
|
|
@@ -113,6 +131,7 @@ interface AnalyticsExplanationInput {
|
|
|
113
131
|
action: string;
|
|
114
132
|
why: string;
|
|
115
133
|
successMetric?: string;
|
|
134
|
+
segment?: string;
|
|
116
135
|
evidenceIds?: string[];
|
|
117
136
|
}>;
|
|
118
137
|
forecast?: {
|
|
@@ -128,24 +147,63 @@ interface AnalyticsExplanationInput {
|
|
|
128
147
|
level?: 'basic' | 'detailed' | string;
|
|
129
148
|
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
130
149
|
aiExplanation?: AnalyticsAIExplanationInput | null;
|
|
150
|
+
/** Ranked measured drivers (association, never proof of cause). */
|
|
151
|
+
drivers?: Array<{
|
|
152
|
+
text: string;
|
|
153
|
+
basis?: string;
|
|
154
|
+
evidenceIds?: string[];
|
|
155
|
+
}>;
|
|
156
|
+
/** Cited unusual values. */
|
|
157
|
+
anomalies?: Array<{
|
|
158
|
+
text: string;
|
|
159
|
+
evidenceIds?: string[];
|
|
160
|
+
}>;
|
|
161
|
+
/** General business guidance, NOT from the customer's data (label "guidance"). */
|
|
162
|
+
frameworks?: Array<{
|
|
163
|
+
name: string;
|
|
164
|
+
label?: string;
|
|
165
|
+
guidance: string;
|
|
166
|
+
fieldMapping?: Array<{
|
|
167
|
+
concept: string;
|
|
168
|
+
field?: string;
|
|
169
|
+
status: string;
|
|
170
|
+
}>;
|
|
171
|
+
evidenceIds?: string[];
|
|
172
|
+
}>;
|
|
173
|
+
/** Business concepts the answer needed that the data does not hold. */
|
|
174
|
+
dataGaps?: Array<{
|
|
175
|
+
concept: string;
|
|
176
|
+
text: string;
|
|
177
|
+
}>;
|
|
178
|
+
/** Governed facts the AI wording did not cover, added beside it. */
|
|
179
|
+
supplementaryFindings?: string[];
|
|
131
180
|
}
|
|
132
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* State of the detailed AI explanation, as returned by every surface. The
|
|
183
|
+
* backend may also send "governed" (the checked governed explanation is
|
|
184
|
+
* final); it is read as `not_requested` — not a failure.
|
|
185
|
+
*/
|
|
133
186
|
type AnalyticsAIExplanationStatus = 'pending' | 'ready' | 'failed' | 'not_requested';
|
|
134
187
|
interface AnalyticsAIExplanationInput {
|
|
135
188
|
status: AnalyticsAIExplanationStatus | string;
|
|
136
189
|
explanationId?: string;
|
|
137
190
|
retryAvailable?: boolean;
|
|
191
|
+
/** Pending only: when the backend job's budget ends (ISO time). */
|
|
192
|
+
deadlineAt?: string;
|
|
193
|
+
/** Pending only: seconds left in the job's budget at response time (clock-skew safe). */
|
|
194
|
+
waitSeconds?: number;
|
|
138
195
|
}
|
|
139
196
|
declare const ANALYTICS_EXPLANATION_COPY: {
|
|
140
197
|
readonly eyebrow: "Answer from your data";
|
|
141
198
|
readonly provenanceAI: "AI-assisted · evidence checked";
|
|
199
|
+
readonly provenanceCalculated: "Calculated results";
|
|
142
200
|
readonly provenanceGoverned: "Based on current values";
|
|
143
201
|
readonly comparison: "Comparison";
|
|
144
202
|
readonly conclusions: "What we can conclude";
|
|
145
203
|
readonly whyItMatters: "Why it matters";
|
|
146
204
|
readonly limits: "Important limits";
|
|
147
205
|
readonly investigate: "Investigate further";
|
|
148
|
-
readonly evidenceList: "
|
|
206
|
+
readonly evidenceList: "Supporting evidence";
|
|
149
207
|
readonly causes: "Possible causes";
|
|
150
208
|
readonly causesHint: "Not proven causes";
|
|
151
209
|
readonly howToCheck: "How to check:";
|
|
@@ -154,6 +212,7 @@ declare const ANALYTICS_EXPLANATION_COPY: {
|
|
|
154
212
|
readonly outlook: "Outlook";
|
|
155
213
|
readonly followUps: "Ask a follow-up";
|
|
156
214
|
readonly sourceNoteAI: "AI-assisted wording, checked against the live values shown here.";
|
|
215
|
+
readonly sourceNoteCalculated: "AI-assisted wording based on calculated results.";
|
|
157
216
|
readonly sourceNoteGoverned: "Based only on the live values shown here.";
|
|
158
217
|
readonly evidence: "Evidence";
|
|
159
218
|
readonly evidenceMetric: "Metric";
|
|
@@ -181,10 +240,20 @@ declare const ANALYTICS_EXPLANATION_COPY: {
|
|
|
181
240
|
readonly notComparable: "Not comparable yet";
|
|
182
241
|
readonly basicExplanation: "Basic explanation";
|
|
183
242
|
readonly preparingDetailed: "Preparing a detailed explanation…";
|
|
243
|
+
readonly stillWorkingDetailed: "Still working on the detailed explanation…";
|
|
184
244
|
readonly detailedReady: "Detailed explanation ready.";
|
|
185
245
|
readonly detailedUnavailable: "A detailed explanation is not available right now.";
|
|
186
246
|
readonly detailedRetry: "Try again";
|
|
187
247
|
readonly region: "Explanation";
|
|
248
|
+
readonly details: "What this means";
|
|
249
|
+
readonly drivers: "What is driving it";
|
|
250
|
+
readonly driversHint: "Measured association, not proof of cause";
|
|
251
|
+
readonly anomalies: "Unusual values";
|
|
252
|
+
readonly supplementaryFindings: "Also in the data";
|
|
253
|
+
readonly frameworks: "General guidance, not from your data";
|
|
254
|
+
readonly dataGaps: "Missing data";
|
|
255
|
+
readonly segment: "Segment:";
|
|
256
|
+
readonly tasks: "Tasks";
|
|
188
257
|
readonly inProgress: "in progress";
|
|
189
258
|
readonly expand: "Expand explanation";
|
|
190
259
|
readonly collapse: "Collapse explanation";
|
|
@@ -264,6 +333,9 @@ interface AnalyticsAIExplanationJob<E extends AnalyticsExplanationInput> {
|
|
|
264
333
|
status: AnalyticsAIExplanationStatus | string;
|
|
265
334
|
explanationId?: string;
|
|
266
335
|
retryAvailable?: boolean;
|
|
336
|
+
/** Pending only: the job's deadline (ISO) and seconds left (see AnalyticsAIExplanationInput). */
|
|
337
|
+
deadlineAt?: string;
|
|
338
|
+
waitSeconds?: number;
|
|
267
339
|
explanation?: E | null;
|
|
268
340
|
/**
|
|
269
341
|
* The free basic explanation as updated by the background job (it gains the
|
|
@@ -277,8 +349,8 @@ interface AnalyticsAIExplanationTransport<E extends AnalyticsExplanationInput> {
|
|
|
277
349
|
poll: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
278
350
|
/** "Try again": re-request with the retry flag. Omit when retry is impossible. */
|
|
279
351
|
retry?: (explanationId: string, signal?: AbortSignal) => Promise<AnalyticsAIExplanationJob<E>>;
|
|
280
|
-
/**
|
|
281
|
-
settled?: (explanationId: string, status: 'ready' | 'failed' | 'not_requested') => void;
|
|
352
|
+
/** Remember the checked explanation alongside its final status. */
|
|
353
|
+
settled?: (explanationId: string, status: 'ready' | 'failed' | 'not_requested', explanation?: E) => void;
|
|
282
354
|
}
|
|
283
355
|
//#endregion
|
|
284
356
|
//#region ../centrinfo-results/src/labels.d.ts
|
|
@@ -479,6 +551,7 @@ interface ResultColumn {
|
|
|
479
551
|
currencyCode?: string;
|
|
480
552
|
formatPattern?: string;
|
|
481
553
|
grain?: ResultGrain;
|
|
554
|
+
semanticRole?: AnalyticsVisualizationColumn$1['semanticRole'];
|
|
482
555
|
}
|
|
483
556
|
interface ResultTableClassNames {
|
|
484
557
|
wrap?: string;
|
|
@@ -529,7 +602,7 @@ declare const WidgetAnalyticsChart: ({
|
|
|
529
602
|
expanded?: boolean;
|
|
530
603
|
/** Class prefix of the surface (`cf` widget, `ca` chat app). */
|
|
531
604
|
classPrefix?: string;
|
|
532
|
-
}) =>
|
|
605
|
+
}) => preact2.JSX.Element;
|
|
533
606
|
//#endregion
|
|
534
607
|
//#region ../centrinfo-results/src/result.d.ts
|
|
535
608
|
declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn, context?: ResultFormatContext) => string;
|
|
@@ -556,7 +629,7 @@ declare const ResultTable: ({
|
|
|
556
629
|
expanded,
|
|
557
630
|
classNames,
|
|
558
631
|
emptyLabel
|
|
559
|
-
}: ResultTableProps) =>
|
|
632
|
+
}: ResultTableProps) => preact2.JSX.Element;
|
|
560
633
|
//#endregion
|
|
561
634
|
//#region ../centrinfo-results/src/result-details.d.ts
|
|
562
635
|
interface AnalyticsResultDetail {
|
|
@@ -574,6 +647,10 @@ interface AnalyticsResultDetail {
|
|
|
574
647
|
* never produces.
|
|
575
648
|
*/
|
|
576
649
|
interface WidgetStrings {
|
|
650
|
+
analyticsModelLabel: string;
|
|
651
|
+
analyticsModelAutomatic: string;
|
|
652
|
+
analyticsModelUnavailable: string;
|
|
653
|
+
testMode?: string;
|
|
577
654
|
/**
|
|
578
655
|
* Labels for analytics answers (KPI, chart, table, details, explanation).
|
|
579
656
|
* Any subset overrides the English defaults; `explanation` holds the
|
|
@@ -650,6 +727,8 @@ interface WidgetStrings {
|
|
|
650
727
|
stop: string;
|
|
651
728
|
copy: string;
|
|
652
729
|
copied: string;
|
|
730
|
+
doubleCheckResponse: string;
|
|
731
|
+
retryResponse: string;
|
|
653
732
|
retry: string;
|
|
654
733
|
clearChat: string;
|
|
655
734
|
clearChatConfirm: string;
|
|
@@ -779,7 +858,7 @@ interface WidgetStrings {
|
|
|
779
858
|
previewActionNote: string;
|
|
780
859
|
previewBanner: string;
|
|
781
860
|
}
|
|
782
|
-
declare const StringsProvider:
|
|
861
|
+
declare const StringsProvider: preact2.Provider<WidgetStrings>;
|
|
783
862
|
//#endregion
|
|
784
863
|
//#region src/api/types.d.ts
|
|
785
864
|
/** The result metadata that arrives with (or after) an answer. */
|
|
@@ -837,6 +916,7 @@ interface LiveAudioSegment {
|
|
|
837
916
|
text?: string;
|
|
838
917
|
}
|
|
839
918
|
interface TurnResult {
|
|
919
|
+
answerResult?: CentrinfoAnswer<AnalyticsVisualization, Source, ChatArtifact>;
|
|
840
920
|
/** True when the reply was spoken in live pieces (onAudioSegment). */
|
|
841
921
|
liveAudio?: boolean;
|
|
842
922
|
answer: string;
|
|
@@ -949,6 +1029,7 @@ interface AnalyticsValueProvenance {
|
|
|
949
1029
|
reason?: string;
|
|
950
1030
|
}
|
|
951
1031
|
interface AnalyticsVisualizationExplanation {
|
|
1032
|
+
answerComplete?: boolean;
|
|
952
1033
|
/** Stable opaque id; used only for "Was this helpful?" feedback. */
|
|
953
1034
|
explanationId?: string;
|
|
954
1035
|
conversationalPreface?: string;
|
|
@@ -993,11 +1074,7 @@ interface AnalyticsVisualizationExplanation {
|
|
|
993
1074
|
followUps?: string[];
|
|
994
1075
|
source: 'governed_result' | 'ai_grounded' | 'rag_deterministic_analysis' | 'analysis_contract' | string;
|
|
995
1076
|
/** The detailed AI explanation that loads separately (poll by explanationId). */
|
|
996
|
-
aiExplanation?:
|
|
997
|
-
status: string;
|
|
998
|
-
explanationId?: string;
|
|
999
|
-
retryAvailable?: boolean;
|
|
1000
|
-
} | null;
|
|
1077
|
+
aiExplanation?: AnalyticsAIExplanationInput | null;
|
|
1001
1078
|
}
|
|
1002
1079
|
interface AnalyticsVisualizationAnalysis {
|
|
1003
1080
|
summary: string;
|
|
@@ -1155,6 +1232,10 @@ interface LiveEventsResult {
|
|
|
1155
1232
|
events: LiveEvent[];
|
|
1156
1233
|
}
|
|
1157
1234
|
interface AuthenticatedHistoryMessage {
|
|
1235
|
+
answerResult?: CentrinfoAnswer<AnalyticsVisualization, {
|
|
1236
|
+
title?: string;
|
|
1237
|
+
url?: string;
|
|
1238
|
+
}, ChatArtifact>;
|
|
1158
1239
|
id: string;
|
|
1159
1240
|
role: 'user' | 'assistant' | 'system';
|
|
1160
1241
|
content: string;
|
|
@@ -1182,6 +1263,7 @@ interface AuthenticatedHistoryResult {
|
|
|
1182
1263
|
conversations: AuthenticatedHistoryConversation[];
|
|
1183
1264
|
}
|
|
1184
1265
|
interface StreamCallbacks {
|
|
1266
|
+
analyticsModelId?: string;
|
|
1185
1267
|
/** Called with each incremental text chunk. */
|
|
1186
1268
|
onChunk: (text: string) => void;
|
|
1187
1269
|
/** The answer text and metadata have arrived; optional reply audio may follow. */
|
|
@@ -1275,10 +1357,7 @@ interface ExplanationFeedbackInput {
|
|
|
1275
1357
|
/** Detailed AI explanation job for an analytics answer
|
|
1276
1358
|
* (GET /public-chat/analytics-explanations/:id). `explanation` is set only
|
|
1277
1359
|
* 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;
|
|
1360
|
+
interface ExplanationJob extends AnalyticsAIExplanationInput {
|
|
1282
1361
|
explanation?: Record<string, unknown> | null;
|
|
1283
1362
|
/** The free basic explanation as updated by the job (gains the baseline sentence). */
|
|
1284
1363
|
basic?: Record<string, unknown> | null;
|
|
@@ -1314,9 +1393,11 @@ interface GifResult {
|
|
|
1314
1393
|
* backend (`ApiClient`) or the in-memory demo (`MockTransport`).
|
|
1315
1394
|
*/
|
|
1316
1395
|
interface Transport {
|
|
1396
|
+
analyticsModels?(): Promise<AnalyticsModelOption[]>;
|
|
1317
1397
|
bootstrap(): Promise<BootstrapInfo>;
|
|
1318
1398
|
/** Server-backed history for the verified SDK customer. Anonymous returns empty. */
|
|
1319
1399
|
history(): Promise<AuthenticatedHistoryResult>;
|
|
1400
|
+
updateHistory?(sessionId: string, action: 'rename' | 'delete', title?: string): Promise<void>;
|
|
1320
1401
|
/** Stream a turn; resolves with final metadata once `done`. */
|
|
1321
1402
|
stream(question: string, sessionId: string, cb: StreamCallbacks): Promise<TurnResult>;
|
|
1322
1403
|
/** Poll for staff/system events after a timestamp during live handoff. */
|
|
@@ -1368,6 +1449,10 @@ interface Transport {
|
|
|
1368
1449
|
/** "Try again" on a failed detailed AI explanation. Optional. */
|
|
1369
1450
|
retryExplanation?(explanationId: string, sessionId: string, surface?: 'widget' | 'chat_app'): Promise<ExplanationJob>;
|
|
1370
1451
|
}
|
|
1452
|
+
interface AnalyticsModelOption {
|
|
1453
|
+
id: string;
|
|
1454
|
+
name: string;
|
|
1455
|
+
}
|
|
1371
1456
|
//#endregion
|
|
1372
1457
|
//#region src/types.d.ts
|
|
1373
1458
|
type ChatSurface = 'floating' | 'full-page';
|
|
@@ -1392,6 +1477,23 @@ interface WidgetTranslationBundle {
|
|
|
1392
1477
|
}
|
|
1393
1478
|
/** Public configuration surface passed to `Centrinfo.init()` / <CentrinfoWidget>. */
|
|
1394
1479
|
interface WidgetConfig {
|
|
1480
|
+
/** Simple brand settings shared by the floating widget and full-page chat. */
|
|
1481
|
+
branding?: {
|
|
1482
|
+
name?: string;
|
|
1483
|
+
logo?: string;
|
|
1484
|
+
color?: string;
|
|
1485
|
+
};
|
|
1486
|
+
/** Simple composer options. Hiding a control does not change backend permissions. */
|
|
1487
|
+
composer?: {
|
|
1488
|
+
placeholder?: string;
|
|
1489
|
+
attachments?: boolean;
|
|
1490
|
+
voice?: boolean;
|
|
1491
|
+
modelSelector?: boolean;
|
|
1492
|
+
};
|
|
1493
|
+
/** Show the permitted analytics data models in chat. Defaults to true. */
|
|
1494
|
+
showAnalyticsModelSelector?: boolean;
|
|
1495
|
+
/** Initial analytics data model; backend permissions are always enforced. */
|
|
1496
|
+
analyticsModelId?: string;
|
|
1395
1497
|
/** The org's public chat token (`pub_*`). Required. It IS the org identity. */
|
|
1396
1498
|
token: string;
|
|
1397
1499
|
/** Conversation namespace. Set by the SDK surface mounting the chat. */
|
|
@@ -1516,7 +1618,7 @@ interface WidgetConfig {
|
|
|
1516
1618
|
/**
|
|
1517
1619
|
* How often the open widget refreshes its public token configuration
|
|
1518
1620
|
* (branding, greeting, starter questions, allowed actions, pause/offline
|
|
1519
|
-
* state) from `/public-chat/bootstrap`. Default
|
|
1621
|
+
* state) from `/public-chat/bootstrap`. Default 300 seconds; set 0 to
|
|
1520
1622
|
* disable live config refresh for strict traffic budgets.
|
|
1521
1623
|
*/
|
|
1522
1624
|
configRefreshSeconds?: number;
|
|
@@ -1735,6 +1837,7 @@ interface Visitor {
|
|
|
1735
1837
|
}
|
|
1736
1838
|
/** Persona + capabilities returned by `GET /public-chat/bootstrap`. */
|
|
1737
1839
|
interface BootstrapInfo {
|
|
1840
|
+
testMode?: boolean;
|
|
1738
1841
|
agentName: string;
|
|
1739
1842
|
agentAvatarUrl?: string;
|
|
1740
1843
|
greeting: string;
|
|
@@ -1806,4 +1909,4 @@ interface SchedulerInfo {
|
|
|
1806
1909
|
};
|
|
1807
1910
|
}
|
|
1808
1911
|
//#endregion
|
|
1809
|
-
export {
|
|
1912
|
+
export { WidgetAnalyticsChart as A, Transport as C, ResultTable as D, AnalyticsResultDetail as E, ResultLabels as M, AnalyticsAIExplanationTransport as N, formatResultCell as O, AnalyticsExplanationInput as P, PublicChatActionField as S, WidgetStrings as T, DemoBooking as _, MessageAttachment as a, GifResult as b, Visitor as c, WidgetHandle as d, WidgetThemeTokens as f, AnalyticsVisualization as g, AnalyticsModelOption as h, FeaturedLink as i, buildWidgetAnalyticsChartModel as j, serializeResultCsv 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, DemoSlotsResult as v, StringsProvider as w, PublicChatAction as x, ExplanationFeedbackInput as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accurix/centrinfo-widget",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"preact": "^10.27.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@playwright/test": "^1.
|
|
47
|
+
"@playwright/test": "^1.61.0",
|
|
48
48
|
"@types/node": "^22.0.0",
|
|
49
49
|
"@vitest/coverage-v8": "^3.2.0",
|
|
50
50
|
"eslint": "^9.27.0",
|