@memori.ai/memori-react 7.26.0 → 7.26.2
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/CHANGELOG.md +29 -0
- package/dist/components/ChatBubble/ChatBubble.js +17 -9
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/MediaWidget/LinkItemWidget.css +1 -0
- package/dist/components/MediaWidget/MediaItemWidget.css +10 -0
- package/dist/components/MediaWidget/MediaItemWidget.d.ts +6 -2
- package/dist/components/MediaWidget/MediaItemWidget.js +49 -11
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaWidget.d.ts +3 -1
- package/dist/components/UploadButton/UploadButton.js +16 -5
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadImages/UploadImages.js +7 -16
- package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
- package/dist/components/layouts/HiddenChat.js +1 -16
- package/dist/components/layouts/HiddenChat.js.map +1 -1
- package/dist/components/ui/Card.d.ts +1 -0
- package/dist/components/ui/Card.js +2 -2
- package/dist/components/ui/Card.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +17 -9
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/MediaWidget/LinkItemWidget.css +1 -0
- package/esm/components/MediaWidget/MediaItemWidget.css +10 -0
- package/esm/components/MediaWidget/MediaItemWidget.d.ts +6 -2
- package/esm/components/MediaWidget/MediaItemWidget.js +50 -12
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaWidget.d.ts +3 -1
- package/esm/components/UploadButton/UploadButton.js +16 -5
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadImages/UploadImages.js +7 -16
- package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
- package/esm/components/layouts/HiddenChat.js +1 -16
- package/esm/components/layouts/HiddenChat.js.map +1 -1
- package/esm/components/ui/Card.d.ts +1 -0
- package/esm/components/ui/Card.js +2 -2
- package/esm/components/ui/Card.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.stories.tsx +12 -0
- package/src/components/ChatBubble/ChatBubble.stories.tsx +203 -26
- package/src/components/ChatBubble/ChatBubble.tsx +14 -11
- package/src/components/MediaWidget/LinkItemWidget.css +1 -0
- package/src/components/MediaWidget/MediaItemWidget.css +10 -0
- package/src/components/MediaWidget/MediaItemWidget.tsx +136 -118
- package/src/components/MediaWidget/MediaWidget.test.tsx +2 -1
- package/src/components/MediaWidget/MediaWidget.tsx +1 -1
- package/src/components/UploadButton/UploadButton.tsx +56 -34
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +7 -24
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +0 -1
- package/src/components/layouts/HiddenChat.tsx +1 -16
- package/src/components/layouts/layouts.stories.tsx +1 -0
- package/src/components/ui/Card.tsx +3 -0
|
@@ -134,33 +134,18 @@ const UploadImages: React.FC<UploadImagesProps> = ({
|
|
|
134
134
|
const files = Array.from(e.target.files || []);
|
|
135
135
|
if (files.length === 0) return;
|
|
136
136
|
|
|
137
|
-
// Check if adding
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (availableSlots <= 0) {
|
|
141
|
-
// This check should rarely be needed since the button should be disabled
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// If we can't upload all files, only upload what we can and show warning
|
|
146
|
-
let filesToUpload = files;
|
|
147
|
-
if (files.length > availableSlots) {
|
|
148
|
-
filesToUpload = files.slice(0, availableSlots);
|
|
137
|
+
// Check if adding this file would exceed the limit
|
|
138
|
+
if (currentImageCount >= maxImages) {
|
|
149
139
|
addError({
|
|
150
|
-
message:
|
|
151
|
-
|
|
152
|
-
uploaded: availableSlots,
|
|
153
|
-
total: files.length,
|
|
154
|
-
}) ??
|
|
155
|
-
`Only ${availableSlots} out of ${files.length} images will be uploaded. Maximum ${maxImages} images allowed.`,
|
|
156
|
-
severity: 'warning',
|
|
140
|
+
message: t('upload.maxImagesReached') ?? `Maximum ${maxImages} images allowed.`,
|
|
141
|
+
severity: 'error'
|
|
157
142
|
});
|
|
143
|
+
return;
|
|
158
144
|
}
|
|
159
145
|
|
|
160
146
|
clearErrors();
|
|
161
147
|
|
|
162
|
-
|
|
163
|
-
const file = filesToUpload[0];
|
|
148
|
+
const file = files[0]; // Only handle the first file
|
|
164
149
|
|
|
165
150
|
if (!validateImageFile(file)) {
|
|
166
151
|
if (imageInputRef.current) {
|
|
@@ -170,7 +155,6 @@ const UploadImages: React.FC<UploadImagesProps> = ({
|
|
|
170
155
|
}
|
|
171
156
|
|
|
172
157
|
// Set file and create preview
|
|
173
|
-
console.log('file', file);
|
|
174
158
|
setSelectedFile(file);
|
|
175
159
|
setFilePreview(URL.createObjectURL(file));
|
|
176
160
|
|
|
@@ -322,7 +306,6 @@ const UploadImages: React.FC<UploadImagesProps> = ({
|
|
|
322
306
|
!authToken ||
|
|
323
307
|
currentImageCount >= maxImages
|
|
324
308
|
}
|
|
325
|
-
multiple
|
|
326
309
|
/>
|
|
327
310
|
|
|
328
311
|
{/* Upload image button */}
|
|
@@ -404,7 +387,7 @@ const UploadImages: React.FC<UploadImagesProps> = ({
|
|
|
404
387
|
</Button>
|
|
405
388
|
<Button
|
|
406
389
|
onClick={handleCancelUpload}
|
|
407
|
-
className="memori-button memori-button--
|
|
390
|
+
className="memori-button memori-button--primary"
|
|
408
391
|
>
|
|
409
392
|
{t('cancel') ?? 'Cancel'}
|
|
410
393
|
</Button>
|
|
@@ -12,7 +12,7 @@ const HiddenChatLayout: React.FC<LayoutProps> = ({
|
|
|
12
12
|
headerProps,
|
|
13
13
|
Chat,
|
|
14
14
|
chatProps,
|
|
15
|
-
startPanelProps,
|
|
15
|
+
// startPanelProps,
|
|
16
16
|
sessionId,
|
|
17
17
|
hasUserActivatedSpeak,
|
|
18
18
|
}) => {
|
|
@@ -28,18 +28,6 @@ const HiddenChatLayout: React.FC<LayoutProps> = ({
|
|
|
28
28
|
backgroundColor: '',
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
const initChat = () => {
|
|
32
|
-
try {
|
|
33
|
-
window.speechSynthesis.speak(new SpeechSynthesisUtterance(''));
|
|
34
|
-
} catch (e) {
|
|
35
|
-
console.error(e);
|
|
36
|
-
}
|
|
37
|
-
if (startPanelProps && startPanelProps?.initializeTTS)
|
|
38
|
-
startPanelProps?.initializeTTS();
|
|
39
|
-
if (startPanelProps && startPanelProps?.onClickStart)
|
|
40
|
-
startPanelProps?.onClickStart();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
31
|
useEffect(() => {
|
|
44
32
|
// Check if fullscreen is available
|
|
45
33
|
if (document.fullscreenEnabled) {
|
|
@@ -93,9 +81,6 @@ const HiddenChatLayout: React.FC<LayoutProps> = ({
|
|
|
93
81
|
}
|
|
94
82
|
|
|
95
83
|
setIsOpen(prev => {
|
|
96
|
-
if (!prev) {
|
|
97
|
-
initChat();
|
|
98
|
-
}
|
|
99
84
|
return !prev;
|
|
100
85
|
});
|
|
101
86
|
};
|
|
@@ -10,6 +10,7 @@ export interface Props {
|
|
|
10
10
|
description?: string;
|
|
11
11
|
cover?: JSX.Element | React.ReactNode | string;
|
|
12
12
|
hoverable?: boolean;
|
|
13
|
+
onClick?: () => void;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const Card: FC<Props> = ({
|
|
@@ -20,6 +21,7 @@ const Card: FC<Props> = ({
|
|
|
20
21
|
cover,
|
|
21
22
|
hoverable = false,
|
|
22
23
|
children,
|
|
24
|
+
onClick,
|
|
23
25
|
}) => (
|
|
24
26
|
<div
|
|
25
27
|
className={cx('memori-card', className, {
|
|
@@ -27,6 +29,7 @@ const Card: FC<Props> = ({
|
|
|
27
29
|
'memori-card--with-cover': cover,
|
|
28
30
|
'memori-card--hoverable': hoverable,
|
|
29
31
|
})}
|
|
32
|
+
onClick={onClick}
|
|
30
33
|
>
|
|
31
34
|
<Spin spinning={loading}>
|
|
32
35
|
{cover && <div className="memori-card--cover">{cover}</div>}
|