@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.
Files changed (50) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/ChatBubble/ChatBubble.js +17 -9
  3. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  4. package/dist/components/MediaWidget/LinkItemWidget.css +1 -0
  5. package/dist/components/MediaWidget/MediaItemWidget.css +10 -0
  6. package/dist/components/MediaWidget/MediaItemWidget.d.ts +6 -2
  7. package/dist/components/MediaWidget/MediaItemWidget.js +49 -11
  8. package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
  9. package/dist/components/MediaWidget/MediaWidget.d.ts +3 -1
  10. package/dist/components/UploadButton/UploadButton.js +16 -5
  11. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  12. package/dist/components/UploadButton/UploadImages/UploadImages.js +7 -16
  13. package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  14. package/dist/components/layouts/HiddenChat.js +1 -16
  15. package/dist/components/layouts/HiddenChat.js.map +1 -1
  16. package/dist/components/ui/Card.d.ts +1 -0
  17. package/dist/components/ui/Card.js +2 -2
  18. package/dist/components/ui/Card.js.map +1 -1
  19. package/esm/components/ChatBubble/ChatBubble.js +17 -9
  20. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  21. package/esm/components/MediaWidget/LinkItemWidget.css +1 -0
  22. package/esm/components/MediaWidget/MediaItemWidget.css +10 -0
  23. package/esm/components/MediaWidget/MediaItemWidget.d.ts +6 -2
  24. package/esm/components/MediaWidget/MediaItemWidget.js +50 -12
  25. package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
  26. package/esm/components/MediaWidget/MediaWidget.d.ts +3 -1
  27. package/esm/components/UploadButton/UploadButton.js +16 -5
  28. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  29. package/esm/components/UploadButton/UploadImages/UploadImages.js +7 -16
  30. package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  31. package/esm/components/layouts/HiddenChat.js +1 -16
  32. package/esm/components/layouts/HiddenChat.js.map +1 -1
  33. package/esm/components/ui/Card.d.ts +1 -0
  34. package/esm/components/ui/Card.js +2 -2
  35. package/esm/components/ui/Card.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/Chat/Chat.stories.tsx +12 -0
  38. package/src/components/ChatBubble/ChatBubble.stories.tsx +203 -26
  39. package/src/components/ChatBubble/ChatBubble.tsx +14 -11
  40. package/src/components/MediaWidget/LinkItemWidget.css +1 -0
  41. package/src/components/MediaWidget/MediaItemWidget.css +10 -0
  42. package/src/components/MediaWidget/MediaItemWidget.tsx +136 -118
  43. package/src/components/MediaWidget/MediaWidget.test.tsx +2 -1
  44. package/src/components/MediaWidget/MediaWidget.tsx +1 -1
  45. package/src/components/UploadButton/UploadButton.tsx +56 -34
  46. package/src/components/UploadButton/UploadImages/UploadImages.tsx +7 -24
  47. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +0 -1
  48. package/src/components/layouts/HiddenChat.tsx +1 -16
  49. package/src/components/layouts/layouts.stories.tsx +1 -0
  50. 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 these files would exceed the limit
138
- const availableSlots = maxImages - currentImageCount;
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
- t('upload.partialUpload', {
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
- // For simplicity, we'll handle one file at a time
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--secondary"
390
+ className="memori-button memori-button--primary"
408
391
  >
409
392
  {t('cancel') ?? 'Cancel'}
410
393
  </Button>
@@ -111,7 +111,6 @@ exports[`renders UploadButton unchanged 1`] = `
111
111
  accept=".jpg,.jpeg,.png"
112
112
  class="memori--upload-file-input"
113
113
  disabled=""
114
- multiple=""
115
114
  type="file"
116
115
  />
117
116
  <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
  };
@@ -417,6 +417,7 @@ HiddenChat.args = {
417
417
  uiLang: 'it',
418
418
  showShare: true,
419
419
  showSettings: true,
420
+ autoStart: true,
420
421
  // memori,
421
422
  // tenant,
422
423
  memori: {
@@ -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>}