@accurix/centrinfo-widget 1.0.1 → 2.0.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 +53 -3
- package/dist/cdn/centrinfo-widget.js +552 -85
- package/dist/cdn/manifest.json +6 -6
- package/dist/config-CkU4urQY.mjs +30 -0
- package/dist/config-DsNMbdKp.cjs +36 -0
- package/dist/index.cjs +531 -65
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +531 -65
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.cts +43 -10
- package/dist/runtime.d.mts +43 -10
- package/dist/runtime.mjs +1 -1
- package/dist/{types-DQWp12Cg.d.mts → types-1ZJJY7Da.d.mts} +337 -11
- package/dist/{types-rfkc-TtX.d.cts → types-B0r4SXaT.d.cts} +337 -11
- package/package.json +5 -4
- package/dist/config-CCkOySUT.mjs +0 -29
- package/dist/config-CzrfVSPp.cjs +0 -35
|
@@ -11,14 +11,59 @@ import "preact";
|
|
|
11
11
|
* never produces.
|
|
12
12
|
*/
|
|
13
13
|
interface WidgetStrings {
|
|
14
|
+
/** Optional full-page labels. Older integrations use the core labels as fallbacks. */
|
|
15
|
+
fullPageNewConversation?: string;
|
|
16
|
+
fullPageHistory?: string;
|
|
17
|
+
fullPageShare?: string;
|
|
18
|
+
fullPageExport?: string;
|
|
19
|
+
fullPageSupportQueued?: string;
|
|
20
|
+
fullPageSources?: string;
|
|
21
|
+
fullPageActions?: string;
|
|
22
|
+
fullPageDownloadTranscript?: string;
|
|
23
|
+
fullPageLiveAgent?: string;
|
|
24
|
+
fullPageAttachmentTooLarge?: string;
|
|
25
|
+
fullPageAttachmentUnsupported?: string;
|
|
26
|
+
fullPageAttachmentFailed?: string;
|
|
14
27
|
openChat: string;
|
|
15
28
|
closeChat: string;
|
|
29
|
+
closeHistory: string;
|
|
30
|
+
unreadMessage: string;
|
|
31
|
+
unreadMessages: string;
|
|
16
32
|
muteSounds: string;
|
|
17
33
|
unmuteSounds: string;
|
|
18
34
|
/** Header presence line when the org is reachable. */
|
|
19
35
|
statusOnline: string;
|
|
20
36
|
/** Header presence line when bootstrap was loaded with `offline`. */
|
|
21
37
|
statusOffline: string;
|
|
38
|
+
liveSupport: string;
|
|
39
|
+
waitingForTeam: string;
|
|
40
|
+
assistantName: string;
|
|
41
|
+
chatName: string;
|
|
42
|
+
welcomeLabel: string;
|
|
43
|
+
welcomeEyebrow: string;
|
|
44
|
+
welcomePrompt: string;
|
|
45
|
+
agentTyping: string;
|
|
46
|
+
expandedAnalyticsResult: string;
|
|
47
|
+
privacyAndData: string;
|
|
48
|
+
muteMicrophone: string;
|
|
49
|
+
unmuteMicrophone: string;
|
|
50
|
+
chooseMicrophone: string;
|
|
51
|
+
defaultMicrophone: string;
|
|
52
|
+
microphone: string;
|
|
53
|
+
talkNow: string;
|
|
54
|
+
expandView: string;
|
|
55
|
+
exitExpandedView: string;
|
|
56
|
+
minimizeVoiceChat: string;
|
|
57
|
+
endVoiceChat: string;
|
|
58
|
+
restoreVoiceChat: string;
|
|
59
|
+
reopenVoiceChat: string;
|
|
60
|
+
voiceConnecting: string;
|
|
61
|
+
voiceListening: string;
|
|
62
|
+
voiceProcessing: string;
|
|
63
|
+
voiceSpeaking: string;
|
|
64
|
+
voiceNoise: string;
|
|
65
|
+
voiceMisunderstood: string;
|
|
66
|
+
voiceDenied: string;
|
|
22
67
|
composerPlaceholder: string;
|
|
23
68
|
send: string;
|
|
24
69
|
emoji: string;
|
|
@@ -26,6 +71,7 @@ interface WidgetStrings {
|
|
|
26
71
|
attachFile: string;
|
|
27
72
|
recordVoice: string;
|
|
28
73
|
stopRecording: string;
|
|
74
|
+
actionTestMode: string;
|
|
29
75
|
stop: string;
|
|
30
76
|
copy: string;
|
|
31
77
|
copied: string;
|
|
@@ -67,6 +113,11 @@ interface WidgetStrings {
|
|
|
67
113
|
attaching: string;
|
|
68
114
|
attachTooLarge: string;
|
|
69
115
|
attachFailed: string;
|
|
116
|
+
removeAttachment: string;
|
|
117
|
+
dropFileHere: string;
|
|
118
|
+
clearDeviceData: string;
|
|
119
|
+
clearDeviceDataBody: string;
|
|
120
|
+
clearDeviceDataCta: string;
|
|
70
121
|
/** Handoff card (manual follow-up request). */
|
|
71
122
|
handoffTitle: string;
|
|
72
123
|
handoffName: string;
|
|
@@ -78,9 +129,32 @@ interface WidgetStrings {
|
|
|
78
129
|
/** Generic action-form success fallback + error. */
|
|
79
130
|
formThanks: string;
|
|
80
131
|
formError: string;
|
|
132
|
+
/** Public action drawer chrome. Action-specific copy remains descriptor data. */
|
|
133
|
+
actionContactOptions: string;
|
|
134
|
+
actionGetInTouch: string;
|
|
135
|
+
actionMore: string;
|
|
136
|
+
actionNeedHelp: string;
|
|
137
|
+
actionChoose: string;
|
|
138
|
+
actionFooter: string;
|
|
139
|
+
actionCategorySupport: string;
|
|
140
|
+
actionCategorySales: string;
|
|
141
|
+
actionCategoryMarketing: string;
|
|
142
|
+
actionClose: string;
|
|
143
|
+
actionAs: string;
|
|
81
144
|
/** Demo-booking picker. */
|
|
82
145
|
bookingPickTime: string;
|
|
146
|
+
bookingPickDay: string;
|
|
147
|
+
bookingPickTimeLabel: string;
|
|
83
148
|
bookingDuration: string;
|
|
149
|
+
bookingTimezone: string;
|
|
150
|
+
bookingSchedulerFallback: string;
|
|
151
|
+
bookingCheckingAvailability: string;
|
|
152
|
+
bookingNoSlots: string;
|
|
153
|
+
bookingAvailabilityUnavailable: string;
|
|
154
|
+
bookingEarlierToday: string;
|
|
155
|
+
bookingCalendarBusy: string;
|
|
156
|
+
bookingAlreadyBooked: string;
|
|
157
|
+
bookingNotOffered: string;
|
|
84
158
|
/** Confirmation after requesting a demo. `{when}` = the chosen slot. */
|
|
85
159
|
bookingRequested: string;
|
|
86
160
|
/** Confirmation when a real calendar event was created. `{when}` = slot. */
|
|
@@ -101,11 +175,58 @@ interface WidgetStrings {
|
|
|
101
175
|
//#endregion
|
|
102
176
|
//#region src/api/types.d.ts
|
|
103
177
|
/** The result metadata that arrives with (or after) an answer. */
|
|
178
|
+
/**
|
|
179
|
+
* One visitor action, described entirely by the backend.
|
|
180
|
+
*
|
|
181
|
+
* Production actions arrive from the backend. A visibly marked test-mode shim
|
|
182
|
+
* remains only for installations running an older backend response contract.
|
|
183
|
+
*
|
|
184
|
+
* `id` is the stable identifier (e.g. `public_book_demo`); it is never shown
|
|
185
|
+
* to a visitor. Everything a visitor reads is display text the backend may
|
|
186
|
+
* translate.
|
|
187
|
+
*/
|
|
188
|
+
interface PublicChatActionField {
|
|
189
|
+
key: string;
|
|
190
|
+
label: string;
|
|
191
|
+
kind: 'text' | 'email' | 'tel' | 'textarea';
|
|
192
|
+
required?: boolean;
|
|
193
|
+
identity?: 'name' | 'email' | 'phone';
|
|
194
|
+
placeholder?: string;
|
|
195
|
+
}
|
|
196
|
+
type PublicChatActionReadiness = 'available' | 'degraded' | 'unavailable';
|
|
197
|
+
interface PublicChatAction {
|
|
198
|
+
id: string;
|
|
199
|
+
/** POST /public-chat/<endpoint> */
|
|
200
|
+
endpoint: string;
|
|
201
|
+
/** Generic renderer selected by the backend contract. Defaults to form. */
|
|
202
|
+
presentation?: 'form' | 'booking';
|
|
203
|
+
label: string;
|
|
204
|
+
description: string;
|
|
205
|
+
category: 'support' | 'sales' | 'marketing';
|
|
206
|
+
icon: string;
|
|
207
|
+
formTitle: string;
|
|
208
|
+
submitLabel: string;
|
|
209
|
+
fields: PublicChatActionField[];
|
|
210
|
+
delivery: string;
|
|
211
|
+
prompt: string;
|
|
212
|
+
shortLabel: string;
|
|
213
|
+
enabled: boolean;
|
|
214
|
+
readiness: PublicChatActionReadiness;
|
|
215
|
+
/** Visitor-safe explanation shown when readiness is `degraded`. */
|
|
216
|
+
readinessNote?: string;
|
|
217
|
+
/** Client-only compatibility marker. Never emitted by the production catalogue. */
|
|
218
|
+
legacyFallback?: boolean;
|
|
219
|
+
}
|
|
104
220
|
interface TurnResult {
|
|
105
221
|
answer: string;
|
|
106
222
|
sources: Source[];
|
|
107
223
|
suggestedReplies: string[];
|
|
224
|
+
/** Legacy: raw tool ids. Prefer `actions`. */
|
|
108
225
|
availableActions: string[];
|
|
226
|
+
/** Structured action descriptors. Empty on older backends. */
|
|
227
|
+
actions?: PublicChatAction[];
|
|
228
|
+
/** Action the backend resolved for this turn — open its form directly. */
|
|
229
|
+
selectedAction?: string;
|
|
109
230
|
handoffOffered: boolean;
|
|
110
231
|
/** Contact fields the backend wants inline before handoff, e.g. ["email"]. */
|
|
111
232
|
requestedContactFields?: string[];
|
|
@@ -119,6 +240,7 @@ interface TurnResult {
|
|
|
119
240
|
audioBase64?: string;
|
|
120
241
|
mimeType?: string;
|
|
121
242
|
visualization?: AnalyticsVisualization;
|
|
243
|
+
artifacts?: ChatArtifact[];
|
|
122
244
|
}
|
|
123
245
|
interface AnalyticsVisualizationColumn {
|
|
124
246
|
key: string;
|
|
@@ -135,7 +257,7 @@ interface AnalyticsVisualizationColumn {
|
|
|
135
257
|
groupable?: boolean;
|
|
136
258
|
}
|
|
137
259
|
interface AnalyticsVisualizationRecommendation {
|
|
138
|
-
type: 'kpi' | 'table' | 'line' | 'area' | 'bar' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel';
|
|
260
|
+
type: 'kpi' | 'table' | 'line' | 'area' | 'bar' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel' | 'heatmap' | 'radar';
|
|
139
261
|
mode: string;
|
|
140
262
|
categoryField?: string;
|
|
141
263
|
valueFields?: string[];
|
|
@@ -144,6 +266,8 @@ interface AnalyticsVisualizationRecommendation {
|
|
|
144
266
|
confidence?: number;
|
|
145
267
|
}
|
|
146
268
|
interface AnalyticsVisualizationExplanation {
|
|
269
|
+
conversationalPreface?: string;
|
|
270
|
+
metricReference?: string;
|
|
147
271
|
headline: string;
|
|
148
272
|
summary: string;
|
|
149
273
|
evidence?: string[];
|
|
@@ -165,12 +289,85 @@ interface AnalyticsVisualizationExplanation {
|
|
|
165
289
|
};
|
|
166
290
|
limitations?: string[];
|
|
167
291
|
followUps?: string[];
|
|
168
|
-
source: 'governed_result' | 'ai_grounded';
|
|
292
|
+
source: 'governed_result' | 'ai_grounded' | 'rag_deterministic_analysis' | 'analysis_contract' | string;
|
|
293
|
+
}
|
|
294
|
+
interface AnalyticsVisualizationAnalysis {
|
|
295
|
+
summary: string;
|
|
296
|
+
highlights?: Array<{
|
|
297
|
+
kind: 'value' | 'result' | 'leader' | 'lowest' | 'share' | 'trend' | string;
|
|
298
|
+
title: string;
|
|
299
|
+
description: string;
|
|
300
|
+
field?: string;
|
|
301
|
+
value?: number;
|
|
302
|
+
changePercent?: number;
|
|
303
|
+
}>;
|
|
304
|
+
suggestedQuestions?: string[];
|
|
305
|
+
limitations?: string[];
|
|
306
|
+
method?: 'governed_result' | 'ai_grounded' | 'ai_enhanced' | string;
|
|
307
|
+
}
|
|
308
|
+
interface AnalyticsVisualizationAnalysisIntent {
|
|
309
|
+
method: string;
|
|
310
|
+
metric?: string;
|
|
311
|
+
metricOperation?: 'direct' | 'ratio' | 'rate' | 'share' | string;
|
|
312
|
+
numeratorMetric?: string;
|
|
313
|
+
denominatorMetric?: string;
|
|
314
|
+
timeField?: string;
|
|
315
|
+
breakdowns?: string[];
|
|
316
|
+
comparison?: string;
|
|
317
|
+
requestedAspects?: string[];
|
|
318
|
+
requestedOutputs?: string[];
|
|
319
|
+
requestedEntities?: string[];
|
|
320
|
+
requiredEvidence?: string[];
|
|
321
|
+
status: 'planned' | 'completed' | 'incomplete' | 'failed' | string;
|
|
322
|
+
message?: string;
|
|
323
|
+
}
|
|
324
|
+
interface AnalyticsVisualizationAnalysisCoverage {
|
|
325
|
+
complete: boolean;
|
|
326
|
+
coveredAspects?: string[];
|
|
327
|
+
missingAspects?: string[];
|
|
328
|
+
evidenceKeys?: string[];
|
|
329
|
+
}
|
|
330
|
+
interface AnalyticsVisualizationBusinessAnalysis {
|
|
331
|
+
type: 'analysis_result';
|
|
332
|
+
method: string;
|
|
333
|
+
question: string;
|
|
334
|
+
answer: string;
|
|
335
|
+
evidence: Array<{
|
|
336
|
+
id: string;
|
|
337
|
+
statement: string;
|
|
338
|
+
values?: Record<string, unknown>;
|
|
339
|
+
}>;
|
|
340
|
+
tables?: Array<{
|
|
341
|
+
title: string;
|
|
342
|
+
columns: string[];
|
|
343
|
+
rows: Array<Record<string, unknown>>;
|
|
344
|
+
}>;
|
|
345
|
+
charts?: Array<{
|
|
346
|
+
type: 'bar' | 'line' | 'scatter' | string;
|
|
347
|
+
title: string;
|
|
348
|
+
x: string;
|
|
349
|
+
y: string;
|
|
350
|
+
rows: Array<Record<string, unknown>>;
|
|
351
|
+
}>;
|
|
352
|
+
confidence: 'low' | 'medium' | 'high';
|
|
353
|
+
limitations?: string[];
|
|
354
|
+
recommendedActions?: string[];
|
|
355
|
+
sources?: Array<{
|
|
356
|
+
name: string;
|
|
357
|
+
type: string;
|
|
358
|
+
entity: string;
|
|
359
|
+
rowCount: number;
|
|
360
|
+
}>;
|
|
361
|
+
quality?: Record<string, unknown>;
|
|
362
|
+
provenance?: Record<string, unknown>;
|
|
363
|
+
explanation?: AnalyticsVisualizationExplanation;
|
|
364
|
+
intent?: AnalyticsVisualizationAnalysisIntent;
|
|
365
|
+
coverage?: AnalyticsVisualizationAnalysisCoverage;
|
|
169
366
|
}
|
|
170
367
|
interface AnalyticsVisualization {
|
|
171
368
|
version?: number;
|
|
172
369
|
presentation?: 'kpi' | 'chart' | 'table';
|
|
173
|
-
type: 'kpi' | 'table' | 'bar' | 'line' | 'stacked_bar';
|
|
370
|
+
type: 'kpi' | 'table' | 'bar' | 'line' | 'area' | 'stacked_bar' | 'pie' | 'scatter' | 'funnel' | 'heatmap' | 'radar';
|
|
174
371
|
title?: string;
|
|
175
372
|
label?: string;
|
|
176
373
|
value?: string;
|
|
@@ -214,6 +411,10 @@ interface AnalyticsVisualization {
|
|
|
214
411
|
isMixed: boolean;
|
|
215
412
|
};
|
|
216
413
|
chartRecommendation?: AnalyticsVisualizationRecommendation;
|
|
414
|
+
analysis?: AnalyticsVisualizationAnalysis;
|
|
415
|
+
businessAnalysis?: AnalyticsVisualizationBusinessAnalysis;
|
|
416
|
+
analysisIntent?: AnalyticsVisualizationAnalysisIntent;
|
|
417
|
+
analysisCoverage?: AnalyticsVisualizationAnalysisCoverage;
|
|
217
418
|
expandable?: boolean;
|
|
218
419
|
tableAvailable?: boolean;
|
|
219
420
|
downloadAvailable?: boolean;
|
|
@@ -241,6 +442,31 @@ interface LiveEventsResult {
|
|
|
241
442
|
conversationEnded?: boolean;
|
|
242
443
|
events: LiveEvent[];
|
|
243
444
|
}
|
|
445
|
+
interface AuthenticatedHistoryMessage {
|
|
446
|
+
id: string;
|
|
447
|
+
role: 'user' | 'assistant' | 'system';
|
|
448
|
+
content: string;
|
|
449
|
+
authorName?: string;
|
|
450
|
+
messageType?: string;
|
|
451
|
+
sources?: Array<{
|
|
452
|
+
title?: string;
|
|
453
|
+
url?: string;
|
|
454
|
+
}>;
|
|
455
|
+
visualization?: AnalyticsVisualization;
|
|
456
|
+
artifacts?: ChatArtifact[];
|
|
457
|
+
createdAt: string;
|
|
458
|
+
}
|
|
459
|
+
interface AuthenticatedHistoryConversation {
|
|
460
|
+
sessionId: string;
|
|
461
|
+
title: string;
|
|
462
|
+
ended: boolean;
|
|
463
|
+
lastSeenAt: string;
|
|
464
|
+
messages: AuthenticatedHistoryMessage[];
|
|
465
|
+
}
|
|
466
|
+
interface AuthenticatedHistoryResult {
|
|
467
|
+
activeSessionId?: string;
|
|
468
|
+
conversations: AuthenticatedHistoryConversation[];
|
|
469
|
+
}
|
|
244
470
|
interface StreamCallbacks {
|
|
245
471
|
/** Called with each incremental text chunk. */
|
|
246
472
|
onChunk: (text: string) => void;
|
|
@@ -248,7 +474,6 @@ interface StreamCallbacks {
|
|
|
248
474
|
/** True only for turns sent from the active Speak-with-AI call. */
|
|
249
475
|
voicePlaybackRequested?: boolean;
|
|
250
476
|
}
|
|
251
|
-
type ActionType = 'contact' | 'inquiry' | 'book-demo' | 'request-callback' | 'subscribe-newsletter';
|
|
252
477
|
interface ActionResult {
|
|
253
478
|
ok: boolean;
|
|
254
479
|
note?: string;
|
|
@@ -285,6 +510,12 @@ interface BusyRange {
|
|
|
285
510
|
}
|
|
286
511
|
/** Booking availability for the picker. */
|
|
287
512
|
interface DemoSlotsResult {
|
|
513
|
+
status?: 'available' | 'request_only' | 'delegated' | 'unavailable';
|
|
514
|
+
reason?: string;
|
|
515
|
+
timezone?: string;
|
|
516
|
+
slotDurationMinutes?: number;
|
|
517
|
+
/** Exact provider-checked slot instants the visitor may choose. */
|
|
518
|
+
available?: string[];
|
|
288
519
|
/** Exact slot instants (UTC ISO) already booked via the widget. */
|
|
289
520
|
taken: string[];
|
|
290
521
|
/** Busy ranges from the connected calendar (Google / Outlook). */
|
|
@@ -304,16 +535,20 @@ interface GifResult {
|
|
|
304
535
|
*/
|
|
305
536
|
interface Transport {
|
|
306
537
|
bootstrap(): Promise<BootstrapInfo>;
|
|
538
|
+
/** Server-backed history for the verified SDK customer. Anonymous returns empty. */
|
|
539
|
+
history(): Promise<AuthenticatedHistoryResult>;
|
|
307
540
|
/** Stream a turn; resolves with final metadata once `done`. */
|
|
308
541
|
stream(question: string, sessionId: string, cb: StreamCallbacks): Promise<TurnResult>;
|
|
309
542
|
/** Poll for staff/system events after a timestamp during live handoff. */
|
|
310
543
|
liveEvents(sessionId: string, after: string): Promise<LiveEventsResult>;
|
|
311
544
|
/** Soft visitor typing hint for the staff console. */
|
|
312
545
|
typing(sessionId: string, isTyping: boolean): Promise<void>;
|
|
313
|
-
action(type:
|
|
546
|
+
action(type: string, payload: Record<string, unknown>, endpointOverride?: string): Promise<ActionResult>;
|
|
314
547
|
/** Synthesize short widget UI prompts through the token's configured TTS voice. */
|
|
315
548
|
speak(text: string): Promise<SpeechResult>;
|
|
316
549
|
transcribe(audioBase64: string, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
|
|
550
|
+
/** Preferred binary voice upload. Optional for backward-compatible custom transports. */
|
|
551
|
+
transcribeAudio?(audio: Blob, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
|
|
317
552
|
/**
|
|
318
553
|
* Extract text from a visitor-attached image / PDF via the backend's
|
|
319
554
|
* multimodal endpoint (`POST /public-chat/extract`). The returned text is
|
|
@@ -326,8 +561,8 @@ interface Transport {
|
|
|
326
561
|
/**
|
|
327
562
|
* Booking availability within [fromISO, toISO]: `taken` = exact slot instants
|
|
328
563
|
* already booked via the widget; `busy` = ranges the connected calendar
|
|
329
|
-
* (Google / Outlook) is occupied.
|
|
330
|
-
*
|
|
564
|
+
* (Google / Outlook) is occupied. Connected event calendars fail closed:
|
|
565
|
+
* provider errors reject this call instead of making every slot look open.
|
|
331
566
|
*/
|
|
332
567
|
demoSlots(fromISO: string, toISO: string): Promise<DemoSlotsResult>;
|
|
333
568
|
/**
|
|
@@ -345,10 +580,32 @@ interface Transport {
|
|
|
345
580
|
}
|
|
346
581
|
//#endregion
|
|
347
582
|
//#region src/types.d.ts
|
|
583
|
+
type ChatSurface = 'floating' | 'full-page';
|
|
584
|
+
interface WidgetActionTranslation {
|
|
585
|
+
label?: string;
|
|
586
|
+
shortLabel?: string;
|
|
587
|
+
description?: string;
|
|
588
|
+
formTitle?: string;
|
|
589
|
+
submitLabel?: string;
|
|
590
|
+
delivery?: string;
|
|
591
|
+
prompt?: string;
|
|
592
|
+
readinessNote?: string;
|
|
593
|
+
fields?: Record<string, {
|
|
594
|
+
label?: string;
|
|
595
|
+
placeholder?: string;
|
|
596
|
+
}>;
|
|
597
|
+
}
|
|
598
|
+
interface WidgetTranslationBundle {
|
|
599
|
+
labels?: Partial<WidgetStrings>;
|
|
600
|
+
/** Action copy keyed by the stable backend action ID. */
|
|
601
|
+
actions?: Record<string, WidgetActionTranslation>;
|
|
602
|
+
}
|
|
348
603
|
/** Public configuration surface passed to `Centrinfo.init()` / <CentrinfoWidget>. */
|
|
349
604
|
interface WidgetConfig {
|
|
350
605
|
/** The org's public chat token (`pub_*`). Required. It IS the org identity. */
|
|
351
606
|
token: string;
|
|
607
|
+
/** Conversation namespace. Set by the SDK surface mounting the chat. */
|
|
608
|
+
chatSurface?: ChatSurface;
|
|
352
609
|
/** Short-lived server-signed context token for governed customer analytics. */
|
|
353
610
|
analyticsContextToken?: string;
|
|
354
611
|
/** Short-lived SDK customer identity JWT for authenticated chat access. */
|
|
@@ -359,6 +616,11 @@ interface WidgetConfig {
|
|
|
359
616
|
apiBaseUrl?: string;
|
|
360
617
|
/** Brand accent (any CSS color). Overrides the persona/default green. */
|
|
361
618
|
accentColor?: string;
|
|
619
|
+
/**
|
|
620
|
+
* Full brand token map for SDK-rendered chat surfaces. `accentColor` remains
|
|
621
|
+
* a shorthand for `themeTokens.accent` and wins when both are supplied.
|
|
622
|
+
*/
|
|
623
|
+
themeTokens?: WidgetThemeTokens;
|
|
362
624
|
/** Optional display-name override. Normally loaded from the token bootstrap. */
|
|
363
625
|
agentName?: string;
|
|
364
626
|
/** Optional header avatar URL override. Normally loaded from the token bootstrap. */
|
|
@@ -385,14 +647,22 @@ interface WidgetConfig {
|
|
|
385
647
|
* chat answers themselves are already multilingual server-side.
|
|
386
648
|
*/
|
|
387
649
|
labels?: Partial<WidgetStrings>;
|
|
650
|
+
/** Locale used to select a translation bundle. Defaults to browser locale. */
|
|
651
|
+
locale?: string;
|
|
652
|
+
/**
|
|
653
|
+
* Translation data keyed by locale (`fr`, `fr-CA`, `yo`, ...). Exact locale
|
|
654
|
+
* wins, then its base language. Explicit `labels` still wins over the pack.
|
|
655
|
+
*/
|
|
656
|
+
translations?: Record<string, WidgetTranslationBundle>;
|
|
388
657
|
/**
|
|
389
658
|
* Where the visible transcript is stored across reloads:
|
|
390
659
|
* - `local` (default) — `localStorage`, survives browser restarts (30d TTL).
|
|
391
660
|
* - `session` — `sessionStorage`, cleared when the tab closes (better on
|
|
392
661
|
* shared / kiosk machines so the next visitor can't read prior chats).
|
|
393
662
|
* - `none` — never persisted; the transcript lives only in memory.
|
|
394
|
-
*
|
|
395
|
-
*
|
|
663
|
+
* Authenticated SDK users also restore retained conversations from the
|
|
664
|
+
* backend on a new browser or device. This setting controls the local cache
|
|
665
|
+
* and remains the only persistence layer for anonymous visitors.
|
|
396
666
|
*/
|
|
397
667
|
persistence?: 'local' | 'session' | 'none';
|
|
398
668
|
/**
|
|
@@ -403,6 +673,11 @@ interface WidgetConfig {
|
|
|
403
673
|
attachments?: boolean;
|
|
404
674
|
/** Stacking context against the host page. */
|
|
405
675
|
zIndex?: number;
|
|
676
|
+
/**
|
|
677
|
+
* CSP nonce applied to the fallback inline stylesheet on browsers without
|
|
678
|
+
* constructable stylesheet support. Pass the nonce used by the host page.
|
|
679
|
+
*/
|
|
680
|
+
styleNonce?: string;
|
|
406
681
|
/** Use the built-in mock transport (local preview, no backend/token needed). */
|
|
407
682
|
demo?: boolean;
|
|
408
683
|
/**
|
|
@@ -440,7 +715,7 @@ interface WidgetConfig {
|
|
|
440
715
|
/** CSS selector for host-page element(s) that open the widget on click
|
|
441
716
|
* (your own launcher). Listeners are (re)bound automatically. */
|
|
442
717
|
customLauncherSelector?: string;
|
|
443
|
-
/** Auto-logout (wipe local
|
|
718
|
+
/** Auto-logout (wipe local cache) after this many minutes of inactivity.
|
|
444
719
|
* 0 / omitted = never. Use on shared / kiosk devices. */
|
|
445
720
|
sessionDurationMinutes?: number;
|
|
446
721
|
/**
|
|
@@ -476,6 +751,25 @@ interface WidgetConfig {
|
|
|
476
751
|
onAction?: (action: string) => void;
|
|
477
752
|
onHandoff?: () => void;
|
|
478
753
|
}
|
|
754
|
+
/** Shared theme tokens consumed by the floating widget and full-page chat app. */
|
|
755
|
+
interface WidgetThemeTokens {
|
|
756
|
+
accent?: string;
|
|
757
|
+
accentStrong?: string;
|
|
758
|
+
accentSoft?: string;
|
|
759
|
+
accentText?: string;
|
|
760
|
+
background?: string;
|
|
761
|
+
surface?: string;
|
|
762
|
+
surfaceMuted?: string;
|
|
763
|
+
text?: string;
|
|
764
|
+
mutedText?: string;
|
|
765
|
+
border?: string;
|
|
766
|
+
shadow?: string;
|
|
767
|
+
radius?: string;
|
|
768
|
+
fontFamily?: string;
|
|
769
|
+
success?: string;
|
|
770
|
+
warning?: string;
|
|
771
|
+
danger?: string;
|
|
772
|
+
}
|
|
479
773
|
/** A B2B company / account the visitor belongs to (Intercom "Company object").
|
|
480
774
|
* Folded into the session metadata for the staff inbox. */
|
|
481
775
|
interface WidgetCompany {
|
|
@@ -553,6 +847,19 @@ interface WidgetHandle {
|
|
|
553
847
|
destroy: () => void;
|
|
554
848
|
}
|
|
555
849
|
/** A rendered chat message. */
|
|
850
|
+
interface ChatArtifact {
|
|
851
|
+
type: 'image' | 'resource_link' | 'visualization';
|
|
852
|
+
name?: string;
|
|
853
|
+
title?: string;
|
|
854
|
+
caption?: string;
|
|
855
|
+
altText?: string;
|
|
856
|
+
mimeType?: 'image/png' | 'image/jpeg' | 'image/webp' | string;
|
|
857
|
+
/** Base64 only, without a data-URL prefix. */
|
|
858
|
+
data?: string;
|
|
859
|
+
uri?: string;
|
|
860
|
+
/** Local compatibility bridge for the existing governed analytics result. */
|
|
861
|
+
visualization?: AnalyticsVisualization;
|
|
862
|
+
}
|
|
556
863
|
interface ChatMessage {
|
|
557
864
|
id: string;
|
|
558
865
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -570,6 +877,10 @@ interface ChatMessage {
|
|
|
570
877
|
sources?: Source[];
|
|
571
878
|
suggestedReplies?: string[];
|
|
572
879
|
availableActions?: string[];
|
|
880
|
+
/** Structured action descriptors from the backend (preferred over ids). */
|
|
881
|
+
actions?: PublicChatAction[];
|
|
882
|
+
/** Action the backend resolved for this turn — its form opens directly. */
|
|
883
|
+
selectedAction?: string;
|
|
573
884
|
handoffOffered?: boolean;
|
|
574
885
|
/** Contact fields requested by final API metadata before handoff. */
|
|
575
886
|
requestedContactFields?: string[];
|
|
@@ -584,6 +895,7 @@ interface ChatMessage {
|
|
|
584
895
|
/** Visitor's 👍/👎 on this assistant reply (persisted so it survives reloads). */
|
|
585
896
|
feedback?: 'up' | 'down';
|
|
586
897
|
visualization?: AnalyticsVisualization;
|
|
898
|
+
artifacts?: ChatArtifact[];
|
|
587
899
|
}
|
|
588
900
|
interface Source {
|
|
589
901
|
title?: string;
|
|
@@ -630,6 +942,8 @@ interface BootstrapInfo {
|
|
|
630
942
|
memoryRetentionDays: number;
|
|
631
943
|
memoryMessageCap: number;
|
|
632
944
|
availableActions: string[];
|
|
945
|
+
/** Structured action descriptors. Empty from a backend that predates them. */
|
|
946
|
+
actions?: PublicChatAction[];
|
|
633
947
|
accentColor?: string;
|
|
634
948
|
/** One-line description under the agent name on the welcome screen (≤500). */
|
|
635
949
|
agentDescription?: string;
|
|
@@ -656,6 +970,18 @@ interface SchedulerInfo {
|
|
|
656
970
|
label?: string;
|
|
657
971
|
mode?: 'event' | 'link';
|
|
658
972
|
bookingLink?: string;
|
|
973
|
+
availability?: {
|
|
974
|
+
timezone: string;
|
|
975
|
+
weekdays: number[];
|
|
976
|
+
startTime: string;
|
|
977
|
+
endTime: string;
|
|
978
|
+
slotDurationMinutes: number;
|
|
979
|
+
bufferBeforeMinutes: number;
|
|
980
|
+
bufferAfterMinutes: number;
|
|
981
|
+
minimumNoticeMinutes: number;
|
|
982
|
+
bookingWindowDays: number;
|
|
983
|
+
calendarIds: string[];
|
|
984
|
+
};
|
|
659
985
|
}
|
|
660
986
|
//#endregion
|
|
661
|
-
export {
|
|
987
|
+
export { PublicChatActionField as _, Source as a, WidgetConfig as c, WidgetUser as d, ActionResult as f, PublicChatAction as g, GifResult as h, FeaturedLink as i, WidgetHandle as l, DemoSlotsResult as m, ChatArtifact as n, Visitor as o, AnalyticsVisualization as p, ChatMessage as r, WidgetActionTranslation as s, BootstrapInfo as t, WidgetThemeTokens as u, Transport as v, WidgetStrings as y };
|