@epam/ai-dial-chat-hooks 1.2.0-dev.3 → 1.2.0-dev.38
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/catalog/map-deployment-to-catalog-item.js +2 -2
- package/catalog/map-skill-to-catalog-item.js +2 -2
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +19 -17
- package/catalog.d.ts +38 -5
- package/catalog.js +14 -14
- package/conversation/announcement-message.js +16 -5
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
- package/conversation/useConversationHandlers/useConversationHandlers.js +13 -17
- package/conversation/useConversationStream/useConversationStream.js +5 -1
- package/conversation/useTranscribeAudio/transcription-retry.js +5 -4
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation.d.ts +33 -8
- package/conversation.js +22 -23
- package/file-manager-canvas.d.ts +398 -0
- package/file-manager-canvas.js +2 -0
- package/file-manager.d.ts +0 -325
- package/file-manager.js +14 -15
- package/files/attachment-canvas.js +51 -13
- package/index.d.ts +144 -14
- package/index.js +109 -109
- package/package.json +26 -16
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { Annotation } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { AnnotationGroup } from '@epam/ai-dial-quotations';
|
|
3
|
+
import { ApplicationVisualizer } from '@epam/ai-dial-chat-shared';
|
|
4
|
+
import { AttachmentResource } from '@epam/ai-dial-chat-shared';
|
|
5
|
+
import { CustomVisualizer } from '@epam/ai-dial-chat-shared';
|
|
6
|
+
import type { CustomVisualizerDataLayout } from '@epam/ai-dial-chat-shared';
|
|
7
|
+
import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
8
|
+
import type { GroupedAttachmentItem } from '@epam/ai-dial-chat-shared';
|
|
9
|
+
import type { InputHighlightData } from '@epam/pdf-highlighter-kit';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Builds an `OoxmlCanvasContent` for a DOCX/PPTX/XLSX citation annotation,
|
|
13
|
+
* including highlights for every annotation sharing the clicked one's source
|
|
14
|
+
* document. Returns `null` when the annotation has no source attachment,
|
|
15
|
+
* the source is not a format `@silurus/ooxml` renders as DOCX/XLSX/PPTX (a
|
|
16
|
+
* CSV source returns `null` — citation highlighting targets Office documents
|
|
17
|
+
* only), or no URL resolves.
|
|
18
|
+
*/
|
|
19
|
+
export declare const annotationToOoxmlCanvasContent: (annotation: Annotation, annotations: Annotation[], resolvers: AttachmentCanvasUrlResolvers) => OoxmlCanvasContent | null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Builds a `PdfCanvasContent` for a PDF citation annotation, including highlights
|
|
23
|
+
* for the clicked annotation's document within its citation group.
|
|
24
|
+
* Returns `null` if the annotation has no PDF source attachment.
|
|
25
|
+
*/
|
|
26
|
+
export declare const annotationToPdfCanvasContent: (annotation: Annotation, groups: AnnotationGroup[], resolvers: AttachmentCanvasUrlResolvers) => PdfCanvasContent | null;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* DIAL-file URL resolution injected by the host into every attachment-canvas
|
|
30
|
+
* content resolver below. Host-owned — encodes the app's own
|
|
31
|
+
* file-download endpoint.
|
|
32
|
+
*/
|
|
33
|
+
export declare interface AttachmentCanvasUrlResolvers {
|
|
34
|
+
/** Resolves a DIAL Core file id to a downloadable URL. */
|
|
35
|
+
resolveDialFileDownloadUrl: (fileId: string) => string | undefined;
|
|
36
|
+
/** Resolves the best downloadable DIAL-file URL from an attachment's `url` or `referenceUrl`. */
|
|
37
|
+
resolveDialUrl: (attachment: DisplayAttachment) => string | undefined;
|
|
38
|
+
/** Resolves a DIAL Core file id to a fetchable metadata URL (used for cache-freshness validation). */
|
|
39
|
+
resolveDialFileMetadataUrl: (fileId: string) => string | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The type of content the canvas can display. */
|
|
43
|
+
declare enum AttachmentContentType {
|
|
44
|
+
PlainText = 'plain_text',
|
|
45
|
+
Image = 'image',
|
|
46
|
+
Audio = 'audio',
|
|
47
|
+
Markdown = 'markdown',
|
|
48
|
+
MarkdownTable = 'markdown_table',
|
|
49
|
+
Json = 'json',
|
|
50
|
+
Pdf = 'pdf',
|
|
51
|
+
Ooxml = 'ooxml',
|
|
52
|
+
Code = 'code',
|
|
53
|
+
Html = 'html',
|
|
54
|
+
Visualizer = 'visualizer',
|
|
55
|
+
GroupedVisualizer = 'grouped_visualizer',
|
|
56
|
+
McpApp = 'mcp_app',
|
|
57
|
+
Unsupported = 'unsupported',
|
|
58
|
+
Error = 'error',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The kind of failure that produced an `ErrorCanvasContent`. */
|
|
62
|
+
declare enum AttachmentErrorType {
|
|
63
|
+
/** The file failed to load (network error or a non-`403` non-OK response). */
|
|
64
|
+
LoadFailed = 'load_failed',
|
|
65
|
+
/** The file request failed with HTTP `403` — the user lacks permission to access it. */
|
|
66
|
+
Forbidden = 'forbidden',
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Clears all cached fetch results. Call this when leaving a conversation. */
|
|
70
|
+
export declare const clearAttachmentCache: () => void;
|
|
71
|
+
|
|
72
|
+
/** Content payload for syntax-highlighted source-code or text file attachments. */
|
|
73
|
+
declare interface CodeCanvasContent {
|
|
74
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
75
|
+
type: AttachmentContentType.Code;
|
|
76
|
+
/** The raw source text to display. */
|
|
77
|
+
text: string;
|
|
78
|
+
/** `react-syntax-highlighter` language identifier (e.g. `'typescript'`). `undefined` renders plain monospace. */
|
|
79
|
+
language?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Content payload for attachments whose file failed to load or that the user cannot access. */
|
|
83
|
+
declare interface ErrorCanvasContent {
|
|
84
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
85
|
+
type: AttachmentContentType.Error;
|
|
86
|
+
/** The kind of failure that occurred. */
|
|
87
|
+
errorType: AttachmentErrorType;
|
|
88
|
+
/** Remote URL of the file, if known. Ignored for download purposes when `errorType` is `Forbidden`. */
|
|
89
|
+
url?: string;
|
|
90
|
+
/** Overrides the default `loadErrorLabel`/`forbiddenErrorLabel` message, for callers whose failed content isn't a generic "file" (e.g. an MCP App). */
|
|
91
|
+
label?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Content payload for an application-scoped grouped visualizer: every attachment a message's visualizer claims, rendered together inside one sandboxed iframe. */
|
|
95
|
+
declare interface GroupedVisualizerCanvasContent {
|
|
96
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
97
|
+
type: AttachmentContentType.GroupedVisualizer;
|
|
98
|
+
/** Iframe `src`, resolved from the matching registry entry's `url`. */
|
|
99
|
+
url: string;
|
|
100
|
+
/** One item per claimed attachment, in the message's attachment order. Each `url` is absolute, resolved by the host. */
|
|
101
|
+
attachments: GroupedAttachmentItem[];
|
|
102
|
+
/** Presentation layout hints (`themeId`, `width`, `height`, `mobileHeight`) shared by every item. */
|
|
103
|
+
layout: CustomVisualizerDataLayout;
|
|
104
|
+
/** postMessage protocol namespace — MUST equal the registry entry's `title`, or the iframe never receives data. */
|
|
105
|
+
visualizerName: string;
|
|
106
|
+
/** Milliseconds to wait for a `send()` request's response before rejecting. From the registry entry; does NOT bound the handshake. */
|
|
107
|
+
requestTimeout?: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Outcome of building a grouped visualizer payload. */
|
|
111
|
+
export declare interface GroupedVisualizerResolution {
|
|
112
|
+
/** The grouped payload, or `null` when no claimed attachment resolved to a URL. */
|
|
113
|
+
content: GroupedVisualizerCanvasContent | null;
|
|
114
|
+
/** The claimed attachments that reached `content.attachments`, in the input's order. The caller returns the rest to the ordinary attachment tray. */
|
|
115
|
+
resolved: DisplayAttachment[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Whether the attachment carries text `resolveAttachmentText` can resolve —
|
|
120
|
+
* inline data, a DIAL download URL, or a locally-picked file. Mirrors that
|
|
121
|
+
* function's source list, so a `null` resolver result can be read as "the text
|
|
122
|
+
* was fetched and rejected" rather than "there was no text to fetch".
|
|
123
|
+
*/
|
|
124
|
+
export declare const hasAttachmentTextSource: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => boolean;
|
|
125
|
+
|
|
126
|
+
/** Content payload for HTML file attachments or external HTML URL sources. */
|
|
127
|
+
declare interface HtmlCanvasContent {
|
|
128
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
129
|
+
type: AttachmentContentType.Html;
|
|
130
|
+
/** Full HTML text rendered via `srcdoc` in a sandboxed iframe. Used for file attachments. */
|
|
131
|
+
srcdoc?: string;
|
|
132
|
+
/** External URL rendered via `src` in a sandboxed iframe. Used for external link sources. */
|
|
133
|
+
url?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Content payload for image attachments. */
|
|
137
|
+
declare interface ImageCanvasContent {
|
|
138
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
139
|
+
type: AttachmentContentType.Image;
|
|
140
|
+
/** URL of the image to display (object URL or resolved download URL). */
|
|
141
|
+
url: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Content payload for JSON file attachments. */
|
|
145
|
+
declare interface JsonCanvasContent {
|
|
146
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
147
|
+
type: AttachmentContentType.Json;
|
|
148
|
+
/** Already-parsed JSON value. The lib never calls JSON.parse. */
|
|
149
|
+
value: unknown;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Content payload for Markdown file attachments. */
|
|
153
|
+
declare interface MarkdownCanvasContent {
|
|
154
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
155
|
+
type: AttachmentContentType.Markdown;
|
|
156
|
+
/** Raw Markdown string to render. */
|
|
157
|
+
text: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Content payload for OOXML document and CSV spreadsheet attachments. */
|
|
161
|
+
declare interface OoxmlCanvasContent {
|
|
162
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
163
|
+
type: AttachmentContentType.Ooxml;
|
|
164
|
+
/** Resolved download URL or object URL for the source file. */
|
|
165
|
+
url: string;
|
|
166
|
+
/** The document format used to select and configure the format-specific renderer. */
|
|
167
|
+
format: OoxmlFileType;
|
|
168
|
+
/** Cited locations to draw over the document. Omitted, never `[]`, when there is nothing to highlight. */
|
|
169
|
+
highlights?: OoxmlHighlight[];
|
|
170
|
+
/** Id of the highlight to navigate to and emphasise. Omitted when the clicked citation resolved to no location. */
|
|
171
|
+
selectedHighlightId?: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** A 1-based cell address, matching `@silurus/ooxml`'s own `CellAddress`. */
|
|
175
|
+
declare interface OoxmlCellAddress {
|
|
176
|
+
/** 1-based row number. */
|
|
177
|
+
row: number;
|
|
178
|
+
/** 1-based column number. */
|
|
179
|
+
col: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** A cited character range inside a DOCX story, addressed by story name and source-tree path. */
|
|
183
|
+
declare interface OoxmlDocxHighlightLocation {
|
|
184
|
+
/** Discriminates this location within `OoxmlHighlightLocation`. */
|
|
185
|
+
kind: OoxmlHighlightKind.DocxTextRange;
|
|
186
|
+
/** Name of the DOCX story the range lives in, as an opaque string (only `'body'` is confirmed upstream). */
|
|
187
|
+
story: string;
|
|
188
|
+
/** Source-tree element indices identifying the paragraph, matched element-wise. */
|
|
189
|
+
path: number[];
|
|
190
|
+
/** Inclusive start character offset within the story's matched text. */
|
|
191
|
+
start: number;
|
|
192
|
+
/** Exclusive end character offset, already converted from the wire's inclusive `end`. */
|
|
193
|
+
endExclusive: number;
|
|
194
|
+
/** The cited text, compared against the text resolved over `[start, endExclusive)`. */
|
|
195
|
+
text: string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** A complete table row in the DOCX body, matched by cell text. */
|
|
199
|
+
declare interface OoxmlDocxTableRowLocation {
|
|
200
|
+
/** Location kind. */
|
|
201
|
+
kind: OoxmlHighlightKind.DocxTableRow;
|
|
202
|
+
/** Plain text of each cell, in column order. */
|
|
203
|
+
cells: string[];
|
|
204
|
+
/** 1-based matching row in document order. */
|
|
205
|
+
occurrence: number;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Supported document formats rendered by the installed `@silurus/ooxml` runtime. */
|
|
209
|
+
declare enum OoxmlFileType {
|
|
210
|
+
Docx = 'docx',
|
|
211
|
+
Xlsx = 'xlsx',
|
|
212
|
+
Pptx = 'pptx',
|
|
213
|
+
Csv = 'csv',
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** One citation's highlight: the locations it resolved to, under a stable id. */
|
|
217
|
+
declare interface OoxmlHighlight {
|
|
218
|
+
/** Stable id, used to mark exactly one highlight selected. */
|
|
219
|
+
id: string;
|
|
220
|
+
/** One or more locations — a single citation may carry several selectors. */
|
|
221
|
+
locations: OoxmlHighlightLocation[];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Discriminates the Office highlight location descriptors an `OoxmlCanvasContent` can carry. */
|
|
225
|
+
declare enum OoxmlHighlightKind {
|
|
226
|
+
/** A character range inside a DOCX story, addressed by story name and source-tree path. */
|
|
227
|
+
DocxTextRange = 'docxTextRange',
|
|
228
|
+
/** A character range inside a single PPTX shape on one slide. */
|
|
229
|
+
PptxTextRange = 'pptxTextRange',
|
|
230
|
+
/** A complete DOCX table row identified by its cell text. */
|
|
231
|
+
DocxTableRow = 'docxTableRow',
|
|
232
|
+
/** A complete PPTX table row identified by its cell text on one slide. */
|
|
233
|
+
PptxTableRow = 'pptxTableRow',
|
|
234
|
+
/** One cell, or a contiguous same-row cell range, on a named XLSX sheet. */
|
|
235
|
+
XlsxCellRange = 'xlsxCellRange',
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** A cited location inside an Office document, in document coordinates. */
|
|
239
|
+
declare type OoxmlHighlightLocation =
|
|
240
|
+
| OoxmlDocxHighlightLocation
|
|
241
|
+
| OoxmlPptxHighlightLocation
|
|
242
|
+
| OoxmlDocxTableRowLocation
|
|
243
|
+
| OoxmlPptxTableRowLocation
|
|
244
|
+
| OoxmlXlsxHighlightLocation;
|
|
245
|
+
|
|
246
|
+
/** A cited character range inside a single shape on one PPTX slide. */
|
|
247
|
+
declare interface OoxmlPptxHighlightLocation {
|
|
248
|
+
/** Discriminates this location within `OoxmlHighlightLocation`. */
|
|
249
|
+
kind: OoxmlHighlightKind.PptxTextRange;
|
|
250
|
+
/** 1-based slide number. */
|
|
251
|
+
slide: number;
|
|
252
|
+
/** Shape identifier, compared as a string against the run's own `shapeId`. */
|
|
253
|
+
shapeId: string;
|
|
254
|
+
/** Inclusive start character offset within the shape's matched text. */
|
|
255
|
+
start: number;
|
|
256
|
+
/** Exclusive end character offset, already converted from the wire's inclusive `end`. */
|
|
257
|
+
endExclusive: number;
|
|
258
|
+
/** The cited text, compared against the text resolved over `[start, endExclusive)`. */
|
|
259
|
+
text: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** A complete table row on one PPTX slide, matched by cell text. */
|
|
263
|
+
declare interface OoxmlPptxTableRowLocation {
|
|
264
|
+
/** Location kind. */
|
|
265
|
+
kind: OoxmlHighlightKind.PptxTableRow;
|
|
266
|
+
/** Plain text of each cell, in column order. */
|
|
267
|
+
cells: string[];
|
|
268
|
+
/** 1-based matching row on the specified slide. */
|
|
269
|
+
occurrence: number;
|
|
270
|
+
/** 1-based slide number. */
|
|
271
|
+
slide: number;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** A cited cell, or contiguous same-row cell range, on a named XLSX sheet. */
|
|
275
|
+
declare interface OoxmlXlsxHighlightLocation {
|
|
276
|
+
/** Discriminates this location within `OoxmlHighlightLocation`. */
|
|
277
|
+
kind: OoxmlHighlightKind.XlsxCellRange;
|
|
278
|
+
/** Sheet name, matched exactly against the workbook's own sheet names. */
|
|
279
|
+
sheet: string;
|
|
280
|
+
/** First cell of the range. 1-based, passed to the viewer unconverted. */
|
|
281
|
+
start: OoxmlCellAddress;
|
|
282
|
+
/** Last cell of the range, on the same row as `start`. Omitted for a single cell. */
|
|
283
|
+
end?: OoxmlCellAddress;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Content payload for PDF file attachments. */
|
|
287
|
+
declare interface PdfCanvasContent {
|
|
288
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
289
|
+
type: AttachmentContentType.Pdf;
|
|
290
|
+
/** Resolved download URL or object URL for the PDF file. */
|
|
291
|
+
url: string;
|
|
292
|
+
/** Highlight regions to render over the PDF pages. */
|
|
293
|
+
highlights?: InputHighlightData[];
|
|
294
|
+
/** ID of the highlight to scroll to and select on initial load. */
|
|
295
|
+
selectedHighlightId?: string;
|
|
296
|
+
/** 1-based page to navigate to on initial load, independent of highlight geometry. */
|
|
297
|
+
page?: number;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** Content payload for plain-text attachments. */
|
|
301
|
+
declare interface PlainTextCanvasContent {
|
|
302
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
303
|
+
type: AttachmentContentType.PlainText;
|
|
304
|
+
/** The raw text to display. */
|
|
305
|
+
text: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Builds a `PdfCanvasContent` for a reference-only attachment whose
|
|
310
|
+
* `reference_url` points at a PDF file (optionally with a `#page=N`
|
|
311
|
+
* fragment), so it can be opened in the canvas and scrolled to the
|
|
312
|
+
* referenced page the same way a regular PDF citation is. Returns `null`
|
|
313
|
+
* when the attachment's `url` does not target a PDF.
|
|
314
|
+
*/
|
|
315
|
+
export declare const referenceAttachmentToPdfCanvasContent: (attachment: AttachmentResource, resolvers: AttachmentCanvasUrlResolvers) => PdfCanvasContent | null;
|
|
316
|
+
|
|
317
|
+
/** Resolves a syntax-highlighted code canvas content payload from a DisplayAttachment, or `null` if unavailable. */
|
|
318
|
+
export declare const resolveCodeCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers, language?: string) => Promise<CodeCanvasContent | ErrorCanvasContent | null>;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Builds the grouped payload for an application-scoped visualizer from the
|
|
322
|
+
* attachments its entry claims, reporting which of them `resolveAbsoluteUrl`
|
|
323
|
+
* could produce a URL for. Unlike the single-attachment resolver this fetches
|
|
324
|
+
* nothing: the grouped protocol hands the visualizer URLs and lets it read
|
|
325
|
+
* them itself, so the URLs must be absolute — a host-relative path would
|
|
326
|
+
* resolve against the iframe's own origin. Producing one is host knowledge,
|
|
327
|
+
* which is why it arrives as a callback rather than being built here.
|
|
328
|
+
*/
|
|
329
|
+
export declare const resolveGroupedVisualizerCanvasContent: (attachments: DisplayAttachment[], resolveAbsoluteUrl: (attachment: DisplayAttachment) => string | undefined, entry: ApplicationVisualizer, themeId: string) => GroupedVisualizerResolution;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Resolves an HTML canvas content payload from a DisplayAttachment.
|
|
333
|
+
* Fetches and inlines the HTML as `srcdoc` when the attachment has a download URL or inline data.
|
|
334
|
+
* Returns `null` if no source is available, or an `ErrorCanvasContent` on fetch failure.
|
|
335
|
+
* Rejects `srcdoc` payloads larger than 1 MiB to prevent browser truncation.
|
|
336
|
+
*/
|
|
337
|
+
export declare const resolveHtmlCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => Promise<HtmlCanvasContent | ErrorCanvasContent | null>;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Resolves an image canvas content payload from a DisplayAttachment without
|
|
341
|
+
* fetching — returns a local blob URL or the BFF download URL directly so the
|
|
342
|
+
* browser cache can be shared with the conversation view's `<img>` element.
|
|
343
|
+
* A local `File` with bytes takes precedence over the DIAL download URL; a
|
|
344
|
+
* 0-byte `File` (the file-manager placeholder) does not. Error detection is
|
|
345
|
+
* delegated to `<img onError>` in the canvas renderer. Returns `null` if no
|
|
346
|
+
* URL source is available.
|
|
347
|
+
*/
|
|
348
|
+
export declare const resolveImageCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => ImageCanvasContent | null;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Resolves a JSON canvas content payload from a DisplayAttachment, or `null` if unavailable.
|
|
352
|
+
* Falls back to `PlainTextCanvasContent` when the fetched text is not valid JSON.
|
|
353
|
+
*/
|
|
354
|
+
export declare const resolveJsonCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => Promise<JsonCanvasContent | PlainTextCanvasContent | ErrorCanvasContent | null>;
|
|
355
|
+
|
|
356
|
+
/** Resolves a Markdown canvas content payload from a DisplayAttachment, or `null` if unavailable. */
|
|
357
|
+
export declare const resolveMarkdownCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => Promise<MarkdownCanvasContent | ErrorCanvasContent | null>;
|
|
358
|
+
|
|
359
|
+
/** Resolves an OOXML or CSV renderer payload from a DisplayAttachment, or `null` if unavailable. */
|
|
360
|
+
export declare const resolveOoxmlCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers, format: OoxmlFileType) => Promise<OoxmlCanvasContent | ErrorCanvasContent | null>;
|
|
361
|
+
|
|
362
|
+
/** Resolves a PDF canvas content payload from a DisplayAttachment, or `null` if unavailable. */
|
|
363
|
+
export declare const resolvePdfCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => Promise<PdfCanvasContent | ErrorCanvasContent | null>;
|
|
364
|
+
|
|
365
|
+
/** Resolves a plain-text canvas content payload from a DisplayAttachment, or `null` if unavailable. */
|
|
366
|
+
export declare const resolveTextCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => Promise<PlainTextCanvasContent | ErrorCanvasContent | null>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Fetches the attachment payload and builds a `VisualizerCanvasContent` for the
|
|
370
|
+
* given registry entry and theme. Returns `null` when the payload cannot be
|
|
371
|
+
* fetched (caller should fall through to default content-type handling).
|
|
372
|
+
*
|
|
373
|
+
* Only JSON payloads are parsed into `data`. Non-JSON payloads (plain text,
|
|
374
|
+
* CSV, binary, …) resolve with `data: {}` — the visualizer still receives
|
|
375
|
+
* `mimeType` and `layout`, just no payload body. This is intentional: only
|
|
376
|
+
* JSON attachment content is forwarded to visualizers in this version.
|
|
377
|
+
*/
|
|
378
|
+
export declare const resolveVisualizerCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers, entry: CustomVisualizer, themeId: string) => Promise<VisualizerCanvasContent | null>;
|
|
379
|
+
|
|
380
|
+
/** Content payload for a custom-visualizer attachment rendered inside a sandboxed iframe. */
|
|
381
|
+
declare interface VisualizerCanvasContent {
|
|
382
|
+
/** Discriminates the content type to select the correct renderer. */
|
|
383
|
+
type: AttachmentContentType.Visualizer;
|
|
384
|
+
/** Iframe `src`, resolved from the matching registry entry's `url`. */
|
|
385
|
+
url: string;
|
|
386
|
+
/** The attachment's own MIME type (not the registry entry's raw, possibly comma-separated, `contentType`). */
|
|
387
|
+
mimeType: string;
|
|
388
|
+
/** Opaque attachment payload consumed by the visualizer. */
|
|
389
|
+
data: unknown;
|
|
390
|
+
/** Presentation layout hints (`themeId`, `width`, `height`, `mobileHeight`). */
|
|
391
|
+
layout: CustomVisualizerDataLayout;
|
|
392
|
+
/** postMessage protocol namespace — MUST equal the registry entry's `title`, or the iframe never receives data. */
|
|
393
|
+
visualizerName: string;
|
|
394
|
+
/** Milliseconds to wait for a `send()` request's response before rejecting. From the registry entry; does NOT bound the handshake. */
|
|
395
|
+
requestTimeout?: number;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export { }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { annotationToOoxmlCanvasContent as e, annotationToPdfCanvasContent as t, clearAttachmentCache as n, hasAttachmentTextSource as r, referenceAttachmentToPdfCanvasContent as i, resolveCodeCanvasContent as a, resolveGroupedVisualizerCanvasContent as o, resolveHtmlCanvasContent as s, resolveImageCanvasContent as c, resolveJsonCanvasContent as l, resolveMarkdownCanvasContent as u, resolveOoxmlCanvasContent as d, resolvePdfCanvasContent as f, resolveTextCanvasContent as p, resolveVisualizerCanvasContent as m } from "./files/attachment-canvas.js";
|
|
2
|
+
export { e as annotationToOoxmlCanvasContent, t as annotationToPdfCanvasContent, n as clearAttachmentCache, r as hasAttachmentTextSource, i as referenceAttachmentToPdfCanvasContent, a as resolveCodeCanvasContent, o as resolveGroupedVisualizerCanvasContent, s as resolveHtmlCanvasContent, c as resolveImageCanvasContent, l as resolveJsonCanvasContent, u as resolveMarkdownCanvasContent, d as resolveOoxmlCanvasContent, f as resolvePdfCanvasContent, p as resolveTextCanvasContent, m as resolveVisualizerCanvasContent };
|