@epam/ai-dial-attachment-canvas 1.1.0-dev.383 → 1.1.0-dev.389
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/PdfContent-CES32aGU.js +17154 -0
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +8 -0
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/CodeContent/CodeContent.d.ts.map +1 -1
- package/components/PdfContent/PdfContent.d.ts +8 -0
- package/components/PdfContent/PdfContent.d.ts.map +1 -1
- package/download-BBbVchnm.js +119 -0
- package/esm-bFpgu8Tl.js +17407 -0
- package/index.css +1 -1
- package/index.js +13300 -47944
- package/models/attachment-canvas.d.ts +16 -0
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvas/AttachmentCanvas.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"AttachmentCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvas/AttachmentCanvas.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AA2T5E,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,6DAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvasBody.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasBody/AttachmentCanvasBody.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AttachmentCanvasBody.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasBody/AttachmentCanvasBody.tsx"],"names":[],"mappings":"AAkBA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAwYhF,uNAAuN;AACvN,eAAO,MAAM,oBAAoB,iEAAiC,CAAC"}
|
|
@@ -13,6 +13,14 @@ export interface AttachmentCanvasContainerProps {
|
|
|
13
13
|
maxWidth?: number;
|
|
14
14
|
/** Syntax highlight color theme forwarded to MarkdownRenderer code blocks. */
|
|
15
15
|
codeBlockTheme?: CodeBlockTheme;
|
|
16
|
+
/**
|
|
17
|
+
* Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
|
|
18
|
+
* host app. Called once, the first time a PDF attachment is opened. When
|
|
19
|
+
* omitted, `@epam/pdf-highlighter-kit`'s own CDN-hosted worker fallback is
|
|
20
|
+
* used instead, so PDF rendering still works, just without the host's own
|
|
21
|
+
* bundled worker asset.
|
|
22
|
+
*/
|
|
23
|
+
configurePdfWorker?: () => void | Promise<void>;
|
|
16
24
|
}
|
|
17
25
|
/** Context-connected container that renders `AttachmentCanvas` with download support. */
|
|
18
26
|
export declare const AttachmentCanvasContainer: FC<AttachmentCanvasContainerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAoHtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeContent.d.ts","sourceRoot":"","sources":["../../../src/components/CodeContent/CodeContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"CodeContent.d.ts","sourceRoot":"","sources":["../../../src/components/CodeContent/CodeContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAc,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAqBxE,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,wEAAwE;IACxE,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,8FAA8F;AAC9F,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA6C5C,CAAC"}
|
|
@@ -23,6 +23,14 @@ export interface PdfContentProps {
|
|
|
23
23
|
loadPdf?: (url: string) => Promise<Blob>;
|
|
24
24
|
/** File name shown in the canvas header. */
|
|
25
25
|
fileName?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
|
|
28
|
+
* host app. Called once, the first time a PDF attachment is opened. When
|
|
29
|
+
* omitted, `@epam/pdf-highlighter-kit`'s own CDN-hosted worker fallback is
|
|
30
|
+
* used instead, so PDF rendering still works, just without the host's own
|
|
31
|
+
* bundled worker asset.
|
|
32
|
+
*/
|
|
33
|
+
configurePdfWorker?: () => void | Promise<void>;
|
|
26
34
|
/**
|
|
27
35
|
* Hides the underlying `DocumentPreview`'s own title/zoom toolbar row —
|
|
28
36
|
* for hosts that render their own header and don't want it duplicated.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfContent.d.ts","sourceRoot":"","sources":["../../../src/components/PdfContent/PdfContent.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EACL,KAAK,EAAE,EAQR,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PdfContent.d.ts","sourceRoot":"","sources":["../../../src/components/PdfContent/PdfContent.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EACL,KAAK,EAAE,EAQR,MAAM,OAAO,CAAC;AAUf,OAAO,gDAAgD,CAAC;AACxD,OAAO,yDAAyD,CAAC;AAoCjE,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,iGAAiG;IACjG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gHAAgH;IAChH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8GAA8G;IAC9G,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0HAA0H;IAC1H,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yFAAyF;IACzF,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,8GAA8G;AAC9G,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA4Y1C,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { MIMEType as e, ensureDownloadFilename as t, triggerAnchorDownload as n, triggerBlobDownload as r } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
//#region src/types/attachment-canvas.ts
|
|
3
|
+
var i = /* @__PURE__ */ function(e) {
|
|
4
|
+
return e.PlainText = "plain_text", e.Image = "image", e.Audio = "audio", e.Markdown = "markdown", e.Json = "json", e.Pdf = "pdf", e.Ooxml = "ooxml", e.Code = "code", e.Html = "html", e.Visualizer = "visualizer", e.McpApp = "mcp_app", e.Unsupported = "unsupported", e.Error = "error", e;
|
|
5
|
+
}({}), a = /* @__PURE__ */ function(e) {
|
|
6
|
+
return e.Docx = "docx", e.Xlsx = "xlsx", e.Pptx = "pptx", e;
|
|
7
|
+
}({}), o = /* @__PURE__ */ function(e) {
|
|
8
|
+
return e.LoadFailed = "load_failed", e.Forbidden = "forbidden", e;
|
|
9
|
+
}({}), s = {
|
|
10
|
+
[a.Docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
11
|
+
[a.Xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
12
|
+
[a.Pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
13
|
+
}, c = (e) => {
|
|
14
|
+
switch (e.type) {
|
|
15
|
+
case i.PlainText:
|
|
16
|
+
case i.Markdown:
|
|
17
|
+
case i.Json:
|
|
18
|
+
case i.Image:
|
|
19
|
+
case i.Audio:
|
|
20
|
+
case i.Pdf:
|
|
21
|
+
case i.Ooxml:
|
|
22
|
+
case i.Code: return !0;
|
|
23
|
+
case i.Html: return e.url != null;
|
|
24
|
+
case i.Visualizer:
|
|
25
|
+
case i.McpApp: return !1;
|
|
26
|
+
case i.Unsupported: return e.url != null;
|
|
27
|
+
case i.Error: return e.errorType !== o.Forbidden && e.url != null;
|
|
28
|
+
}
|
|
29
|
+
}, l = async (e) => {
|
|
30
|
+
let t = await fetch(e);
|
|
31
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
32
|
+
return t.blob();
|
|
33
|
+
}, u = (t) => {
|
|
34
|
+
switch (t.type) {
|
|
35
|
+
case i.Image: return {
|
|
36
|
+
url: t.url,
|
|
37
|
+
mimeType: void 0
|
|
38
|
+
};
|
|
39
|
+
case i.Audio: return {
|
|
40
|
+
url: t.url,
|
|
41
|
+
mimeType: t.mimeType
|
|
42
|
+
};
|
|
43
|
+
case i.Pdf: return {
|
|
44
|
+
url: t.url,
|
|
45
|
+
mimeType: e.PDF
|
|
46
|
+
};
|
|
47
|
+
case i.Ooxml: return {
|
|
48
|
+
url: t.url,
|
|
49
|
+
mimeType: s[t.format]
|
|
50
|
+
};
|
|
51
|
+
case i.Html: return {
|
|
52
|
+
url: t.url,
|
|
53
|
+
mimeType: e.HTML
|
|
54
|
+
};
|
|
55
|
+
case i.Unsupported:
|
|
56
|
+
case i.Error: return {
|
|
57
|
+
url: t.url,
|
|
58
|
+
mimeType: void 0
|
|
59
|
+
};
|
|
60
|
+
case i.PlainText:
|
|
61
|
+
case i.Code: return {
|
|
62
|
+
url: void 0,
|
|
63
|
+
mimeType: e.Plain
|
|
64
|
+
};
|
|
65
|
+
case i.Markdown: return {
|
|
66
|
+
url: void 0,
|
|
67
|
+
mimeType: e.Markdown
|
|
68
|
+
};
|
|
69
|
+
case i.Json: return {
|
|
70
|
+
url: void 0,
|
|
71
|
+
mimeType: e.JSON
|
|
72
|
+
};
|
|
73
|
+
default: return {
|
|
74
|
+
url: void 0,
|
|
75
|
+
mimeType: void 0
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}, d = (a, o) => {
|
|
79
|
+
let { url: s, mimeType: l } = u(a), d = t(o ?? "attachment", s, l);
|
|
80
|
+
switch (a.type) {
|
|
81
|
+
case i.PlainText:
|
|
82
|
+
if (a.text === "") return;
|
|
83
|
+
r(new Blob([a.text], { type: e.Plain }), d);
|
|
84
|
+
return;
|
|
85
|
+
case i.Markdown:
|
|
86
|
+
if (a.text === "") return;
|
|
87
|
+
r(new Blob([a.text], { type: e.Markdown }), d);
|
|
88
|
+
return;
|
|
89
|
+
case i.Json:
|
|
90
|
+
r(new Blob([JSON.stringify(a.value, null, 2)], { type: e.JSON }), d);
|
|
91
|
+
return;
|
|
92
|
+
case i.Image:
|
|
93
|
+
case i.Audio:
|
|
94
|
+
case i.Pdf:
|
|
95
|
+
case i.Ooxml:
|
|
96
|
+
n(a.url, d);
|
|
97
|
+
return;
|
|
98
|
+
case i.Code:
|
|
99
|
+
if (a.text === "") return;
|
|
100
|
+
r(new Blob([a.text], { type: e.Plain }), d);
|
|
101
|
+
return;
|
|
102
|
+
case i.Html:
|
|
103
|
+
if (a.url == null) return;
|
|
104
|
+
n(a.url, d);
|
|
105
|
+
return;
|
|
106
|
+
case i.Visualizer:
|
|
107
|
+
case i.McpApp: return;
|
|
108
|
+
case i.Unsupported:
|
|
109
|
+
if (a.url == null) return;
|
|
110
|
+
n(a.url, d);
|
|
111
|
+
return;
|
|
112
|
+
case i.Error:
|
|
113
|
+
if (!c(a) || a.url == null) return;
|
|
114
|
+
n(a.url, d);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { o as a, i, l as n, a as o, c as r, d as t };
|