@memori.ai/memori-react 8.15.0 → 8.16.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/components/Chat/Chat.css +2 -1
  3. package/dist/components/Chat/Chat.js +17 -17
  4. package/dist/components/Chat/Chat.js.map +1 -1
  5. package/dist/components/ChatBubble/ChatBubble.css +1 -1
  6. package/dist/components/ContentPreviewModal/ContentPreviewModal.css +114 -0
  7. package/dist/components/ContentPreviewModal/ContentPreviewModal.d.ts +14 -0
  8. package/dist/components/ContentPreviewModal/ContentPreviewModal.js +18 -0
  9. package/dist/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -0
  10. package/dist/components/ContentPreviewModal/index.d.ts +2 -0
  11. package/dist/components/ContentPreviewModal/index.js +9 -0
  12. package/dist/components/ContentPreviewModal/index.js.map +1 -0
  13. package/dist/components/FilePreview/FilePreview.css +1 -1
  14. package/dist/components/FilePreview/FilePreview.js +43 -13
  15. package/dist/components/FilePreview/FilePreview.js.map +1 -1
  16. package/dist/components/MediaWidget/DocumentCard.d.ts +3 -0
  17. package/dist/components/MediaWidget/DocumentCard.js +9 -0
  18. package/dist/components/MediaWidget/DocumentCard.js.map +1 -0
  19. package/dist/components/MediaWidget/MediaItemWidget.css +946 -19
  20. package/dist/components/MediaWidget/MediaItemWidget.d.ts +5 -36
  21. package/dist/components/MediaWidget/MediaItemWidget.js +295 -198
  22. package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
  23. package/dist/components/MediaWidget/MediaItemWidget.types.d.ts +62 -0
  24. package/dist/components/MediaWidget/MediaItemWidget.types.js +3 -0
  25. package/dist/components/MediaWidget/MediaItemWidget.types.js.map +1 -0
  26. package/dist/components/MediaWidget/MediaItemWidget.utils.d.ts +23 -0
  27. package/dist/components/MediaWidget/MediaItemWidget.utils.js +162 -0
  28. package/dist/components/MediaWidget/MediaItemWidget.utils.js.map +1 -0
  29. package/dist/components/MediaWidget/MediaPreviewModal.d.ts +15 -0
  30. package/dist/components/MediaWidget/MediaPreviewModal.js +162 -0
  31. package/dist/components/MediaWidget/MediaPreviewModal.js.map +1 -0
  32. package/dist/components/MediaWidget/MediaWidget.js +1 -2
  33. package/dist/components/MediaWidget/MediaWidget.js.map +1 -1
  34. package/dist/components/Snippet/Snippet.css +64 -33
  35. package/dist/components/Snippet/Snippet.js +17 -4
  36. package/dist/components/Snippet/Snippet.js.map +1 -1
  37. package/dist/components/StartPanel/StartPanel.js +1 -2
  38. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  39. package/dist/components/UploadButton/UploadButton.css +0 -5
  40. package/dist/components/layouts/WebsiteAssistant.js +8 -8
  41. package/dist/components/layouts/WebsiteAssistant.js.map +1 -1
  42. package/dist/components/layouts/chat.css +1 -1
  43. package/dist/components/layouts/website-assistant.css +405 -197
  44. package/dist/helpers/constants.js +0 -7
  45. package/dist/helpers/constants.js.map +1 -1
  46. package/dist/helpers/utils.d.ts +1 -0
  47. package/dist/helpers/utils.js +3 -1
  48. package/dist/helpers/utils.js.map +1 -1
  49. package/dist/index.js +50 -6
  50. package/dist/index.js.map +1 -1
  51. package/dist/styles.css +0 -2
  52. package/dist/version.d.ts +1 -0
  53. package/dist/version.js +5 -0
  54. package/dist/version.js.map +1 -0
  55. package/esm/components/Chat/Chat.css +2 -1
  56. package/esm/components/Chat/Chat.js +17 -17
  57. package/esm/components/Chat/Chat.js.map +1 -1
  58. package/esm/components/ChatBubble/ChatBubble.css +1 -1
  59. package/esm/components/ContentPreviewModal/ContentPreviewModal.css +114 -0
  60. package/esm/components/ContentPreviewModal/ContentPreviewModal.d.ts +14 -0
  61. package/esm/components/ContentPreviewModal/ContentPreviewModal.js +15 -0
  62. package/esm/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -0
  63. package/esm/components/ContentPreviewModal/index.d.ts +2 -0
  64. package/esm/components/ContentPreviewModal/index.js +2 -0
  65. package/esm/components/ContentPreviewModal/index.js.map +1 -0
  66. package/esm/components/FilePreview/FilePreview.css +1 -1
  67. package/esm/components/FilePreview/FilePreview.js +44 -14
  68. package/esm/components/FilePreview/FilePreview.js.map +1 -1
  69. package/esm/components/MediaWidget/DocumentCard.d.ts +3 -0
  70. package/esm/components/MediaWidget/DocumentCard.js +5 -0
  71. package/esm/components/MediaWidget/DocumentCard.js.map +1 -0
  72. package/esm/components/MediaWidget/MediaItemWidget.css +946 -19
  73. package/esm/components/MediaWidget/MediaItemWidget.d.ts +5 -36
  74. package/esm/components/MediaWidget/MediaItemWidget.js +296 -197
  75. package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
  76. package/esm/components/MediaWidget/MediaItemWidget.types.d.ts +62 -0
  77. package/esm/components/MediaWidget/MediaItemWidget.types.js +2 -0
  78. package/esm/components/MediaWidget/MediaItemWidget.types.js.map +1 -0
  79. package/esm/components/MediaWidget/MediaItemWidget.utils.d.ts +23 -0
  80. package/esm/components/MediaWidget/MediaItemWidget.utils.js +149 -0
  81. package/esm/components/MediaWidget/MediaItemWidget.utils.js.map +1 -0
  82. package/esm/components/MediaWidget/MediaPreviewModal.d.ts +15 -0
  83. package/esm/components/MediaWidget/MediaPreviewModal.js +157 -0
  84. package/esm/components/MediaWidget/MediaPreviewModal.js.map +1 -0
  85. package/esm/components/MediaWidget/MediaWidget.js +1 -2
  86. package/esm/components/MediaWidget/MediaWidget.js.map +1 -1
  87. package/esm/components/Snippet/Snippet.css +64 -33
  88. package/esm/components/Snippet/Snippet.js +18 -5
  89. package/esm/components/Snippet/Snippet.js.map +1 -1
  90. package/esm/components/StartPanel/StartPanel.js +1 -2
  91. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  92. package/esm/components/UploadButton/UploadButton.css +0 -5
  93. package/esm/components/layouts/WebsiteAssistant.js +8 -8
  94. package/esm/components/layouts/WebsiteAssistant.js.map +1 -1
  95. package/esm/components/layouts/chat.css +1 -1
  96. package/esm/components/layouts/website-assistant.css +405 -197
  97. package/esm/helpers/constants.js +0 -7
  98. package/esm/helpers/constants.js.map +1 -1
  99. package/esm/helpers/utils.d.ts +1 -0
  100. package/esm/helpers/utils.js +1 -0
  101. package/esm/helpers/utils.js.map +1 -1
  102. package/esm/index.js +50 -6
  103. package/esm/index.js.map +1 -1
  104. package/esm/styles.css +0 -2
  105. package/esm/version.d.ts +1 -0
  106. package/esm/version.js +2 -0
  107. package/esm/version.js.map +1 -0
  108. package/package.json +5 -3
  109. package/src/components/Chat/Chat.css +2 -1
  110. package/src/components/Chat/Chat.stories.tsx +124 -0
  111. package/src/components/Chat/Chat.tsx +72 -71
  112. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +567 -1034
  113. package/src/components/ChatBubble/ChatBubble.css +1 -1
  114. package/src/components/ContentPreviewModal/ContentPreviewModal.css +114 -0
  115. package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +69 -0
  116. package/src/components/ContentPreviewModal/index.ts +2 -0
  117. package/src/components/FilePreview/FilePreview.css +1 -1
  118. package/src/components/FilePreview/FilePreview.tsx +60 -37
  119. package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +15 -105
  120. package/src/components/MediaWidget/DocumentCard.test.tsx +45 -0
  121. package/src/components/MediaWidget/DocumentCard.tsx +19 -0
  122. package/src/components/MediaWidget/MediaItemWidget.css +946 -19
  123. package/src/components/MediaWidget/MediaItemWidget.test.tsx +89 -1
  124. package/src/components/MediaWidget/MediaItemWidget.tsx +734 -461
  125. package/src/components/MediaWidget/MediaItemWidget.types.ts +65 -0
  126. package/src/components/MediaWidget/MediaItemWidget.utils.test.ts +324 -0
  127. package/src/components/MediaWidget/MediaItemWidget.utils.ts +194 -0
  128. package/src/components/MediaWidget/MediaPreviewModal.test.tsx +271 -0
  129. package/src/components/MediaWidget/MediaPreviewModal.tsx +423 -0
  130. package/src/components/MediaWidget/MediaWidget.stories.tsx +193 -0
  131. package/src/components/MediaWidget/MediaWidget.tsx +2 -4
  132. package/src/components/MediaWidget/__snapshots__/DocumentCard.test.tsx.snap +24 -0
  133. package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +162 -170
  134. package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +21 -63
  135. package/src/components/Snippet/Snippet.css +64 -33
  136. package/src/components/Snippet/Snippet.tsx +30 -21
  137. package/src/components/Snippet/__snapshots__/Snippet.test.tsx.snap +314 -297
  138. package/src/components/StartPanel/StartPanel.tsx +0 -9
  139. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +12 -636
  140. package/src/components/UploadButton/UploadButton.css +0 -5
  141. package/src/components/layouts/WebsiteAssistant.tsx +66 -62
  142. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +1 -53
  143. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +2 -106
  144. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +1 -53
  145. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +1 -53
  146. package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +32 -33
  147. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +1 -53
  148. package/src/components/layouts/chat.css +1 -1
  149. package/src/components/layouts/layouts.stories.tsx +68 -0
  150. package/src/components/layouts/website-assistant.css +405 -197
  151. package/src/helpers/constants.ts +0 -7
  152. package/src/helpers/utils.ts +4 -0
  153. package/src/index.test.tsx +8 -0
  154. package/src/index.tsx +55 -5
  155. package/src/styles.css +0 -2
  156. package/src/version.ts +2 -0
  157. package/src/components/AttachmentLinkModal/AttachmentLinkModal.css +0 -68
  158. package/src/components/AttachmentLinkModal/AttachmentLinkModal.stories.tsx +0 -32
  159. package/src/components/AttachmentLinkModal/AttachmentLinkModal.test.tsx +0 -10
  160. package/src/components/AttachmentLinkModal/AttachmentLinkModal.tsx +0 -131
  161. package/src/components/AttachmentLinkModal/__snapshots__/AttachmentLinkModal.test.tsx.snap +0 -9
  162. package/src/components/MediaWidget/LinkItemWidget.css +0 -46
  163. package/src/components/MediaWidget/LinkItemWidget.stories.tsx +0 -61
  164. package/src/components/MediaWidget/LinkItemWidget.test.tsx +0 -33
  165. package/src/components/MediaWidget/LinkItemWidget.tsx +0 -204
  166. package/src/components/MediaWidget/__snapshots__/LinkItemWidget.test.tsx.snap +0 -253
@@ -5,199 +5,302 @@ const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
7
  const media_1 = require("../../helpers/media");
8
+ const utils_1 = require("../../helpers/utils");
8
9
  const translations_1 = require("../../helpers/translations");
9
10
  const constants_1 = require("../../helpers/constants");
10
11
  const ModelViewer_1 = tslib_1.__importDefault(require("../CustomGLBModelViewer/ModelViewer"));
11
12
  const Snippet_1 = tslib_1.__importDefault(require("../Snippet/Snippet"));
12
13
  const Card_1 = tslib_1.__importDefault(require("../ui/Card"));
13
- const Modal_1 = tslib_1.__importDefault(require("../ui/Modal"));
14
- const Button_1 = tslib_1.__importDefault(require("../ui/Button"));
15
14
  const File_1 = tslib_1.__importDefault(require("../icons/File"));
16
- const FilePdf_1 = tslib_1.__importDefault(require("../icons/FilePdf"));
17
- const FileExcel_1 = tslib_1.__importDefault(require("../icons/FileExcel"));
18
- const FileWord_1 = tslib_1.__importDefault(require("../icons/FileWord"));
19
- const Copy_1 = tslib_1.__importDefault(require("../icons/Copy"));
20
15
  const react_2 = require("@headlessui/react");
21
- const utils_1 = require("../../helpers/utils");
22
16
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
23
- const RenderMediaItem = ({ isChild = false, item, sessionID, tenantID, preview = false, baseURL, apiURL, onClick, customMediaRenderer, }) => {
24
- var _a, _b;
25
- const [modalOpen, setModalOpen] = (0, react_1.useState)(false);
17
+ const Sound_1 = tslib_1.__importDefault(require("../icons/Sound"));
18
+ const Link_1 = tslib_1.__importDefault(require("../icons/Link"));
19
+ const ellipsed_1 = require("ellipsed");
20
+ const MediaItemWidget_utils_1 = require("./MediaItemWidget.utils");
21
+ const DocumentCard_1 = require("./DocumentCard");
22
+ const MediaPreviewModal_1 = require("./MediaPreviewModal");
23
+ const CODE_MIME_TYPES = constants_1.prismSyntaxLangs.map(l => l.mimeType);
24
+ const IMAGE_MODAL_MIME_TYPES = [
25
+ 'image/jpeg',
26
+ 'image/png',
27
+ 'image/jpg',
28
+ 'image/gif',
29
+ ];
30
+ function isImageMime(mimeType) {
31
+ return IMAGE_MODAL_MIME_TYPES.includes(mimeType);
32
+ }
33
+ exports.RenderMediaItem = (0, react_1.memo)(function RenderMediaItem({ isChild: _isChild = false, item, sessionID, tenantID, preview = false, baseURL, apiURL, onClick: _onClick, customMediaRenderer, descriptionOneLine = false, onLinkPreviewInfo, }) {
34
+ var _a, _b, _c, _d;
26
35
  const [copyNotification, setCopyNotification] = (0, react_1.useState)(false);
27
36
  const [imageError, setImageError] = (0, react_1.useState)(false);
28
- const url = (0, media_1.getResourceUrl)({
37
+ const [link, setLink] = (0, react_1.useState)(null);
38
+ const onLinkPreviewInfoRef = (0, react_1.useRef)(onLinkPreviewInfo);
39
+ onLinkPreviewInfoRef.current = onLinkPreviewInfo;
40
+ const resourceUrl = (0, media_1.getResourceUrl)({
29
41
  resourceURI: item.url,
30
42
  sessionID,
31
43
  tenantID,
32
44
  baseURL,
33
45
  apiURL,
34
46
  });
47
+ const normURL = (0, MediaItemWidget_utils_1.normalizeUrl)(item.url);
48
+ (0, react_1.useEffect)(() => {
49
+ if (item.mimeType !== 'text/html' ||
50
+ !normURL ||
51
+ normURL === (link === null || link === void 0 ? void 0 : link.urlKey) ||
52
+ !baseURL) {
53
+ return;
54
+ }
55
+ let cancelled = false;
56
+ (0, MediaItemWidget_utils_1.fetchLinkPreview)(normURL, baseURL).then(siteInfo => {
57
+ if (cancelled)
58
+ return;
59
+ setLink(siteInfo
60
+ ? { ...siteInfo, urlKey: normURL }
61
+ : null);
62
+ if (siteInfo && onLinkPreviewInfoRef.current) {
63
+ onLinkPreviewInfoRef.current(siteInfo);
64
+ }
65
+ });
66
+ return () => {
67
+ cancelled = true;
68
+ };
69
+ }, [item === null || item === void 0 ? void 0 : item.url, baseURL, item.mimeType, normURL, link === null || link === void 0 ? void 0 : link.urlKey]);
35
70
  const customRenderer = customMediaRenderer === null || customMediaRenderer === void 0 ? void 0 : customMediaRenderer(item.mimeType);
36
71
  if (customRenderer) {
37
72
  return customRenderer;
38
73
  }
39
- const isCodeSnippet = constants_1.prismSyntaxLangs
40
- .map(l => l.mimeType)
41
- .includes(item.mimeType);
74
+ const isCodeSnippet = CODE_MIME_TYPES.includes(item.mimeType);
42
75
  const isHTML = item.mimeType === 'text/html';
43
- const isImageRGB = ((_a = item.url) === null || _a === void 0 ? void 0 : _a.startsWith('rgb(')) || ((_b = item.url) === null || _b === void 0 ? void 0 : _b.startsWith('rgba('));
44
- const isValidUrl = (urlString) => {
45
- if (!urlString)
46
- return false;
47
- try {
48
- new URL(urlString);
49
- return true;
50
- }
51
- catch (_a) {
52
- return false;
53
- }
54
- };
55
- const getImageSrc = () => {
56
- var _a, _b;
57
- if (isValidUrl(url) || isValidUrl(item.url)) {
58
- return url || item.url;
59
- }
60
- else if (((_a = item.url) === null || _a === void 0 ? void 0 : _a.startsWith('rgb(')) || ((_b = item.url) === null || _b === void 0 ? void 0 : _b.startsWith('rgba('))) {
61
- return item.url;
62
- }
63
- else if (item.content) {
64
- return `data:${item.mimeType};base64,${item.content}`;
65
- }
66
- return undefined;
67
- };
68
- const imageSrc = getImageSrc();
69
- const fallbackImage = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iI2YwZjBmMCIvPjx0ZXh0IHg9IjUwJSIgeT0iNTAlIiBmb250LWZhbWlseT0iQXJpYWwsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiM5OTk5OTkiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGR5PSIuM2VtIj5JbWFnZSBub3QgYXZhaWxhYmxlPC90ZXh0Pjwvc3ZnPg==';
70
- const renderMediaContent = (item) => {
71
- switch (item.mimeType) {
76
+ const isDocumentAttachment = ((_a = item.properties) === null || _a === void 0 ? void 0 : _a.isDocumentAttachment) === true;
77
+ const isAttachedFile = ((_b = item.properties) === null || _b === void 0 ? void 0 : _b.isAttachedFile) === true;
78
+ const imageDisplay = (0, MediaItemWidget_utils_1.getImageDisplaySource)(item, resourceUrl);
79
+ const { src: imageSrc, isRgb: isImageRGB } = imageDisplay;
80
+ const linkTitle = item.title && item.title.length > 0 ? item.title : link === null || link === void 0 ? void 0 : link.title;
81
+ const linkDescription = link === null || link === void 0 ? void 0 : link.description;
82
+ const linkVideo = link === null || link === void 0 ? void 0 : link.video;
83
+ const linkImage = (_c = link === null || link === void 0 ? void 0 : link.image) !== null && _c !== void 0 ? _c : (_d = link === null || link === void 0 ? void 0 : link.images) === null || _d === void 0 ? void 0 : _d[0];
84
+ const renderMediaContent = (0, react_1.useCallback)((medium) => {
85
+ const url = (0, media_1.getResourceUrl)({
86
+ resourceURI: medium.url,
87
+ sessionID,
88
+ tenantID,
89
+ baseURL,
90
+ apiURL,
91
+ });
92
+ switch (medium.mimeType) {
72
93
  case 'image/jpeg':
73
94
  case 'image/png':
74
95
  case 'image/jpg':
75
96
  case 'image/gif':
76
- return isImageRGB ? ((0, jsx_runtime_1.jsxs)("picture", { className: "memori-media-item--figure", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--rgb-item", style: {
77
- backgroundColor: item.url,
78
- } }), item.title && ((0, jsx_runtime_1.jsx)("figcaption", { className: "memori-media-item--figure-caption", children: item.title }))] })) : ((0, jsx_runtime_1.jsxs)("picture", { className: "memori-media-item--figure", children: [!preview && imageSrc && ((0, jsx_runtime_1.jsx)("source", { srcSet: imageSrc, type: item.mimeType })), (0, jsx_runtime_1.jsx)("img", { alt: item.title, src: imageError || !imageSrc ? fallbackImage : imageSrc, onError: () => setImageError(true) }), item.title && ((0, jsx_runtime_1.jsx)("figcaption", { className: "memori-media-item--figure-caption", children: item.title }))] }));
79
- case 'application/msword':
80
- case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
81
- return (0, jsx_runtime_1.jsx)(FileWord_1.default, { className: "memori-media-item--icon" });
82
- case 'application/vnd.ms-excel':
83
- case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
84
- return (0, jsx_runtime_1.jsx)(FileExcel_1.default, { className: "memori-media-item--icon" });
85
- case 'application/pdf':
86
- return (0, jsx_runtime_1.jsx)(FilePdf_1.default, { className: "memori-media-item--icon" });
97
+ return isImageRGB ? ((0, jsx_runtime_1.jsx)("picture", { className: "memori-media-item--figure", children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--rgb-item", style: { backgroundColor: medium.url } }) })) : ((0, jsx_runtime_1.jsxs)("picture", { className: "memori-media-item--figure", children: [!preview && imageSrc && ((0, jsx_runtime_1.jsx)("source", { srcSet: imageSrc, type: medium.mimeType })), (0, jsx_runtime_1.jsx)("img", { alt: medium.title, src: imageError || !imageSrc ? MediaItemWidget_utils_1.FALLBACK_IMAGE_BASE64 : imageSrc, onError: () => setImageError(true) })] }));
87
98
  case 'video/mp4':
88
99
  case 'video/quicktime':
89
100
  case 'video/avi':
90
101
  case 'video/mpeg':
91
- return ((0, jsx_runtime_1.jsxs)("video", { style: { width: '100%', height: '100%' }, controls: true, src: url, title: item.title, children: [item.mimeType === 'video/quicktime' && ((0, jsx_runtime_1.jsx)("source", { src: item.url, type: "video/mp4" })), (0, jsx_runtime_1.jsx)("source", { src: item.url, type: item.mimeType }), "Your browser does not support this video format.", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("a", { href: item.url, target: "_blank", rel: "noopener noreferrer", children: "Download the video" })] }));
102
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "memori-media-item--video-container", children: [(0, jsx_runtime_1.jsxs)("video", { className: "memori-media-item--video-player", controls: true, src: url, title: medium.title, children: [medium.mimeType === 'video/quicktime' && ((0, jsx_runtime_1.jsx)("source", { src: medium.url, type: "video/mp4" })), (0, jsx_runtime_1.jsx)("source", { src: medium.url, type: medium.mimeType }), "Your browser does not support this video format."] }), (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--video-overlay hidden", children: (0, jsx_runtime_1.jsx)("svg", { className: "memori-media-item--play-icon", viewBox: "0 0 24 24", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { d: "M8 5v14l11-7z" }) }) })] }));
92
103
  case 'audio/mpeg3':
93
104
  case 'audio/wav':
94
105
  case 'audio/mpeg':
95
- return ((0, jsx_runtime_1.jsx)("audio", { style: { width: '100%', height: '100%' }, controls: true, src: url }));
106
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "memori-media-item--audio-container", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--audio-icon", children: (0, jsx_runtime_1.jsx)(Sound_1.default, {}) }), (0, jsx_runtime_1.jsx)("audio", { className: "memori-media-item--audio-player", controls: true, src: url })] }));
96
107
  case 'model/gltf-binary':
97
- return ((0, jsx_runtime_1.jsx)(ModelViewer_1.default, { src: url, alt: "", poster: "data:image/png;base64,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" }));
108
+ return ((0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--model-container", children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--model-viewer", children: (0, jsx_runtime_1.jsx)(ModelViewer_1.default, { src: url, alt: "", poster: "data:image/png;base64,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" }) }) }));
109
+ case 'text/html':
110
+ return ((0, jsx_runtime_1.jsx)(DocumentCard_1.DocumentCard, { title: medium.title || 'File', badge: (0, MediaItemWidget_utils_1.getFileExtensionFromMime)(medium.mimeType), meta: (() => {
111
+ const size = (0, MediaItemWidget_utils_1.getContentSize)(medium);
112
+ return size != null && size > 0 ? (0, MediaItemWidget_utils_1.formatBytes)(size) : null;
113
+ })(), icon: (0, jsx_runtime_1.jsx)(Link_1.default, { className: "memori-media-item--document-icon-svg" }) }));
98
114
  default:
99
- return (0, jsx_runtime_1.jsx)(File_1.default, { className: "memori-media-item--icon" });
115
+ return ((0, jsx_runtime_1.jsx)(DocumentCard_1.DocumentCard, { title: medium.title || 'File', badge: (0, MediaItemWidget_utils_1.getFileExtensionFromMime)(medium.mimeType), meta: (() => {
116
+ const size = (0, MediaItemWidget_utils_1.getContentSize)(medium);
117
+ return size != null && size > 0 ? (0, MediaItemWidget_utils_1.formatBytes)(size) : null;
118
+ })(), icon: (0, jsx_runtime_1.jsx)(File_1.default, { className: "memori-media-item--document-icon-svg" }) }));
100
119
  }
101
- };
102
- if ((isCodeSnippet && item.content) || isHTML) {
103
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: "#", onClick: e => {
104
- e.preventDefault();
105
- setModalOpen(true);
106
- }, title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }), (0, jsx_runtime_1.jsx)(Modal_1.default, { open: modalOpen, onClose: () => setModalOpen(false), title: item.title, className: "memori-media-item-preview--modal", width: "80%", widthMd: "90%", children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item-preview--content", children: (0, jsx_runtime_1.jsx)(Snippet_1.default, { medium: item, showCopyButton: true }) }) })] }));
107
- }
108
- if (!item.url &&
109
- (item === null || item === void 0 ? void 0 : item.type) === 'document' &&
110
- item.content &&
111
- !['image/jpeg', 'image/png', 'image/jpg', 'image/gif'].includes(item.mimeType)) {
112
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: "#", onClick: e => {
113
- e.preventDefault();
114
- setModalOpen(true);
115
- }, title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }), (0, jsx_runtime_1.jsx)(Modal_1.default, { open: modalOpen, onClose: () => setModalOpen(false), title: item.title, className: "memori-media-item-preview--modal", width: "60%", widthMd: "70%", footer: (0, jsx_runtime_1.jsx)("div", { style: {
116
- display: 'flex',
117
- justifyContent: 'flex-end',
118
- gap: '0.5rem',
119
- }, children: (0, jsx_runtime_1.jsx)(Button_1.default, { onClick: async () => {
120
- try {
121
- await navigator.clipboard.writeText(item.content || '');
122
- setCopyNotification(true);
123
- setTimeout(() => setCopyNotification(false), 2000);
124
- }
125
- catch (err) {
126
- console.error('Failed to copy content:', err);
127
- }
128
- }, icon: (0, jsx_runtime_1.jsx)(Copy_1.default, {}), children: copyNotification ? 'Copied!' : 'Copy Content' }) }), children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item-preview--content", children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item-preview--text", dangerouslySetInnerHTML: {
129
- __html: (0, utils_1.stripHTML)(item.content || ''),
130
- } }) }) })] }));
131
- }
132
- switch (item.mimeType) {
133
- case 'image/jpeg':
134
- case 'image/png':
135
- case 'image/jpg':
136
- case 'image/gif':
137
- return isImageRGB ? ((0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--image", cover: renderMediaContent(item) })) : ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: imageSrc || '#', onClick: e => {
138
- if (isChild) {
120
+ }, [
121
+ sessionID,
122
+ tenantID,
123
+ baseURL,
124
+ apiURL,
125
+ preview,
126
+ imageSrc,
127
+ imageError,
128
+ isImageRGB,
129
+ linkImage,
130
+ linkVideo,
131
+ ]);
132
+ const fileExtensionFromUrl = (0, MediaItemWidget_utils_1.getFileExtensionFromUrl)(normURL || item.url);
133
+ const fileExtensionFromMime = (0, MediaItemWidget_utils_1.getFileExtensionFromMime)(item.mimeType);
134
+ const fileExtension = fileExtensionFromUrl || fileExtensionFromMime;
135
+ const isFile = (0, MediaItemWidget_utils_1.shouldUseDarkFileCard)(item, fileExtensionFromUrl, item.mimeType);
136
+ const isTextFile = MediaItemWidget_utils_1.TEXT_FILE_EXTENSIONS.includes(fileExtension || '');
137
+ const lineCount = isTextFile && item.content ? (0, MediaItemWidget_utils_1.countLines)(item.content) : null;
138
+ const lineText = lineCount !== null
139
+ ? lineCount === 1
140
+ ? '1 line'
141
+ : `${lineCount} lines`
142
+ : null;
143
+ if (isFile && !isCodeSnippet) {
144
+ const contentSize = (0, MediaItemWidget_utils_1.getContentSize)(item);
145
+ const sizeText = contentSize != null && contentSize > 0 ? (0, MediaItemWidget_utils_1.formatBytes)(contentSize) : null;
146
+ const displayName = item.title || linkTitle || 'File';
147
+ const metaParts = [lineText, sizeText].filter(Boolean);
148
+ const metaLine = metaParts.length > 0 ? metaParts.join(' · ') : null;
149
+ if ((isDocumentAttachment || isAttachedFile) && item.mediumID && _onClick) {
150
+ return ((0, jsx_runtime_1.jsx)("div", { onClick: () => _onClick(item), className: "memori-media-item--link memori-media-item--document-link", style: { cursor: 'pointer' }, title: displayName, role: "button", tabIndex: 0, onKeyDown: e => {
151
+ if (e.key === 'Enter' || e.key === ' ') {
139
152
  e.preventDefault();
153
+ _onClick(item);
140
154
  }
141
- if (onClick) {
142
- e.preventDefault();
143
- onClick(item.mediumID);
155
+ }, children: (0, jsx_runtime_1.jsx)(DocumentCard_1.DocumentCard, { title: displayName, badge: item.mimeType === 'text/html' && !!item.url
156
+ ? 'Link'
157
+ : fileExtension, meta: metaLine, icon: item.mimeType === 'text/html' ? ((0, jsx_runtime_1.jsx)(Link_1.default, { className: "memori-media-item--document-icon-svg" })) : ((0, jsx_runtime_1.jsx)(File_1.default, { className: "memori-media-item--document-icon-svg" })) }) }));
158
+ }
159
+ const getFileCardHref = () => {
160
+ var _a;
161
+ if (item.url) {
162
+ return ((0, media_1.getResourceUrl)({
163
+ resourceURI: item.url,
164
+ sessionID,
165
+ tenantID,
166
+ baseURL,
167
+ apiURL,
168
+ }) ||
169
+ item.url ||
170
+ '#');
171
+ }
172
+ if (isHTML && item.content) {
173
+ let htmlContent = item.content;
174
+ if (((_a = item.properties) === null || _a === void 0 ? void 0 : _a.isDocumentAttachment) ||
175
+ htmlContent.includes('document_attachment') ||
176
+ htmlContent.includes('<document_attachment')) {
177
+ if (htmlContent.includes('&lt;') || htmlContent.includes('&quot;')) {
178
+ const div = document.createElement('div');
179
+ div.innerHTML = htmlContent;
180
+ htmlContent = div.textContent || div.innerText || htmlContent;
144
181
  }
145
- if (!imageSrc || imageError) {
182
+ htmlContent = (0, utils_1.stripDocumentAttachmentTags)(htmlContent);
183
+ }
184
+ const blob = new Blob([htmlContent], { type: 'text/html' });
185
+ return URL.createObjectURL(blob);
186
+ }
187
+ if (item.content) {
188
+ const blob = new Blob([item.content], {
189
+ type: item.mimeType || 'text/plain',
190
+ });
191
+ return URL.createObjectURL(blob);
192
+ }
193
+ return '#';
194
+ };
195
+ const hrefUrl = getFileCardHref();
196
+ return ((0, jsx_runtime_1.jsx)("a", { href: hrefUrl, target: "_blank", rel: "noopener noreferrer", className: "memori-media-item--link memori-media-item--document-link", title: displayName, children: (0, jsx_runtime_1.jsx)(DocumentCard_1.DocumentCard, { title: displayName, badge: item.mimeType === 'text/html' && !!item.url ? 'Link' : fileExtension, meta: metaLine, icon: item.mimeType === 'text/html' ? ((0, jsx_runtime_1.jsx)(Link_1.default, { className: "memori-media-item--document-icon-svg" })) : ((0, jsx_runtime_1.jsx)(File_1.default, { className: "memori-media-item--document-icon-svg" })) }) }));
197
+ }
198
+ if (isCodeSnippet && item.content && item.mediumID && _onClick) {
199
+ return ((0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--link", style: { cursor: 'pointer' }, onClick: () => _onClick(item), title: item.title, role: "button", tabIndex: 0, onKeyDown: e => {
200
+ if (e.key === 'Enter' || e.key === ' ') {
201
+ e.preventDefault();
202
+ _onClick(item);
203
+ }
204
+ }, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }));
205
+ }
206
+ if (isHTML && (linkImage || linkVideo || linkDescription)) {
207
+ const coverSrc = (linkImage === null || linkImage === void 0 ? void 0 : linkImage.includes('data:image')) === true
208
+ ? undefined
209
+ : (linkImage === null || linkImage === void 0 ? void 0 : linkImage.startsWith('https'))
210
+ ? linkImage
211
+ : linkImage
212
+ ? `https://${linkImage.replace('http://', '')}`
213
+ : undefined;
214
+ return ((0, jsx_runtime_1.jsx)("a", { href: item.url || '#', target: "_blank", rel: "noopener noreferrer", className: "memori-media-item--link", title: linkTitle, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: (0, classnames_1.default)('memori-media-item--card', {
215
+ 'memori-media-item--card-description-oneline': descriptionOneLine,
216
+ 'memori-media-item--card-has-image': !!linkImage,
217
+ 'memori-media-item--card-has-video': !!linkVideo,
218
+ }), cover: linkVideo ? ((0, jsx_runtime_1.jsx)("iframe", { width: "100%", height: "100%", src: linkVideo, title: "Video player", frameBorder: "0", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true })) : linkImage ? ((0, jsx_runtime_1.jsx)("img", { className: "memori-media-item--card-cover-img", src: coverSrc, alt: linkTitle })) : ((0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--card-cover-icon", children: (0, jsx_runtime_1.jsx)(Link_1.default, { className: "memori-media-item--icon" }) })), title: linkTitle, description: linkDescription }) }));
219
+ }
220
+ (0, react_1.useEffect)(() => {
221
+ if (!linkDescription)
222
+ return;
223
+ const t = setTimeout(() => {
224
+ (0, ellipsed_1.ellipsis)('.memori-media-item--card .memori-card--description', 3, {
225
+ responsive: true,
226
+ });
227
+ }, 300);
228
+ return () => clearTimeout(t);
229
+ }, [linkDescription, item.mediumID]);
230
+ if (isImageMime(item.mimeType)) {
231
+ if (isImageRGB) {
232
+ return ((0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--image", cover: renderMediaContent(item) }));
233
+ }
234
+ if (item.mediumID && _onClick) {
235
+ return ((0, jsx_runtime_1.jsx)("div", { onClick: () => _onClick(item), className: "memori-media-item--link memori-media-item--image-link", style: { cursor: 'pointer' }, title: item.title, role: "button", tabIndex: 0, onKeyDown: e => {
236
+ if (e.key === 'Enter' || e.key === ' ') {
146
237
  e.preventDefault();
238
+ _onClick(item);
147
239
  }
148
- }, target: "_blank", rel: "noopener noreferrer", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--image", cover: renderMediaContent(item) }) }));
149
- case 'application/msword':
150
- case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
151
- case 'application/vnd.ms-excel':
152
- case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
153
- case 'application/pdf':
154
- return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: url, target: "_blank", rel: "noopener noreferrer", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }));
240
+ }, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--image", cover: renderMediaContent(item) }) }));
241
+ }
242
+ return ((0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--image", cover: renderMediaContent(item) }));
243
+ }
244
+ switch (item.mimeType) {
155
245
  case 'video/mp4':
156
246
  case 'video/quicktime':
157
247
  case 'video/avi':
158
248
  case 'video/mpeg':
159
- return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: url, onClick: e => {
160
- if (isChild) {
161
- e.preventDefault();
162
- }
163
- if (onClick) {
164
- e.preventDefault();
165
- onClick(item.mediumID);
166
- }
167
- }, target: "_blank", rel: "noopener noreferrer", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }));
249
+ return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: resourceUrl || '#', target: "_blank", rel: "noopener noreferrer", title: item.title, children: renderMediaContent(item) }));
168
250
  case 'audio/mpeg3':
169
251
  case 'audio/wav':
170
252
  case 'audio/mpeg':
171
- return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: url, target: "_blank", rel: "noopener noreferrer", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }));
172
253
  case 'model/gltf-binary':
173
- return (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item) });
254
+ if (resourceUrl) {
255
+ return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: resourceUrl, target: "_blank", rel: "noopener noreferrer", title: item.title, children: renderMediaContent(item) }));
256
+ }
257
+ return renderMediaContent(item);
174
258
  default:
175
- return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: url, target: "_blank", rel: "noopener noreferrer", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, cover: renderMediaContent(item), title: item.title }) }));
259
+ return ((0, jsx_runtime_1.jsx)("a", { className: "memori-media-item--link", href: resourceUrl || '#', target: "_blank", rel: "noopener noreferrer", title: item.title, children: renderMediaContent(item) }));
176
260
  }
177
- };
178
- exports.RenderMediaItem = RenderMediaItem;
179
- const countLines = (content) => {
180
- if (!content)
181
- return 0;
182
- return content.split(/\r\n|\r|\n/).length;
183
- };
184
- const RenderSnippetItem = ({ item, sessionID: _sessionID, tenantID: _tenantID, baseURL: _baseURL, apiURL: _apiURL, onClick, }) => {
261
+ });
262
+ exports.RenderSnippetItem = (0, react_1.memo)(function RenderSnippetItem({ item, onClick: _onClick, sessionID, tenantID, baseURL, apiURL, }) {
185
263
  var _a, _b;
186
- const lineCount = countLines(item.content);
264
+ void _onClick;
265
+ const resourceUrl = (0, media_1.getResourceUrl)({
266
+ resourceURI: item.url,
267
+ sessionID,
268
+ tenantID,
269
+ baseURL,
270
+ apiURL,
271
+ });
272
+ const hasUrl = !!(resourceUrl && resourceUrl !== '#');
273
+ const lineCount = (0, MediaItemWidget_utils_1.countLines)(item.content);
187
274
  const contentLength = (_b = (_a = item.content) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
188
275
  const isShortSnippet = lineCount <= 5 && contentLength <= 200;
276
+ const lineText = lineCount === 1 ? '1 riga' : `${lineCount} righe`;
189
277
  if (isShortSnippet) {
190
- return ((0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-direct", children: (0, jsx_runtime_1.jsx)(Card_1.default, { className: "memori-media-item--card memori-media-item--snippet", children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-preview", children: (0, jsx_runtime_1.jsx)(Snippet_1.default, { showCopyButton: true, preview: false, medium: item }) }) }) }));
278
+ return ((0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-direct", children: (0, jsx_runtime_1.jsx)(Card_1.default, { className: "memori-media-item--card memori-media-item--snippet", children: (0, jsx_runtime_1.jsxs)("div", { className: "memori-media-item--snippet-body", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-title", children: item.title }), (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-preview", children: (0, jsx_runtime_1.jsx)(Snippet_1.default, { showCopyButton: true, preview: false, medium: item }) }), (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-header", children: (0, jsx_runtime_1.jsx)("span", { className: "memori-media-item--snippet-meta", children: lineText }) })] }) }) }));
191
279
  }
192
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("a", { href: "#", onClick: e => {
280
+ const snippetHref = hasUrl
281
+ ? resourceUrl
282
+ : item.content
283
+ ? (() => {
284
+ const blob = new Blob([item.content], {
285
+ type: item.mimeType || 'text/plain',
286
+ });
287
+ return URL.createObjectURL(blob);
288
+ })()
289
+ : '#';
290
+ return ((0, jsx_runtime_1.jsx)("div", { onClick: () => {
291
+ if (item.mediumID && _onClick) {
292
+ _onClick(item);
293
+ }
294
+ }, style: { cursor: 'pointer' }, role: "button", tabIndex: 0, onKeyDown: e => {
295
+ if (e.key === 'Enter' || e.key === ' ') {
193
296
  e.preventDefault();
194
- if (onClick) {
195
- onClick(item.mediumID);
297
+ if (item.mediumID && _onClick) {
298
+ _onClick(item);
196
299
  }
197
- }, className: "memori-media-item--link", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--snippet", children: (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-preview", children: (0, jsx_runtime_1.jsx)(Snippet_1.default, { showCopyButton: false, preview: true, medium: item }) }) }) }) }));
198
- };
199
- exports.RenderSnippetItem = RenderSnippetItem;
200
- const MediaItemWidget = ({ items, sessionID, tenantID, translateTo, baseURL, apiURL, customMediaRenderer, fromUser = false, }) => {
300
+ }
301
+ }, className: "memori-media-item--link", title: item.title, children: (0, jsx_runtime_1.jsx)(Card_1.default, { hoverable: true, className: "memori-media-item--card memori-media-item--snippet", children: (0, jsx_runtime_1.jsxs)("div", { className: "memori-media-item--snippet-body", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-title", children: item.title }), (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-preview", children: (0, jsx_runtime_1.jsx)(Snippet_1.default, { showCopyButton: false, preview: true, medium: item }) }), (0, jsx_runtime_1.jsx)("div", { className: "memori-media-item--snippet-header", children: (0, jsx_runtime_1.jsx)("span", { className: "memori-media-item--snippet-meta", children: lineText }) })] }) }) }));
302
+ });
303
+ const MediaItemWidget = ({ items, sessionID, tenantID, translateTo, baseURL, apiURL, customMediaRenderer, fromUser = false, descriptionOneLine = false, onLinkPreviewInfo, }) => {
201
304
  const [media, setMedia] = (0, react_1.useState)(items);
202
305
  const [openModalMedium, setOpenModalMedium] = (0, react_1.useState)();
203
306
  (0, react_1.useEffect)(() => {
@@ -206,82 +309,76 @@ const MediaItemWidget = ({ items, sessionID, tenantID, translateTo, baseURL, api
206
309
  const translateMediaCaptions = (0, react_1.useCallback)(async () => {
207
310
  if (!translateTo)
208
311
  return;
209
- const translatedMedia = await Promise.all((items !== null && items !== void 0 ? items : []).map(async (media) => {
312
+ const translated = await Promise.all((items !== null && items !== void 0 ? items : []).map(async (m) => {
210
313
  var _a;
211
- if (media.title) {
212
- try {
213
- const tTitle = await (0, translations_1.getTranslation)(media.title, translateTo);
214
- return { ...media, title: (_a = tTitle.text) !== null && _a !== void 0 ? _a : media.title };
215
- }
216
- catch (e) {
217
- console.error(e);
218
- return media;
219
- }
314
+ if (!m.title)
315
+ return m;
316
+ try {
317
+ const t = await (0, translations_1.getTranslation)(m.title, translateTo);
318
+ return { ...m, title: (_a = t.text) !== null && _a !== void 0 ? _a : m.title };
220
319
  }
221
- else {
222
- return media;
320
+ catch (e) {
321
+ console.error(e);
322
+ return m;
223
323
  }
224
324
  }));
225
- setMedia(translatedMedia);
325
+ setMedia(translated);
226
326
  }, [translateTo, items]);
227
327
  (0, react_1.useEffect)(() => {
228
328
  if (translateTo)
229
329
  translateMediaCaptions();
230
330
  }, [translateTo, translateMediaCaptions]);
231
- const nonCodeDisplayMedia = media
232
- .filter(m => {
233
- var _a;
234
- return !((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable) &&
235
- !constants_1.prismSyntaxLangs.map(l => l.mimeType).includes(m.mimeType);
236
- })
331
+ const nonCodeDisplayMedia = (0, react_1.useMemo)(() => media
332
+ .filter(m => { var _a; return !((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable) && !CODE_MIME_TYPES.includes(m.mimeType); })
237
333
  .sort((a, b) => {
238
- return a.creationTimestamp > b.creationTimestamp
239
- ? 1
240
- : a.creationTimestamp < b.creationTimestamp
241
- ? -1
242
- : 0;
243
- });
244
- const codeSnippets = media.filter(m => {
245
- var _a;
246
- return !((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable) &&
247
- constants_1.prismSyntaxLangs.map(l => l.mimeType).includes(m.mimeType);
248
- });
249
- const cssExecutableCode = media.filter(m => { var _a; return m.mimeType === 'text/css' && !!((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable); });
250
- return ((0, jsx_runtime_1.jsxs)(react_2.Transition, { appear: true, show: true, as: "div", className: "memori-media-items", children: [!!nonCodeDisplayMedia.length && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('memori-media-items--grid memori-chat-scroll-item', {
334
+ var _a, _b;
335
+ const at = (_a = a.creationTimestamp) !== null && _a !== void 0 ? _a : 0;
336
+ const bt = (_b = b.creationTimestamp) !== null && _b !== void 0 ? _b : 0;
337
+ return at > bt ? 1 : at < bt ? -1 : 0;
338
+ }), [media]);
339
+ const codeSnippets = (0, react_1.useMemo)(() => media.filter(m => { var _a; return !((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable) && CODE_MIME_TYPES.includes(m.mimeType); }), [media]);
340
+ const cssExecutableCode = (0, react_1.useMemo)(() => media.filter(m => { var _a; return m.mimeType === 'text/css' && !!((_a = m.properties) === null || _a === void 0 ? void 0 : _a.executable); }), [media]);
341
+ const imageCount = (0, react_1.useMemo)(() => nonCodeDisplayMedia.filter(m => MediaItemWidget_utils_1.IMAGE_MIME_TYPES.includes(m.mimeType)).length, [nonCodeDisplayMedia]);
342
+ const handleMediaItemClick = (0, react_1.useCallback)((item) => {
343
+ setOpenModalMedium(item);
344
+ }, []);
345
+ const handleSnippetClick = (0, react_1.useCallback)((item) => {
346
+ setOpenModalMedium(item);
347
+ }, []);
348
+ const handleCloseModal = (0, react_1.useCallback)(() => {
349
+ setOpenModalMedium(undefined);
350
+ }, []);
351
+ const handleModalNavigate = (0, react_1.useCallback)((mediumID) => {
352
+ setOpenModalMedium(media.find(m => m.mediumID === mediumID));
353
+ }, [media]);
354
+ return ((0, jsx_runtime_1.jsxs)(react_2.Transition, { appear: true, show: true, as: "div", className: "memori-media-items", children: [nonCodeDisplayMedia.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('memori-media-items--grid memori-chat-scroll-item', {
251
355
  'memori-media-items--user': fromUser,
252
356
  'memori-media-items--agent': !fromUser,
253
- }), children: nonCodeDisplayMedia.map((item, index) => ((0, jsx_runtime_1.jsx)(react_2.Transition.Child, { as: "div", className: "memori-media-item", enter: `ease-out duration-500 delay-${index * 100}`, enterFrom: "opacity-0 scale-95", enterTo: "opacity-1 scale-100", leave: "ease-in duration-300", leaveFrom: "opacity-1 scale-100", leaveTo: "opacity-0 scale-95", children: (0, jsx_runtime_1.jsx)(exports.RenderMediaItem, { isChild: true, sessionID: sessionID, tenantID: tenantID, baseURL: baseURL, apiURL: apiURL, onClick: mediumID => {
254
- setOpenModalMedium(nonCodeDisplayMedia.find(m => m.mediumID === mediumID));
255
- }, item: {
256
- ...item,
257
- title: item.title,
258
- url: item.url,
259
- content: item.content,
260
- type: 'document',
261
- }, customMediaRenderer: customMediaRenderer }) }, item.url + '&index=' + index))) })), !!codeSnippets.length && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('memori-media-items--grid memori-chat-scroll-item', {
357
+ 'memori-media-items--single': imageCount === 1,
358
+ 'memori-media-items--few': imageCount >= 2 && imageCount <= 4,
359
+ 'memori-media-items--many': imageCount >= 5,
360
+ }), children: nonCodeDisplayMedia.map((item, index) => {
361
+ var _a, _b;
362
+ return ((0, jsx_runtime_1.jsx)(react_2.Transition.Child, { as: "div", className: "memori-media-item", enter: `ease-out duration-500 delay-${index * 100}`, enterFrom: "opacity-0 scale-95", enterTo: "opacity-1 scale-100", leave: "ease-in duration-300", leaveFrom: "opacity-1 scale-100", leaveTo: "opacity-0 scale-95", children: (0, jsx_runtime_1.jsx)(exports.RenderMediaItem, { isChild: true, sessionID: sessionID, tenantID: tenantID, baseURL: baseURL, apiURL: apiURL, onClick: handleMediaItemClick, item: {
363
+ ...item,
364
+ title: item.title,
365
+ url: item.url,
366
+ content: item.content,
367
+ type: 'document',
368
+ }, customMediaRenderer: customMediaRenderer, descriptionOneLine: descriptionOneLine, onLinkPreviewInfo: onLinkPreviewInfo }) }, `media-${index}-${(_b = (_a = item.mediumID) !== null && _a !== void 0 ? _a : item.url) !== null && _b !== void 0 ? _b : 'n'}`));
369
+ }) })), codeSnippets.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('memori-media-items--grid memori-chat-scroll-item', {
262
370
  'memori-media-items--user': fromUser,
263
371
  'memori-media-items--agent': !fromUser,
264
- }), children: codeSnippets.map((item, index) => ((0, jsx_runtime_1.jsx)(react_2.Transition.Child, { as: "div", className: "memori-media-item", enter: `ease-out duration-500 delay-${index * 100}`, enterFrom: "opacity-0 scale-95", enterTo: "opacity-1 scale-100", leave: "ease-in duration-300", leaveFrom: "opacity-1 scale-100", leaveTo: "opacity-0 scale-95", children: (0, jsx_runtime_1.jsx)(exports.RenderSnippetItem, { sessionID: sessionID, tenantID: tenantID, baseURL: baseURL, apiURL: apiURL, onClick: mediumID => {
265
- const foundMedium = codeSnippets.find(m => m.mediumID === mediumID);
266
- setOpenModalMedium(foundMedium);
267
- }, item: {
268
- ...item,
269
- title: item.title,
270
- url: item.url,
271
- content: item.content,
272
- type: 'document',
273
- } }) }, item.mediumID + '&index=' + index))) })), cssExecutableCode.map(medium => ((0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: medium.content || '' } }, medium.mediumID))), openModalMedium && ((0, jsx_runtime_1.jsx)(Modal_1.default, { width: "100%", widthMd: "100%", className: "memori-media-item--modal", open: !!openModalMedium, onClose: () => setOpenModalMedium(undefined), footer: null, children: constants_1.prismSyntaxLangs
274
- .map(l => l.mimeType)
275
- .includes(openModalMedium.mimeType) ? ((0, jsx_runtime_1.jsx)("div", { style: {
276
- minHeight: '100%',
277
- background: 'none',
278
- }, className: "memori-media-item-preview--content", children: (0, jsx_runtime_1.jsx)(Snippet_1.default, { preview: false, medium: openModalMedium }) })) : ((0, jsx_runtime_1.jsx)(exports.RenderMediaItem, { isChild: true, sessionID: sessionID, tenantID: tenantID, baseURL: baseURL, apiURL: apiURL, item: {
279
- ...openModalMedium,
280
- title: openModalMedium.title,
281
- url: openModalMedium.url,
282
- content: openModalMedium.content,
283
- type: 'document',
284
- }, customMediaRenderer: customMediaRenderer })) }))] }));
372
+ }), children: codeSnippets.map((item, index) => {
373
+ var _a, _b;
374
+ return ((0, jsx_runtime_1.jsx)(react_2.Transition.Child, { as: "div", className: "memori-media-item", enter: `ease-out duration-500 delay-${index * 100}`, enterFrom: "opacity-0 scale-95", enterTo: "opacity-1 scale-100", leave: "ease-in duration-300", leaveFrom: "opacity-1 scale-100", leaveTo: "opacity-0 scale-95", children: (0, jsx_runtime_1.jsx)(exports.RenderSnippetItem, { sessionID: sessionID, tenantID: tenantID, baseURL: baseURL, apiURL: apiURL, onClick: handleSnippetClick, item: {
375
+ ...item,
376
+ title: item.title,
377
+ url: item.url,
378
+ content: item.content,
379
+ type: 'document',
380
+ } }) }, `snippet-${index}-${(_b = (_a = item.mediumID) !== null && _a !== void 0 ? _a : item.url) !== null && _b !== void 0 ? _b : 'n'}`));
381
+ }) })), cssExecutableCode.map(m => ((0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: m.content || '' } }, m.mediumID))), openModalMedium && ((0, jsx_runtime_1.jsx)(MediaPreviewModal_1.MediaPreviewModal, { medium: openModalMedium, onClose: handleCloseModal, sessionID: sessionID, tenantID: tenantID, baseURL: baseURL, apiURL: apiURL, customMediaRenderer: customMediaRenderer, descriptionOneLine: descriptionOneLine, onLinkPreviewInfo: onLinkPreviewInfo, onMediumClick: handleModalNavigate }))] }));
285
382
  };
286
383
  exports.default = (0, react_1.memo)(MediaItemWidget);
287
384
  //# sourceMappingURL=MediaItemWidget.js.map