@accurix/centrinfo-widget 4.0.0 → 5.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.
@@ -1,4 +1,4 @@
1
- import "preact";
1
+ import * as preact0 from "preact";
2
2
 
3
3
  //#region src/i18n.d.ts
4
4
 
@@ -36,6 +36,10 @@ interface WidgetStrings {
36
36
  /** Header presence line when bootstrap was loaded with `offline`. */
37
37
  statusOffline: string;
38
38
  liveSupport: string;
39
+ /** Button on the "teammate left, the AI is back" notice. */
40
+ reconnectSupport: string;
41
+ /** Message that opens the live-support form again after reconnecting. */
42
+ reconnectPrompt: string;
39
43
  waitingForTeam: string;
40
44
  assistantName: string;
41
45
  chatName: string;
@@ -59,6 +63,8 @@ interface WidgetStrings {
59
63
  reopenVoiceChat: string;
60
64
  voiceConnecting: string;
61
65
  voiceListening: string;
66
+ voiceHearing: string;
67
+ voiceUnavailable: string;
62
68
  voiceProcessing: string;
63
69
  voiceSpeaking: string;
64
70
  voiceNoise: string;
@@ -113,7 +119,18 @@ interface WidgetStrings {
113
119
  attaching: string;
114
120
  attachTooLarge: string;
115
121
  attachFailed: string;
122
+ attachPreviewTitle: string;
123
+ attachOpen: string;
124
+ attachDownload: string;
125
+ attachPreviewClose: string;
126
+ attachPreviewLoading: string;
127
+ attachPreviewFailed: string;
128
+ attachPreviewUnsupported: string;
129
+ attachAnalysisFailed: string;
116
130
  removeAttachment: string;
131
+ attachLimit: string;
132
+ attachedFiles: string;
133
+ removeAttachmentNamed: string;
117
134
  dropFileHere: string;
118
135
  clearDeviceData: string;
119
136
  clearDeviceDataBody: string;
@@ -129,6 +146,8 @@ interface WidgetStrings {
129
146
  /** Generic action-form success fallback + error. */
130
147
  formThanks: string;
131
148
  formError: string;
149
+ /** Case number appended to a confirmation. `{reference}` is the case number. */
150
+ caseReference: string;
132
151
  /** Public action drawer chrome. Action-specific copy remains descriptor data. */
133
152
  actionContactOptions: string;
134
153
  actionGetInTouch: string;
@@ -146,6 +165,7 @@ interface WidgetStrings {
146
165
  bookingPickDay: string;
147
166
  bookingPickTimeLabel: string;
148
167
  bookingDuration: string;
168
+ bookingCallbackDuration: string;
149
169
  bookingTimezone: string;
150
170
  bookingSchedulerFallback: string;
151
171
  bookingCheckingAvailability: string;
@@ -157,6 +177,11 @@ interface WidgetStrings {
157
177
  bookingNotOffered: string;
158
178
  /** Confirmation after requesting a demo. `{when}` = the chosen slot. */
159
179
  bookingRequested: string;
180
+ /** The request was retained but the calendar provider did not confirm it. */
181
+ bookingVerificationPending: string;
182
+ /** Confirmation after requesting a callback. `{when}` = the chosen slot. */
183
+ bookingCallbackRequested: string;
184
+ bookingCallbackConfirmed: string;
160
185
  /** Confirmation when a real calendar event was created. `{when}` = slot. */
161
186
  bookingConfirmed: string;
162
187
  /** Shown when the chosen slot was just taken by someone else. */
@@ -166,12 +191,22 @@ interface WidgetStrings {
166
191
  bookingViaProvider: string;
167
192
  bookingOpenScheduler: string;
168
193
  bookingLinkOpened: string;
194
+ bookingScheduled: string;
195
+ bookingBackToChat: string;
196
+ bookingOpenNewTab: string;
197
+ bookingCloseScheduler: string;
198
+ bookingLoadingScheduler: string;
169
199
  bookingMeetingLink: string;
200
+ bookingManageLink: string;
201
+ bookingCheckingDetails: string;
202
+ bookingDetailsUnavailable: string;
203
+ bookingRetryDetails: string;
170
204
  /** Preview mode (data-preview): canned reply, action note, top banner. */
171
205
  previewReply: string;
172
206
  previewActionNote: string;
173
207
  previewBanner: string;
174
208
  }
209
+ declare const StringsProvider: preact0.Provider<WidgetStrings>;
175
210
  //#endregion
176
211
  //#region src/api/types.d.ts
177
212
  /** The result metadata that arrives with (or after) an answer. */
@@ -208,6 +243,9 @@ interface PublicChatAction {
208
243
  submitLabel: string;
209
244
  fields: PublicChatActionField[];
210
245
  delivery: string;
246
+ /** True when submitting brings a teammate into this chat; false for a
247
+ * follow-up by email or phone. Several actions share an endpoint. */
248
+ liveHandoff?: boolean;
211
249
  prompt: string;
212
250
  shortLabel: string;
213
251
  enabled: boolean;
@@ -217,7 +255,17 @@ interface PublicChatAction {
217
255
  /** Client-only compatibility marker. Never emitted by the production catalogue. */
218
256
  legacyFallback?: boolean;
219
257
  }
258
+ interface LiveAudioSegment {
259
+ seq: number;
260
+ /** Empty when the server could not voice the piece; speak `text` instead. */
261
+ audioBase64: string;
262
+ mimeType?: string;
263
+ /** The piece as spoken (no links or markdown). */
264
+ text?: string;
265
+ }
220
266
  interface TurnResult {
267
+ /** True when the reply was spoken in live pieces (onAudioSegment). */
268
+ liveAudio?: boolean;
221
269
  answer: string;
222
270
  sources: Source[];
223
271
  suggestedReplies: string[];
@@ -433,6 +481,9 @@ interface LiveEvent {
433
481
  content: string;
434
482
  authorName?: string;
435
483
  createdAt: string;
484
+ /** On an ai_handback notice: the visitor had asked for a person, so offer
485
+ * to bring one back. */
486
+ reconnectOffered?: boolean;
436
487
  }
437
488
  interface LiveEventsResult {
438
489
  mode: 'ai' | 'queued' | 'human';
@@ -448,6 +499,8 @@ interface AuthenticatedHistoryMessage {
448
499
  content: string;
449
500
  authorName?: string;
450
501
  messageType?: string;
502
+ /** On an ai_handback notice: the visitor had asked for a person. */
503
+ reconnectOffered?: boolean;
451
504
  sources?: Array<{
452
505
  title?: string;
453
506
  url?: string;
@@ -470,9 +523,22 @@ interface AuthenticatedHistoryResult {
470
523
  interface StreamCallbacks {
471
524
  /** Called with each incremental text chunk. */
472
525
  onChunk: (text: string) => void;
526
+ /** The answer text and metadata have arrived; optional reply audio may follow. */
527
+ onTextReady?: () => void;
528
+ /** Live answers: what was streamed so far is replaced by a newer answer. */
529
+ onReset?: () => void;
530
+ /** Live answers: one spoken piece of the reply, in order, while it is still
531
+ * being written. Older backends send a single whole-reply clip instead. */
532
+ onAudioSegment?: (segment: LiveAudioSegment) => void;
473
533
  signal?: AbortSignal;
474
534
  /** True only for turns sent from the active Speak-with-AI call. */
475
535
  voicePlaybackRequested?: boolean;
536
+ /** Stable id of the visitor's message. A retry sends the same id, so the
537
+ * backend answers and bills the turn once. */
538
+ clientMessageId?: string;
539
+ attachmentId?: string;
540
+ /** Every stored file sent with this message. */
541
+ attachmentIds?: string[];
476
542
  }
477
543
  interface ActionResult {
478
544
  ok: boolean;
@@ -481,15 +547,33 @@ interface ActionResult {
481
547
  * a real calendar event was created (event mode) or a Calendly link was
482
548
  * resolved (link mode). Absent when it fell back to a staff-follow-up request. */
483
549
  booking?: DemoBooking;
550
+ /** Case number for a request staff will follow up on (support, demo, callback). */
551
+ caseReference?: string;
552
+ /** Inquiry receiving this booking receipt; used to confirm hosted Calendly completion. */
553
+ inquiryId?: string;
484
554
  }
485
555
  /** Outcome of a live book-a-demo (mirrors backend services.PublicDemoBooking). */
486
556
  interface DemoBooking {
487
557
  mode: 'event' | 'link';
488
558
  provider: string;
489
559
  confirmed?: boolean;
560
+ /** The request and slot were retained, but the provider outcome could not be verified. */
561
+ verificationPending?: boolean;
490
562
  eventLink?: string;
491
563
  meetingUrl?: string;
492
564
  schedulingLink?: string;
565
+ cancelUrl?: string;
566
+ rescheduleUrl?: string;
567
+ startAt?: string;
568
+ endAt?: string;
569
+ timezone?: string;
570
+ title?: string;
571
+ }
572
+ interface HostedBookingConfirmation {
573
+ sessionId: string;
574
+ inquiryId: string;
575
+ eventUri: string;
576
+ inviteeUri: string;
493
577
  }
494
578
  /** A 👍/👎 a visitor left on one assistant reply (POST /public-chat/feedback). */
495
579
  interface FeedbackInput {
@@ -541,21 +625,24 @@ interface Transport {
541
625
  stream(question: string, sessionId: string, cb: StreamCallbacks): Promise<TurnResult>;
542
626
  /** Poll for staff/system events after a timestamp during live handoff. */
543
627
  liveEvents(sessionId: string, after: string): Promise<LiveEventsResult>;
628
+ /** Short-lived signal that this chat is open in a visible browser tab. */
629
+ presence(sessionId: string): Promise<void>;
544
630
  /** Soft visitor typing hint for the staff console. */
545
631
  typing(sessionId: string, isTyping: boolean): Promise<void>;
546
632
  action(type: string, payload: Record<string, unknown>, endpointOverride?: string): Promise<ActionResult>;
633
+ confirmHostedBooking?(input: HostedBookingConfirmation): Promise<DemoBooking>;
547
634
  /** Synthesize short widget UI prompts through the token's configured TTS voice. */
548
635
  speak(text: string): Promise<SpeechResult>;
549
636
  transcribe(audioBase64: string, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
550
637
  /** Preferred binary voice upload. Optional for backward-compatible custom transports. */
638
+ /** A file the visitor attached to this conversation, for preview. */
639
+ fetchAttachment?(attachmentId: string, sessionId: string): Promise<Blob>;
551
640
  transcribeAudio?(audio: Blob, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
552
- /**
553
- * Extract text from a visitor-attached image / PDF via the backend's
554
- * multimodal endpoint (`POST /public-chat/extract`). The returned text is
555
- * prepended to the visitor's next message so the AI can answer about it.
556
- * Resolves to '' when extraction is unavailable / fails.
557
- */
558
- extract(fileBase64: string, mimeType: string, filename?: string): Promise<string>;
641
+ uploadAttachment?(fileBase64: string, mimeType: string, filename: string, sessionId: string, analyze: boolean): Promise<{
642
+ id: string;
643
+ text: string;
644
+ analysisFailed: boolean;
645
+ }>;
559
646
  /** Search GIFs (Tenor). Returns [] when no key is configured. */
560
647
  searchGifs(query: string): Promise<GifResult[]>;
561
648
  /**
@@ -848,7 +935,7 @@ interface WidgetHandle {
848
935
  }
849
936
  /** A rendered chat message. */
850
937
  interface ChatArtifact {
851
- type: 'image' | 'resource_link' | 'visualization';
938
+ type: 'image' | 'video' | 'resource_link' | 'visualization';
852
939
  name?: string;
853
940
  title?: string;
854
941
  caption?: string;
@@ -860,6 +947,12 @@ interface ChatArtifact {
860
947
  /** Local compatibility bridge for the existing governed analytics result. */
861
948
  visualization?: AnalyticsVisualization;
862
949
  }
950
+ /** A file sent with a visitor message. */
951
+ interface MessageAttachment {
952
+ /** The stored attachment, when it was uploaded. */
953
+ id?: string;
954
+ name: string;
955
+ }
863
956
  interface ChatMessage {
864
957
  id: string;
865
958
  role: 'user' | 'assistant' | 'system';
@@ -868,12 +961,21 @@ interface ChatMessage {
868
961
  authorName?: string;
869
962
  /** Live handoff event type from the backend, e.g. agent_joined. */
870
963
  liveEventType?: string;
964
+ /** An ai_handback notice that may offer "Reconnect to support". */
965
+ offerReconnect?: boolean;
966
+ /** Local assistant message opened by "Reconnect to support". */
967
+ reconnectOffer?: boolean;
871
968
  /** ISO timestamp for server-originated live events. */
872
969
  createdAt?: string;
873
970
  /** Inline image (e.g. a GIF the visitor sent). Rendered in the bubble. */
874
971
  imageUrl?: string;
875
972
  /** Name of a file the visitor attached (rendered as a chip on their bubble). */
876
973
  attachmentName?: string;
974
+ /** The stored attachment behind attachmentName, for preview. */
975
+ attachmentId?: string;
976
+ /** Every file sent with this message (newer messages; older ones use
977
+ * attachmentName / attachmentId). */
978
+ attachments?: MessageAttachment[];
877
979
  sources?: Source[];
878
980
  suggestedReplies?: string[];
879
981
  availableActions?: string[];
@@ -959,7 +1061,7 @@ interface BootstrapInfo {
959
1061
  offline?: boolean;
960
1062
  /** Book-a-demo scheduler status (present only when book-a-demo is enabled).
961
1063
  * Drives the demo UX: event-mode → in-widget slot picker that creates a real
962
- * calendar event; link-mode → a "Book on Calendly" link; absent/!connected →
1064
+ * calendar event or Calendly invitee; link-mode → a hosted scheduler; absent/!connected →
963
1065
  * slot picker that just files a request for staff to confirm. */
964
1066
  scheduler?: SchedulerInfo;
965
1067
  }
@@ -984,4 +1086,4 @@ interface SchedulerInfo {
984
1086
  };
985
1087
  }
986
1088
  //#endregion
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 };
1089
+ export { WidgetStrings as C, StringsProvider as S, DemoSlotsResult as _, MessageAttachment as a, PublicChatActionField as b, Visitor as c, WidgetHandle as d, WidgetThemeTokens as f, DemoBooking as g, AnalyticsVisualization as h, FeaturedLink as i, 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, GifResult as v, Transport as x, PublicChatAction as y };
@@ -1,4 +1,7 @@
1
+ import * as preact0 from "preact";
2
+
1
3
  //#region src/i18n.d.ts
4
+
2
5
  /**
3
6
  * Every user-visible chrome string in one place. The widget ships English
4
7
  * defaults; a host localises by passing `labels` to `Centrinfo.init()` —
@@ -33,6 +36,10 @@ interface WidgetStrings {
33
36
  /** Header presence line when bootstrap was loaded with `offline`. */
34
37
  statusOffline: string;
35
38
  liveSupport: string;
39
+ /** Button on the "teammate left, the AI is back" notice. */
40
+ reconnectSupport: string;
41
+ /** Message that opens the live-support form again after reconnecting. */
42
+ reconnectPrompt: string;
36
43
  waitingForTeam: string;
37
44
  assistantName: string;
38
45
  chatName: string;
@@ -56,6 +63,8 @@ interface WidgetStrings {
56
63
  reopenVoiceChat: string;
57
64
  voiceConnecting: string;
58
65
  voiceListening: string;
66
+ voiceHearing: string;
67
+ voiceUnavailable: string;
59
68
  voiceProcessing: string;
60
69
  voiceSpeaking: string;
61
70
  voiceNoise: string;
@@ -110,7 +119,18 @@ interface WidgetStrings {
110
119
  attaching: string;
111
120
  attachTooLarge: string;
112
121
  attachFailed: string;
122
+ attachPreviewTitle: string;
123
+ attachOpen: string;
124
+ attachDownload: string;
125
+ attachPreviewClose: string;
126
+ attachPreviewLoading: string;
127
+ attachPreviewFailed: string;
128
+ attachPreviewUnsupported: string;
129
+ attachAnalysisFailed: string;
113
130
  removeAttachment: string;
131
+ attachLimit: string;
132
+ attachedFiles: string;
133
+ removeAttachmentNamed: string;
114
134
  dropFileHere: string;
115
135
  clearDeviceData: string;
116
136
  clearDeviceDataBody: string;
@@ -126,6 +146,8 @@ interface WidgetStrings {
126
146
  /** Generic action-form success fallback + error. */
127
147
  formThanks: string;
128
148
  formError: string;
149
+ /** Case number appended to a confirmation. `{reference}` is the case number. */
150
+ caseReference: string;
129
151
  /** Public action drawer chrome. Action-specific copy remains descriptor data. */
130
152
  actionContactOptions: string;
131
153
  actionGetInTouch: string;
@@ -143,6 +165,7 @@ interface WidgetStrings {
143
165
  bookingPickDay: string;
144
166
  bookingPickTimeLabel: string;
145
167
  bookingDuration: string;
168
+ bookingCallbackDuration: string;
146
169
  bookingTimezone: string;
147
170
  bookingSchedulerFallback: string;
148
171
  bookingCheckingAvailability: string;
@@ -154,6 +177,11 @@ interface WidgetStrings {
154
177
  bookingNotOffered: string;
155
178
  /** Confirmation after requesting a demo. `{when}` = the chosen slot. */
156
179
  bookingRequested: string;
180
+ /** The request was retained but the calendar provider did not confirm it. */
181
+ bookingVerificationPending: string;
182
+ /** Confirmation after requesting a callback. `{when}` = the chosen slot. */
183
+ bookingCallbackRequested: string;
184
+ bookingCallbackConfirmed: string;
157
185
  /** Confirmation when a real calendar event was created. `{when}` = slot. */
158
186
  bookingConfirmed: string;
159
187
  /** Shown when the chosen slot was just taken by someone else. */
@@ -163,12 +191,22 @@ interface WidgetStrings {
163
191
  bookingViaProvider: string;
164
192
  bookingOpenScheduler: string;
165
193
  bookingLinkOpened: string;
194
+ bookingScheduled: string;
195
+ bookingBackToChat: string;
196
+ bookingOpenNewTab: string;
197
+ bookingCloseScheduler: string;
198
+ bookingLoadingScheduler: string;
166
199
  bookingMeetingLink: string;
200
+ bookingManageLink: string;
201
+ bookingCheckingDetails: string;
202
+ bookingDetailsUnavailable: string;
203
+ bookingRetryDetails: string;
167
204
  /** Preview mode (data-preview): canned reply, action note, top banner. */
168
205
  previewReply: string;
169
206
  previewActionNote: string;
170
207
  previewBanner: string;
171
208
  }
209
+ declare const StringsProvider: preact0.Provider<WidgetStrings>;
172
210
  //#endregion
173
211
  //#region src/api/types.d.ts
174
212
  /** The result metadata that arrives with (or after) an answer. */
@@ -205,6 +243,9 @@ interface PublicChatAction {
205
243
  submitLabel: string;
206
244
  fields: PublicChatActionField[];
207
245
  delivery: string;
246
+ /** True when submitting brings a teammate into this chat; false for a
247
+ * follow-up by email or phone. Several actions share an endpoint. */
248
+ liveHandoff?: boolean;
208
249
  prompt: string;
209
250
  shortLabel: string;
210
251
  enabled: boolean;
@@ -214,7 +255,17 @@ interface PublicChatAction {
214
255
  /** Client-only compatibility marker. Never emitted by the production catalogue. */
215
256
  legacyFallback?: boolean;
216
257
  }
258
+ interface LiveAudioSegment {
259
+ seq: number;
260
+ /** Empty when the server could not voice the piece; speak `text` instead. */
261
+ audioBase64: string;
262
+ mimeType?: string;
263
+ /** The piece as spoken (no links or markdown). */
264
+ text?: string;
265
+ }
217
266
  interface TurnResult {
267
+ /** True when the reply was spoken in live pieces (onAudioSegment). */
268
+ liveAudio?: boolean;
218
269
  answer: string;
219
270
  sources: Source[];
220
271
  suggestedReplies: string[];
@@ -430,6 +481,9 @@ interface LiveEvent {
430
481
  content: string;
431
482
  authorName?: string;
432
483
  createdAt: string;
484
+ /** On an ai_handback notice: the visitor had asked for a person, so offer
485
+ * to bring one back. */
486
+ reconnectOffered?: boolean;
433
487
  }
434
488
  interface LiveEventsResult {
435
489
  mode: 'ai' | 'queued' | 'human';
@@ -445,6 +499,8 @@ interface AuthenticatedHistoryMessage {
445
499
  content: string;
446
500
  authorName?: string;
447
501
  messageType?: string;
502
+ /** On an ai_handback notice: the visitor had asked for a person. */
503
+ reconnectOffered?: boolean;
448
504
  sources?: Array<{
449
505
  title?: string;
450
506
  url?: string;
@@ -467,9 +523,22 @@ interface AuthenticatedHistoryResult {
467
523
  interface StreamCallbacks {
468
524
  /** Called with each incremental text chunk. */
469
525
  onChunk: (text: string) => void;
526
+ /** The answer text and metadata have arrived; optional reply audio may follow. */
527
+ onTextReady?: () => void;
528
+ /** Live answers: what was streamed so far is replaced by a newer answer. */
529
+ onReset?: () => void;
530
+ /** Live answers: one spoken piece of the reply, in order, while it is still
531
+ * being written. Older backends send a single whole-reply clip instead. */
532
+ onAudioSegment?: (segment: LiveAudioSegment) => void;
470
533
  signal?: AbortSignal;
471
534
  /** True only for turns sent from the active Speak-with-AI call. */
472
535
  voicePlaybackRequested?: boolean;
536
+ /** Stable id of the visitor's message. A retry sends the same id, so the
537
+ * backend answers and bills the turn once. */
538
+ clientMessageId?: string;
539
+ attachmentId?: string;
540
+ /** Every stored file sent with this message. */
541
+ attachmentIds?: string[];
473
542
  }
474
543
  interface ActionResult {
475
544
  ok: boolean;
@@ -478,15 +547,33 @@ interface ActionResult {
478
547
  * a real calendar event was created (event mode) or a Calendly link was
479
548
  * resolved (link mode). Absent when it fell back to a staff-follow-up request. */
480
549
  booking?: DemoBooking;
550
+ /** Case number for a request staff will follow up on (support, demo, callback). */
551
+ caseReference?: string;
552
+ /** Inquiry receiving this booking receipt; used to confirm hosted Calendly completion. */
553
+ inquiryId?: string;
481
554
  }
482
555
  /** Outcome of a live book-a-demo (mirrors backend services.PublicDemoBooking). */
483
556
  interface DemoBooking {
484
557
  mode: 'event' | 'link';
485
558
  provider: string;
486
559
  confirmed?: boolean;
560
+ /** The request and slot were retained, but the provider outcome could not be verified. */
561
+ verificationPending?: boolean;
487
562
  eventLink?: string;
488
563
  meetingUrl?: string;
489
564
  schedulingLink?: string;
565
+ cancelUrl?: string;
566
+ rescheduleUrl?: string;
567
+ startAt?: string;
568
+ endAt?: string;
569
+ timezone?: string;
570
+ title?: string;
571
+ }
572
+ interface HostedBookingConfirmation {
573
+ sessionId: string;
574
+ inquiryId: string;
575
+ eventUri: string;
576
+ inviteeUri: string;
490
577
  }
491
578
  /** A 👍/👎 a visitor left on one assistant reply (POST /public-chat/feedback). */
492
579
  interface FeedbackInput {
@@ -538,21 +625,24 @@ interface Transport {
538
625
  stream(question: string, sessionId: string, cb: StreamCallbacks): Promise<TurnResult>;
539
626
  /** Poll for staff/system events after a timestamp during live handoff. */
540
627
  liveEvents(sessionId: string, after: string): Promise<LiveEventsResult>;
628
+ /** Short-lived signal that this chat is open in a visible browser tab. */
629
+ presence(sessionId: string): Promise<void>;
541
630
  /** Soft visitor typing hint for the staff console. */
542
631
  typing(sessionId: string, isTyping: boolean): Promise<void>;
543
632
  action(type: string, payload: Record<string, unknown>, endpointOverride?: string): Promise<ActionResult>;
633
+ confirmHostedBooking?(input: HostedBookingConfirmation): Promise<DemoBooking>;
544
634
  /** Synthesize short widget UI prompts through the token's configured TTS voice. */
545
635
  speak(text: string): Promise<SpeechResult>;
546
636
  transcribe(audioBase64: string, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
547
637
  /** Preferred binary voice upload. Optional for backward-compatible custom transports. */
638
+ /** A file the visitor attached to this conversation, for preview. */
639
+ fetchAttachment?(attachmentId: string, sessionId: string): Promise<Blob>;
548
640
  transcribeAudio?(audio: Blob, mimeType: string, languageHint?: string, durationSeconds?: number): Promise<string>;
549
- /**
550
- * Extract text from a visitor-attached image / PDF via the backend's
551
- * multimodal endpoint (`POST /public-chat/extract`). The returned text is
552
- * prepended to the visitor's next message so the AI can answer about it.
553
- * Resolves to '' when extraction is unavailable / fails.
554
- */
555
- extract(fileBase64: string, mimeType: string, filename?: string): Promise<string>;
641
+ uploadAttachment?(fileBase64: string, mimeType: string, filename: string, sessionId: string, analyze: boolean): Promise<{
642
+ id: string;
643
+ text: string;
644
+ analysisFailed: boolean;
645
+ }>;
556
646
  /** Search GIFs (Tenor). Returns [] when no key is configured. */
557
647
  searchGifs(query: string): Promise<GifResult[]>;
558
648
  /**
@@ -845,7 +935,7 @@ interface WidgetHandle {
845
935
  }
846
936
  /** A rendered chat message. */
847
937
  interface ChatArtifact {
848
- type: 'image' | 'resource_link' | 'visualization';
938
+ type: 'image' | 'video' | 'resource_link' | 'visualization';
849
939
  name?: string;
850
940
  title?: string;
851
941
  caption?: string;
@@ -857,6 +947,12 @@ interface ChatArtifact {
857
947
  /** Local compatibility bridge for the existing governed analytics result. */
858
948
  visualization?: AnalyticsVisualization;
859
949
  }
950
+ /** A file sent with a visitor message. */
951
+ interface MessageAttachment {
952
+ /** The stored attachment, when it was uploaded. */
953
+ id?: string;
954
+ name: string;
955
+ }
860
956
  interface ChatMessage {
861
957
  id: string;
862
958
  role: 'user' | 'assistant' | 'system';
@@ -865,12 +961,21 @@ interface ChatMessage {
865
961
  authorName?: string;
866
962
  /** Live handoff event type from the backend, e.g. agent_joined. */
867
963
  liveEventType?: string;
964
+ /** An ai_handback notice that may offer "Reconnect to support". */
965
+ offerReconnect?: boolean;
966
+ /** Local assistant message opened by "Reconnect to support". */
967
+ reconnectOffer?: boolean;
868
968
  /** ISO timestamp for server-originated live events. */
869
969
  createdAt?: string;
870
970
  /** Inline image (e.g. a GIF the visitor sent). Rendered in the bubble. */
871
971
  imageUrl?: string;
872
972
  /** Name of a file the visitor attached (rendered as a chip on their bubble). */
873
973
  attachmentName?: string;
974
+ /** The stored attachment behind attachmentName, for preview. */
975
+ attachmentId?: string;
976
+ /** Every file sent with this message (newer messages; older ones use
977
+ * attachmentName / attachmentId). */
978
+ attachments?: MessageAttachment[];
874
979
  sources?: Source[];
875
980
  suggestedReplies?: string[];
876
981
  availableActions?: string[];
@@ -956,7 +1061,7 @@ interface BootstrapInfo {
956
1061
  offline?: boolean;
957
1062
  /** Book-a-demo scheduler status (present only when book-a-demo is enabled).
958
1063
  * Drives the demo UX: event-mode → in-widget slot picker that creates a real
959
- * calendar event; link-mode → a "Book on Calendly" link; absent/!connected →
1064
+ * calendar event or Calendly invitee; link-mode → a hosted scheduler; absent/!connected →
960
1065
  * slot picker that just files a request for staff to confirm. */
961
1066
  scheduler?: SchedulerInfo;
962
1067
  }
@@ -981,4 +1086,4 @@ interface SchedulerInfo {
981
1086
  };
982
1087
  }
983
1088
  //#endregion
984
- 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 };
1089
+ export { WidgetStrings as C, StringsProvider as S, DemoSlotsResult as _, MessageAttachment as a, PublicChatActionField as b, Visitor as c, WidgetHandle as d, WidgetThemeTokens as f, DemoBooking as g, AnalyticsVisualization as h, FeaturedLink as i, 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, GifResult as v, Transport as x, PublicChatAction as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accurix/centrinfo-widget",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -54,12 +54,13 @@
54
54
  "vite": "^7.0.0",
55
55
  "vitest": "^3.2.0",
56
56
  "wrangler": "^4.91.0",
57
- "@accurix/web-config-eslint": "^0.0.0",
58
- "@accurix/centrinfo-results": "^0.1.0"
57
+ "@accurix/centrinfo-results": "^0.1.0",
58
+ "@accurix/centrinfo-voice": "^0.1.0",
59
+ "@accurix/web-config-eslint": "^0.0.0"
59
60
  },
60
61
  "module": "./dist/index.mjs",
61
62
  "peerDependencies": {
62
- "@accurix/centrinfo": "^0.4.0"
63
+ "@accurix/centrinfo": "^0.5.0"
63
64
  },
64
65
  "publishConfig": {
65
66
  "access": "public",