@memori.ai/memori-react 8.12.0 → 8.13.1

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 (156) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/Chat/Chat.css +37 -3
  3. package/dist/components/Chat/Chat.js +60 -22
  4. package/dist/components/Chat/Chat.js.map +1 -1
  5. package/dist/components/ChatBubble/ChatBubble.css +9 -5
  6. package/dist/components/ChatBubble/ChatBubble.js +54 -11
  7. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  8. package/dist/components/ChatInputs/ChatInputs.css +293 -17
  9. package/dist/components/ChatInputs/ChatInputs.js +41 -25
  10. package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
  11. package/dist/components/ChatTextArea/ChatTextArea.css +75 -31
  12. package/dist/components/ChatTextArea/ChatTextArea.js +47 -18
  13. package/dist/components/ChatTextArea/ChatTextArea.js.map +1 -1
  14. package/dist/components/FilePreview/FilePreview.css +225 -146
  15. package/dist/components/FilePreview/FilePreview.d.ts +1 -2
  16. package/dist/components/FilePreview/FilePreview.js +20 -6
  17. package/dist/components/FilePreview/FilePreview.js.map +1 -1
  18. package/dist/components/Header/Header.css +2 -2
  19. package/dist/components/Header/Header.js.map +1 -1
  20. package/dist/components/MediaWidget/MediaItemWidget.js +2 -1
  21. package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
  22. package/dist/components/MediaWidget/MediaWidget.css +0 -4
  23. package/dist/components/MemoriWidget/MemoriWidget.css +11 -2
  24. package/dist/components/MemoriWidget/MemoriWidget.js +41 -5
  25. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  26. package/dist/components/MicrophoneButton/MicrophoneButton.css +2 -2
  27. package/dist/components/StartPanel/StartPanel.css +8 -0
  28. package/dist/components/UploadButton/UploadButton.css +20 -17
  29. package/dist/components/UploadButton/UploadButton.js +218 -89
  30. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  31. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -4
  32. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  33. package/dist/components/UploadButton/UploadImages/UploadImages.js +143 -16
  34. package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  35. package/dist/components/layouts/chat.css +1 -1
  36. package/dist/components/ui/Button.css +1 -0
  37. package/dist/helpers/constants.d.ts +1 -0
  38. package/dist/helpers/constants.js +2 -1
  39. package/dist/helpers/constants.js.map +1 -1
  40. package/dist/helpers/imageCompression.d.ts +7 -0
  41. package/dist/helpers/imageCompression.js +123 -0
  42. package/dist/helpers/imageCompression.js.map +1 -0
  43. package/dist/locales/de.json +7 -4
  44. package/dist/locales/en.json +8 -5
  45. package/dist/locales/es.json +7 -4
  46. package/dist/locales/fr.json +7 -4
  47. package/dist/locales/it.json +8 -5
  48. package/dist/styles.css +1 -2
  49. package/esm/components/Chat/Chat.css +37 -3
  50. package/esm/components/Chat/Chat.js +60 -22
  51. package/esm/components/Chat/Chat.js.map +1 -1
  52. package/esm/components/ChatBubble/ChatBubble.css +9 -5
  53. package/esm/components/ChatBubble/ChatBubble.js +54 -11
  54. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  55. package/esm/components/ChatInputs/ChatInputs.css +293 -17
  56. package/esm/components/ChatInputs/ChatInputs.js +42 -26
  57. package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
  58. package/esm/components/ChatTextArea/ChatTextArea.css +75 -31
  59. package/esm/components/ChatTextArea/ChatTextArea.js +49 -20
  60. package/esm/components/ChatTextArea/ChatTextArea.js.map +1 -1
  61. package/esm/components/FilePreview/FilePreview.css +225 -146
  62. package/esm/components/FilePreview/FilePreview.d.ts +1 -2
  63. package/esm/components/FilePreview/FilePreview.js +21 -7
  64. package/esm/components/FilePreview/FilePreview.js.map +1 -1
  65. package/esm/components/Header/Header.css +2 -2
  66. package/esm/components/Header/Header.js.map +1 -1
  67. package/esm/components/MediaWidget/MediaItemWidget.js +2 -1
  68. package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
  69. package/esm/components/MediaWidget/MediaWidget.css +0 -4
  70. package/esm/components/MemoriWidget/MemoriWidget.css +11 -2
  71. package/esm/components/MemoriWidget/MemoriWidget.js +41 -5
  72. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  73. package/esm/components/MicrophoneButton/MicrophoneButton.css +2 -2
  74. package/esm/components/StartPanel/StartPanel.css +8 -0
  75. package/esm/components/UploadButton/UploadButton.css +20 -17
  76. package/esm/components/UploadButton/UploadButton.js +219 -90
  77. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  78. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -4
  79. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  80. package/esm/components/UploadButton/UploadImages/UploadImages.js +143 -16
  81. package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  82. package/esm/components/layouts/chat.css +1 -1
  83. package/esm/components/ui/Button.css +1 -0
  84. package/esm/helpers/constants.d.ts +1 -0
  85. package/esm/helpers/constants.js +1 -0
  86. package/esm/helpers/constants.js.map +1 -1
  87. package/esm/helpers/imageCompression.d.ts +7 -0
  88. package/esm/helpers/imageCompression.js +119 -0
  89. package/esm/helpers/imageCompression.js.map +1 -0
  90. package/esm/locales/de.json +7 -4
  91. package/esm/locales/en.json +8 -5
  92. package/esm/locales/es.json +7 -4
  93. package/esm/locales/fr.json +7 -4
  94. package/esm/locales/it.json +8 -5
  95. package/esm/styles.css +1 -2
  96. package/package.json +1 -1
  97. package/src/__snapshots__/index.test.tsx.snap +5 -5
  98. package/src/components/Chat/Chat.css +37 -3
  99. package/src/components/Chat/Chat.tsx +89 -21
  100. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +672 -732
  101. package/src/components/ChatBubble/ChatBubble.css +9 -5
  102. package/src/components/ChatBubble/ChatBubble.tsx +111 -20
  103. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +4 -4
  104. package/src/components/ChatInputs/ChatInputs.css +293 -17
  105. package/src/components/ChatInputs/ChatInputs.tsx +144 -87
  106. package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +430 -424
  107. package/src/components/ChatTextArea/ChatTextArea.css +75 -31
  108. package/src/components/ChatTextArea/ChatTextArea.test.tsx +1 -16
  109. package/src/components/ChatTextArea/ChatTextArea.tsx +51 -22
  110. package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +9 -72
  111. package/src/components/FilePreview/FilePreview.css +225 -146
  112. package/src/components/FilePreview/FilePreview.tsx +49 -36
  113. package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +2 -2
  114. package/src/components/Header/Header.css +2 -2
  115. package/src/components/Header/Header.tsx +1 -1
  116. package/src/components/MediaWidget/MediaItemWidget.tsx +2 -1
  117. package/src/components/MediaWidget/MediaWidget.css +0 -4
  118. package/src/components/MemoriWidget/MemoriWidget.css +11 -2
  119. package/src/components/MemoriWidget/MemoriWidget.tsx +61 -12
  120. package/src/components/MicrophoneButton/MicrophoneButton.css +2 -2
  121. package/src/components/StartPanel/StartPanel.css +8 -0
  122. package/src/components/UploadButton/UploadButton.css +20 -17
  123. package/src/components/UploadButton/UploadButton.stories.tsx +247 -35
  124. package/src/components/UploadButton/UploadButton.tsx +280 -175
  125. package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +19 -4
  126. package/src/components/UploadButton/UploadImages/UploadImages.tsx +195 -35
  127. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +10 -1
  128. package/src/components/layouts/chat.css +1 -1
  129. package/src/components/ui/Button.css +1 -0
  130. package/src/helpers/constants.ts +1 -1
  131. package/src/helpers/imageCompression.ts +230 -0
  132. package/src/locales/de.json +7 -4
  133. package/src/locales/en.json +8 -5
  134. package/src/locales/es.json +7 -4
  135. package/src/locales/fr.json +7 -4
  136. package/src/locales/it.json +8 -5
  137. package/src/styles.css +1 -2
  138. package/dist/components/SignupForm/SignupForm.d.ts +0 -12
  139. package/dist/components/SignupForm/SignupForm.js +0 -199
  140. package/dist/components/SignupForm/SignupForm.js.map +0 -1
  141. package/dist/components/UploadMenu/UploadMenu.css +0 -47
  142. package/dist/components/UploadMenu/UploadMenu.d.ts +0 -9
  143. package/dist/components/UploadMenu/UploadMenu.js +0 -15
  144. package/dist/components/UploadMenu/UploadMenu.js.map +0 -1
  145. package/esm/components/SignupForm/SignupForm.d.ts +0 -12
  146. package/esm/components/SignupForm/SignupForm.js +0 -196
  147. package/esm/components/SignupForm/SignupForm.js.map +0 -1
  148. package/esm/components/UploadMenu/UploadMenu.css +0 -47
  149. package/esm/components/UploadMenu/UploadMenu.d.ts +0 -9
  150. package/esm/components/UploadMenu/UploadMenu.js +0 -12
  151. package/esm/components/UploadMenu/UploadMenu.js.map +0 -1
  152. package/src/components/UploadMenu/UploadMenu.css +0 -47
  153. package/src/components/UploadMenu/UploadMenu.stories.tsx +0 -66
  154. package/src/components/UploadMenu/UploadMenu.test.tsx +0 -34
  155. package/src/components/UploadMenu/UploadMenu.tsx +0 -68
  156. package/src/components/UploadMenu/__snapshots__/UploadMenu.test.tsx.snap +0 -137
@@ -13,6 +13,15 @@
13
13
  height: calc(100vh - 50px);
14
14
  }
15
15
 
16
+ @media (max-width: 425px) {
17
+ .memori-widget {
18
+ overflow-y: hidden;
19
+ }
20
+ .memori-widget > .memori-spin {
21
+ height: calc(100vh - 100px);
22
+ }
23
+ }
24
+
16
25
  .memori--grid {
17
26
  display: flex;
18
27
  height: calc(100% - 50px);
@@ -26,7 +35,7 @@
26
35
  align-items: flex-start;
27
36
  justify-content: flex-start;
28
37
  overflow-x: visible;
29
- overflow-y: scroll;
38
+ overflow-y: hidden;
30
39
  }
31
40
  }
32
41
 
@@ -192,7 +201,7 @@
192
201
 
193
202
  .memori--conversation-button:active,
194
203
  .memori--conversation-button:focus {
195
- box-shadow: 0 0.2rem 0.33rem #b5b6c4 !important;
204
+ /* box-shadow: 0 0.2rem 0.33rem #b5b6c4 !important; */
196
205
  color: var(--memori-primary) !important;
197
206
  }
198
207
 
@@ -944,8 +944,21 @@ const MemoriWidget = ({
944
944
  }, 500);
945
945
  }
946
946
  });
947
+ } else if (response.resultCode === 500 && response.resultMessage) {
948
+ setHistory(h => [...h, {
949
+ text: 'Error: ' + response.resultMessage,
950
+ emitter: 'system',
951
+ fromUser: false,
952
+ initial: false,
953
+ contextVars: {},
954
+ date: new Date().toISOString(),
955
+ }]);
956
+ } else {
957
+ console.warn('[SEND_MESSAGE]', response);
958
+ return Promise.reject(response);
947
959
  }
948
960
  } catch (error) {
961
+ console.log('error', error);
949
962
  console.error(error);
950
963
  gotError = true;
951
964
 
@@ -1398,7 +1411,6 @@ const MemoriWidget = ({
1398
1411
  continueFromSessionID?: string,
1399
1412
  isSessionExpired?: boolean
1400
1413
  ) => {
1401
-
1402
1414
  // Set loading state while reopening session
1403
1415
  setLoading(true);
1404
1416
 
@@ -1477,7 +1489,10 @@ const MemoriWidget = ({
1477
1489
 
1478
1490
  // Handle successful session initialization
1479
1491
  if (sessionID && currentState && response.resultCode === 0) {
1480
- console.log('[REOPEN_SESSION] Session initialized successfully:', sessionID);
1492
+ console.log(
1493
+ '[REOPEN_SESSION] Session initialized successfully:',
1494
+ sessionID
1495
+ );
1481
1496
  setSessionId(sessionID);
1482
1497
 
1483
1498
  // Update dialog state and history if requested
@@ -1486,13 +1501,19 @@ const MemoriWidget = ({
1486
1501
  setCurrentDialogState(currentState);
1487
1502
 
1488
1503
  if (currentState.emission) {
1489
- console.log('[REOPEN_SESSION] Processing emission:', currentState.emission);
1504
+ console.log(
1505
+ '[REOPEN_SESSION] Processing emission:',
1506
+ currentState.emission
1507
+ );
1490
1508
  // Determine initial status message based on context
1491
1509
  // Show status message only if session expired and there's existing history
1492
- const initialStatus = isSessionExpired && history.length > 1
1493
- ? 'Session Expired, reopening session'
1494
- : (history.length <= 1 ? true : undefined);
1495
-
1510
+ const initialStatus =
1511
+ isSessionExpired && history.length > 1
1512
+ ? 'Session Expired, reopening session'
1513
+ : history.length <= 1
1514
+ ? true
1515
+ : undefined;
1516
+
1496
1517
  // Set initial message or append to existing history
1497
1518
  history.length <= 1
1498
1519
  ? setHistory([
@@ -1501,7 +1522,9 @@ const MemoriWidget = ({
1501
1522
  emitter: currentState.emitter,
1502
1523
  media: currentState.emittedMedia ?? currentState.media,
1503
1524
  fromUser: false,
1504
- initial: (initialStatus === true ? true : (initialStatus || undefined)) as any,
1525
+ initial: (initialStatus === true
1526
+ ? true
1527
+ : initialStatus || undefined) as any,
1505
1528
  contextVars: currentState.contextVars,
1506
1529
  date: currentState.currentDate,
1507
1530
  placeName: currentState.currentPlaceName,
@@ -1517,7 +1540,9 @@ const MemoriWidget = ({
1517
1540
  emitter: currentState.emitter,
1518
1541
  media: currentState.emittedMedia ?? currentState.media,
1519
1542
  fromUser: false,
1520
- initial: (initialStatus === true ? true : (initialStatus || undefined)) as any,
1543
+ initial: (initialStatus === true
1544
+ ? true
1545
+ : initialStatus || undefined) as any,
1521
1546
  contextVars: currentState.contextVars,
1522
1547
  date: currentState.currentDate,
1523
1548
  placeName: currentState.currentPlaceName,
@@ -2647,6 +2672,20 @@ const MemoriWidget = ({
2647
2672
  text: initialQuestion,
2648
2673
  });
2649
2674
 
2675
+ // Handle 500 error from TextEnteredEvent
2676
+ if (response.resultCode === 500 && response.resultMessage) {
2677
+ setHistory(h => [...h, {
2678
+ text: 'Error: ' + response.resultMessage,
2679
+ emitter: 'system',
2680
+ fromUser: false,
2681
+ initial: false,
2682
+ contextVars: {},
2683
+ date: new Date().toISOString(),
2684
+ }]);
2685
+ setMemoriTyping(false);
2686
+ return;
2687
+ }
2688
+
2650
2689
  await translateAndSpeak(
2651
2690
  response.currentState ?? currentState,
2652
2691
  userLang,
@@ -3136,7 +3175,10 @@ const MemoriWidget = ({
3136
3175
  }
3137
3176
  })
3138
3177
  .catch(error => {
3139
- if (!(error instanceof Error) || error.message !== 'AUTH_FAILED') {
3178
+ if (
3179
+ !(error instanceof Error) ||
3180
+ error.message !== 'AUTH_FAILED'
3181
+ ) {
3140
3182
  setGotErrorInOpening(true);
3141
3183
  }
3142
3184
  throw error;
@@ -3312,14 +3354,21 @@ const MemoriWidget = ({
3312
3354
  userToken = token;
3313
3355
  setLocalConfig('loginToken', token);
3314
3356
  // Push a message with initial status to show status message when a new session is created after login
3315
- if (state?.sessionID && state.sessionID !== sessionId && state?.dialogState) {
3357
+ if (
3358
+ state?.sessionID &&
3359
+ state.sessionID !== sessionId &&
3360
+ state?.dialogState
3361
+ ) {
3316
3362
  // Push a message with initial status message showing successful login
3317
3363
  // Only show the chip component, not the emission text
3318
3364
  const username = user?.userName || t('login.user');
3319
3365
  pushMessage({
3320
3366
  text: '', // Empty text so only the chip is visible
3321
3367
  emitter: state.dialogState.emitter,
3322
- media: state.dialogState.emittedMedia ?? state.dialogState.media ?? [],
3368
+ media:
3369
+ state.dialogState.emittedMedia ??
3370
+ state.dialogState.media ??
3371
+ [],
3323
3372
  fromUser: false,
3324
3373
  initial: t('login.successfullyLoggedIn', { username }) as any,
3325
3374
  contextVars: state.dialogState.contextVars,
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
  .memori-chat-inputs--mic svg {
29
- color: var(--memori-primary-text, #fff);
29
+ color: var(--memori-primary, #fff);
30
30
  font-size: 1em;
31
31
  -webkit-user-select: none;
32
32
  user-select: none;
@@ -36,7 +36,7 @@
36
36
  .memori-chat-inputs--mic:active,
37
37
  .memori-chat-inputs--mic:focus {
38
38
  border-color: var(--memori-primary) !important;
39
- color: var(--memori-primary-text, #fff);
39
+ color: var(--memori-primary, #fff);
40
40
  }
41
41
 
42
42
  .memori-chat-inputs--mic:active,
@@ -133,7 +133,14 @@
133
133
  }
134
134
 
135
135
  .memori--start-button {
136
+ position: relative;
137
+ overflow: hidden;
138
+ min-width: 140px;
139
+ min-height: 42px;
140
+ border-radius: 8px;
136
141
  margin-right: 1em;
142
+ font-weight: 600;
143
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
137
144
  }
138
145
 
139
146
  .memori--language-chooser {
@@ -263,3 +270,4 @@
263
270
  .memori--privacy-tooltip-content-list {
264
271
  padding-left: 1rem;
265
272
  }
273
+
@@ -200,17 +200,6 @@
200
200
  height: 20px;
201
201
  }
202
202
 
203
- /* Preview Container */
204
- .memori--preview-container {
205
- min-width: 200px;
206
- padding: 12px;
207
- border-radius: 8px;
208
- margin-bottom: 12px;
209
- animation: slide-in 0.3s ease;
210
- background: #fff;
211
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
212
- transition: all 0.3s ease;
213
- }
214
203
 
215
204
  .memori--absolute-preview {
216
205
  position: absolute;
@@ -352,7 +341,7 @@
352
341
  padding: 16px;
353
342
  border-radius: 8px;
354
343
  margin: 0;
355
- background-color: #f8f9fa;
344
+ /* background-color: #f8f9fa; */
356
345
  font-family: monospace;
357
346
  line-height: 1.5;
358
347
  }
@@ -362,7 +351,7 @@
362
351
  border: 1px solid #b2f2bb;
363
352
  border-radius: 8px;
364
353
  margin-top: 16px;
365
- background-color: #ebfbee;
354
+ /* background-color: #ebfbee; */
366
355
  text-align: left;
367
356
  }
368
357
 
@@ -381,8 +370,8 @@
381
370
  .memori--error-message-container,
382
371
  .memori--login-tip {
383
372
  position: fixed;
384
- z-index: 1001;
385
- top: 120px;
373
+ z-index: 10001;
374
+ top: 80px;
386
375
  right: 20px;
387
376
  }
388
377
 
@@ -431,6 +420,13 @@
431
420
  font-weight: bold;
432
421
  }
433
422
 
423
+ .memori--upload-image {
424
+ min-width: 140px;
425
+ min-height: 42px;
426
+ border-radius: 8px;
427
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
428
+ }
429
+
434
430
  .memori--image-count-full {
435
431
  background-color: #fa5252;
436
432
  }
@@ -439,8 +435,8 @@
439
435
  .memori--document-count {
440
436
  position: absolute;
441
437
  z-index: 5;
442
- top: -8px;
443
- right: -8px;
438
+ top: -20px;
439
+ right: -10px;
444
440
  padding: 1px 6px;
445
441
  border-radius: 10px;
446
442
  background-color: #51cf66;
@@ -509,6 +505,13 @@ input.memori--upload-title-input {
509
505
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
510
506
  }
511
507
 
508
+ .memori--error-message-alert{
509
+ position: relative;
510
+ z-index: 10002;
511
+ top: 0;
512
+ right: 0;
513
+ }
514
+
512
515
  /* Animation Keyframes */
513
516
  @keyframes slide-in {
514
517
  from {