@memori.ai/memori-react 2.22.0 → 3.0.0-rc.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 (127) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/I18nWrapper.d.ts +6 -0
  3. package/dist/I18nWrapper.js +9 -0
  4. package/dist/I18nWrapper.js.map +1 -0
  5. package/dist/components/Chat/Chat.d.ts +2 -1
  6. package/dist/components/Chat/Chat.js +2 -2
  7. package/dist/components/Chat/Chat.js.map +1 -1
  8. package/dist/components/ChatBubble/ChatBubble.d.ts +2 -1
  9. package/dist/components/ChatBubble/ChatBubble.js +30 -18
  10. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  11. package/dist/components/ChatBubble/ChatBubble.test.js +22 -0
  12. package/dist/components/ChatBubble/ChatBubble.test.js.map +1 -1
  13. package/dist/components/ChatTextArea/ChatTextArea.js +3 -1
  14. package/dist/components/ChatTextArea/ChatTextArea.js.map +1 -1
  15. package/dist/components/ImageUpload/ImageUpload.js +3 -1
  16. package/dist/components/ImageUpload/ImageUpload.js.map +1 -1
  17. package/dist/components/MemoriWidget/MemoriWidget.js +34 -1
  18. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  19. package/dist/components/StartPanel/StartPanel.css +12 -0
  20. package/dist/components/StartPanel/StartPanel.js +2 -1
  21. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  22. package/dist/components/StartPanel/StartPanel.test.js +7 -0
  23. package/dist/components/StartPanel/StartPanel.test.js.map +1 -1
  24. package/dist/components/icons/Group.d.ts +5 -0
  25. package/dist/components/icons/Group.js +6 -0
  26. package/dist/components/icons/Group.js.map +1 -0
  27. package/dist/helpers/media.js +1 -1
  28. package/dist/helpers/media.js.map +1 -1
  29. package/dist/helpers/media.test.js +1 -1
  30. package/dist/helpers/media.test.js.map +1 -1
  31. package/dist/i18n.d.ts +1 -1
  32. package/dist/i18n.js +4 -4
  33. package/dist/i18n.js.map +1 -1
  34. package/dist/index.js +7 -2
  35. package/dist/index.js.map +1 -1
  36. package/dist/locales/en.json +2 -0
  37. package/dist/locales/it.json +2 -0
  38. package/esm/I18nWrapper.d.ts +6 -0
  39. package/esm/I18nWrapper.js +6 -0
  40. package/esm/I18nWrapper.js.map +1 -0
  41. package/esm/components/Chat/Chat.d.ts +2 -1
  42. package/esm/components/Chat/Chat.js +2 -2
  43. package/esm/components/Chat/Chat.js.map +1 -1
  44. package/esm/components/ChatBubble/ChatBubble.d.ts +2 -1
  45. package/esm/components/ChatBubble/ChatBubble.js +30 -18
  46. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  47. package/esm/components/ChatBubble/ChatBubble.test.js +22 -0
  48. package/esm/components/ChatBubble/ChatBubble.test.js.map +1 -1
  49. package/esm/components/ChatTextArea/ChatTextArea.js +3 -1
  50. package/esm/components/ChatTextArea/ChatTextArea.js.map +1 -1
  51. package/esm/components/ImageUpload/ImageUpload.js +3 -1
  52. package/esm/components/ImageUpload/ImageUpload.js.map +1 -1
  53. package/esm/components/MemoriWidget/MemoriWidget.js +34 -1
  54. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  55. package/esm/components/StartPanel/StartPanel.css +12 -0
  56. package/esm/components/StartPanel/StartPanel.js +2 -1
  57. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  58. package/esm/components/StartPanel/StartPanel.test.js +7 -0
  59. package/esm/components/StartPanel/StartPanel.test.js.map +1 -1
  60. package/esm/components/icons/Group.d.ts +5 -0
  61. package/esm/components/icons/Group.js +4 -0
  62. package/esm/components/icons/Group.js.map +1 -0
  63. package/esm/helpers/media.js +1 -1
  64. package/esm/helpers/media.js.map +1 -1
  65. package/esm/helpers/media.test.js +1 -1
  66. package/esm/helpers/media.test.js.map +1 -1
  67. package/esm/i18n.d.ts +1 -1
  68. package/esm/i18n.js +3 -3
  69. package/esm/i18n.js.map +1 -1
  70. package/esm/index.js +8 -3
  71. package/esm/index.js.map +1 -1
  72. package/esm/locales/en.json +2 -0
  73. package/esm/locales/it.json +2 -0
  74. package/package.json +2 -2
  75. package/src/I18nWrapper.tsx +13 -0
  76. package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +6 -1
  77. package/src/components/AttachmentLinkModal/AttachmentLinkModal.stories.tsx +6 -1
  78. package/src/components/AttachmentMediaModal/AttachmentMediaModal.stories.tsx +6 -1
  79. package/src/components/Auth/Auth.stories.tsx +16 -11
  80. package/src/components/Avatar/Avatar.stories.tsx +28 -25
  81. package/src/components/AvatarView/AvatarView.stories.tsx +8 -5
  82. package/src/components/Blob/Blob.stories.tsx +6 -3
  83. package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +6 -1
  84. package/src/components/ChangeMode/ChangeMode.stories.tsx +9 -6
  85. package/src/components/Chat/Chat.stories.tsx +8 -5
  86. package/src/components/Chat/Chat.tsx +4 -0
  87. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +55 -0
  88. package/src/components/ChatBubble/ChatBubble.stories.tsx +34 -2
  89. package/src/components/ChatBubble/ChatBubble.test.tsx +32 -0
  90. package/src/components/ChatBubble/ChatBubble.tsx +37 -9
  91. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +82 -0
  92. package/src/components/ChatInputs/ChatInputs.stories.tsx +13 -10
  93. package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +6 -0
  94. package/src/components/ChatTextArea/ChatTextArea.stories.tsx +6 -3
  95. package/src/components/ChatTextArea/ChatTextArea.tsx +5 -0
  96. package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +3 -0
  97. package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +6 -1
  98. package/src/components/DateSelector/DateSelector.stories.tsx +6 -2
  99. package/src/components/ExportHistoryButton/ExportHistoryButton.stories.tsx +11 -6
  100. package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +6 -2
  101. package/src/components/Header/Header.stories.tsx +4 -3
  102. package/src/components/ImageUpload/ImageUpload.stories.tsx +6 -2
  103. package/src/components/ImageUpload/ImageUpload.tsx +5 -2
  104. package/src/components/MediaWidget/LinkItemWidget.stories.tsx +6 -1
  105. package/src/components/MediaWidget/MediaItemWidget.stories.tsx +6 -1
  106. package/src/components/MediaWidget/MediaWidget.stories.tsx +6 -1
  107. package/src/components/MemoriWidget/MemoriWidget.stories.tsx +6 -2
  108. package/src/components/MemoriWidget/MemoriWidget.tsx +38 -0
  109. package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +11 -8
  110. package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +17 -13
  111. package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +11 -7
  112. package/src/components/ShareButton/ShareButton.stories.tsx +11 -4
  113. package/src/components/Snippet/Snippet.stories.tsx +12 -9
  114. package/src/components/StartPanel/StartPanel.css +12 -0
  115. package/src/components/StartPanel/StartPanel.stories.tsx +32 -6
  116. package/src/components/StartPanel/StartPanel.test.tsx +21 -0
  117. package/src/components/StartPanel/StartPanel.tsx +12 -2
  118. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +89 -0
  119. package/src/components/Typing/Typing.stories.tsx +6 -2
  120. package/src/components/UploadMenu/UploadMenu.stories.tsx +16 -13
  121. package/src/components/icons/Group.tsx +30 -0
  122. package/src/helpers/media.test.ts +1 -1
  123. package/src/helpers/media.ts +1 -1
  124. package/src/i18n.ts +4 -3
  125. package/src/index.tsx +12 -4
  126. package/src/locales/en.json +2 -0
  127. package/src/locales/it.json +2 -0
@@ -80,6 +80,7 @@ exports[`renders ChatBubble unchanged 1`] = `
80
80
  >
81
81
  <picture
82
82
  class="memori-chat--bubble-avatar transition ease-in-out duration-300 opacity-0 scale-075 translate-x--15"
83
+ title="Memori"
83
84
  >
84
85
  <source
85
86
  src="https://app.twincreator.com/images/twincreator/square_logo.png"
@@ -111,6 +112,7 @@ exports[`renders ChatBubble with initial msg unchanged 1`] = `
111
112
  >
112
113
  <picture
113
114
  class="memori-chat--bubble-avatar transition ease-in-out duration-300 opacity-0 scale-075 translate-x--15"
115
+ title="Memori"
114
116
  >
115
117
  <source
116
118
  src="https://app.twincreator.com/images/twincreator/square_logo.png"
@@ -132,6 +134,86 @@ exports[`renders ChatBubble with initial msg unchanged 1`] = `
132
134
  </div>
133
135
  `;
134
136
 
137
+ exports[`renders ChatBubble with msg from BoE expert unchanged 1`] = `
138
+ <div>
139
+ <div
140
+ class="memori-chat--bubble-container memori-chat--bubble-from-user memori-chat--with-addon"
141
+ >
142
+ <div
143
+ class="memori-chat--bubble memori-chat--user-bubble memori-chat--with-addon memori-chat--ai-generated transition ease-in-out duration-300 opacity-0 scale-09 translate-x-30"
144
+ >
145
+ <p>
146
+ Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
147
+ </p>
148
+ <div
149
+ class="memori-chat--bubble-addon"
150
+ >
151
+ <div
152
+ class="memori-tooltip memori-tooltip--align-left memori-chat--bubble-ai-icon"
153
+ >
154
+ <div
155
+ class="memori-tooltip--content"
156
+ >
157
+ generatedByAI
158
+ </div>
159
+ <div
160
+ class="memori-tooltip--trigger"
161
+ >
162
+ <span>
163
+ <svg
164
+ aria-label="generatedByAI"
165
+ fill="none"
166
+ focusable="false"
167
+ role="img"
168
+ viewBox="0 0 24 24"
169
+ xmlns="http://www.w3.org/2000/svg"
170
+ >
171
+ <g
172
+ clip-rule="evenodd"
173
+ fill="currentColor"
174
+ fill-rule="evenodd"
175
+ >
176
+ <path
177
+ clip-rule="evenodd"
178
+ d="M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z"
179
+ fill-rule="evenodd"
180
+ />
181
+ <path
182
+ clip-rule="evenodd"
183
+ d="M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z"
184
+ fill-rule="evenodd"
185
+ />
186
+ <path
187
+ clip-rule="evenodd"
188
+ d="M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z"
189
+ fill-rule="evenodd"
190
+ />
191
+ </g>
192
+ </svg>
193
+ </span>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ <div
199
+ class="memori-chat--bubble-avatar transition ease-in-out duration-300 opacity-0 scale-075 translate-x-15"
200
+ >
201
+ <svg
202
+ aria-hidden="true"
203
+ focusable="false"
204
+ role="img"
205
+ viewBox="0 0 1024 1024"
206
+ xmlns="http://www.w3.org/2000/svg"
207
+ >
208
+ <path
209
+ d="M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"
210
+ />
211
+ </svg>
212
+ </div>
213
+ </div>
214
+ </div>
215
+ `;
216
+
135
217
  exports[`renders ChatBubble with msg generated by AI unchanged 1`] = `
136
218
  <div>
137
219
  <div
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
3
  import ChatInputs, { Props } from './ChatInputs';
4
+ import I18nWrapper from '../../I18nWrapper';
4
5
  import { dialogState } from '../../mocks/data';
5
6
 
6
7
  import './ChatInputs.css';
@@ -50,16 +51,18 @@ const Template: Story<Props> = args => {
50
51
  }, [listening]);
51
52
 
52
53
  return (
53
- <div style={{ paddingTop: '10rem' }}>
54
- <ChatInputs
55
- {...args}
56
- listening={listening}
57
- startListening={startListening}
58
- stopListening={stopListening}
59
- userMessage={userMessage}
60
- onChangeUserMessage={setUserMessage}
61
- />
62
- </div>
54
+ <I18nWrapper>
55
+ <div style={{ paddingTop: '10rem' }}>
56
+ <ChatInputs
57
+ {...args}
58
+ listening={listening}
59
+ startListening={startListening}
60
+ stopListening={stopListening}
61
+ userMessage={userMessage}
62
+ onChangeUserMessage={setUserMessage}
63
+ />
64
+ </div>
65
+ </I18nWrapper>
63
66
  );
64
67
  };
65
68
 
@@ -48,6 +48,7 @@ exports[`renders ChatInputs disabled unchanged 1`] = `
48
48
  >
49
49
  <button
50
50
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
51
+ title="expand"
51
52
  >
52
53
  <span
53
54
  class="memori-button--icon"
@@ -173,6 +174,7 @@ exports[`renders ChatInputs listening unchanged 1`] = `
173
174
  >
174
175
  <button
175
176
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
177
+ title="expand"
176
178
  >
177
179
  <span
178
180
  class="memori-button--icon"
@@ -327,6 +329,7 @@ exports[`renders ChatInputs on instruct unchanged 1`] = `
327
329
  >
328
330
  <button
329
331
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
332
+ title="expand"
330
333
  >
331
334
  <span
332
335
  class="memori-button--icon"
@@ -450,6 +453,7 @@ exports[`renders ChatInputs unchanged 1`] = `
450
453
  >
451
454
  <button
452
455
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
456
+ title="expand"
453
457
  >
454
458
  <span
455
459
  class="memori-button--icon"
@@ -576,6 +580,7 @@ exports[`renders ChatInputs with user message unchanged 1`] = `
576
580
  >
577
581
  <button
578
582
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
583
+ title="expand"
579
584
  >
580
585
  <span
581
586
  class="memori-button--icon"
@@ -701,6 +706,7 @@ exports[`renders ChatInputs without microphone button unchanged 1`] = `
701
706
  >
702
707
  <button
703
708
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
709
+ title="expand"
704
710
  >
705
711
  <span
706
712
  class="memori-button--icon"
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
3
  import ChatTextArea, { Props } from './ChatTextArea';
4
+ import I18nWrapper from '../../I18nWrapper';
4
5
  import './ChatTextArea.css';
5
6
 
6
7
  const meta: Meta = {
@@ -24,9 +25,11 @@ const Template: Story<Props> = args => {
24
25
  const [userMessage, setUserMessage] = React.useState(args.value);
25
26
 
26
27
  return (
27
- <div style={{ paddingTop: '10rem' }}>
28
- <ChatTextArea {...args} value={userMessage} onChange={setUserMessage} />
29
- </div>
28
+ <I18nWrapper>
29
+ <div style={{ paddingTop: '10rem' }}>
30
+ <ChatTextArea {...args} value={userMessage} onChange={setUserMessage} />
31
+ </div>
32
+ </I18nWrapper>
30
33
  );
31
34
  };
32
35
 
@@ -3,6 +3,7 @@ import cx from 'classnames';
3
3
  import Button from '../ui/Button';
4
4
  import Expand from '../icons/Expand';
5
5
  import FullscreenExit from '../icons/FullscreenExit';
6
+ import { useTranslation } from 'react-i18next';
6
7
 
7
8
  export interface Props {
8
9
  disabled?: boolean;
@@ -21,6 +22,7 @@ const ChatTextArea: React.FC<Props> = ({
21
22
  onFocus,
22
23
  onBlur,
23
24
  }) => {
25
+ const { t } = useTranslation();
24
26
  const [expanded, setExpanded] = useState(false);
25
27
 
26
28
  return (
@@ -53,6 +55,9 @@ const ChatTextArea: React.FC<Props> = ({
53
55
  onClick={() => setExpanded(!expanded)}
54
56
  padded={false}
55
57
  ghost
58
+ title={
59
+ expanded ? t('collapse') || 'Collapse' : t('expand') || 'Expand'
60
+ }
56
61
  icon={expanded ? <FullscreenExit /> : <Expand />}
57
62
  />
58
63
  </div>
@@ -17,6 +17,7 @@ exports[`renders ChatTextArea unchanged 1`] = `
17
17
  >
18
18
  <button
19
19
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
20
+ title="expand"
20
21
  >
21
22
  <span
22
23
  class="memori-button--icon"
@@ -59,6 +60,7 @@ exports[`renders ChatTextArea with long text unchanged 1`] = `
59
60
  >
60
61
  <button
61
62
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
63
+ title="expand"
62
64
  >
63
65
  <span
64
66
  class="memori-button--icon"
@@ -101,6 +103,7 @@ exports[`renders ChatTextArea with value unchanged 1`] = `
101
103
  >
102
104
  <button
103
105
  class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
106
+ title="expand"
104
107
  >
105
108
  <span
106
109
  class="memori-button--icon"
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import CompletionProviderStatus, { Props } from './CompletionProviderStatus';
4
5
 
5
6
  import './CompletionProviderStatus.css';
@@ -16,7 +17,11 @@ const meta: Meta = {
16
17
 
17
18
  export default meta;
18
19
 
19
- const Template: Story<Props> = args => <CompletionProviderStatus {...args} />;
20
+ const Template: Story<Props> = args => (
21
+ <I18nWrapper>
22
+ <CompletionProviderStatus {...args} />
23
+ </I18nWrapper>
24
+ );
20
25
 
21
26
  export const Default = Template.bind({});
22
27
  Default.args = {};
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import DateSelector, { Props } from './DateSelector';
4
5
 
5
6
  import './DateSelector.css';
@@ -15,8 +16,11 @@ const meta: Meta = {
15
16
 
16
17
  export default meta;
17
18
 
18
- const Template: Story<Props> = args => <DateSelector {...args} />;
19
-
19
+ const Template: Story<Props> = args => (
20
+ <I18nWrapper>
21
+ <DateSelector {...args} />
22
+ </I18nWrapper>
23
+ );
20
24
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
21
25
  // https://storybook.js.org/docs/react/workflows/unit-testing
22
26
  export const Default = Template.bind({});
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
3
  import ExportHistoryButton, { Props } from './ExportHistoryButton';
4
+ import I18nWrapper from '../../I18nWrapper';
4
5
  import { memori, history } from '../../mocks/data';
5
6
  import Download from '../icons/Download';
6
7
 
@@ -27,15 +28,19 @@ const meta: Meta = {
27
28
  export default meta;
28
29
 
29
30
  const Template: Story<Props> = args => (
30
- <div style={{ textAlign: 'right' }}>
31
- <ExportHistoryButton {...args} />
32
- </div>
31
+ <I18nWrapper>
32
+ <div style={{ textAlign: 'right' }}>
33
+ <ExportHistoryButton {...args} />
34
+ </div>
35
+ </I18nWrapper>
33
36
  );
34
37
 
35
38
  const TemplateRight: Story<Props> = args => (
36
- <div style={{ textAlign: 'left' }}>
37
- <ExportHistoryButton {...args} />
38
- </div>
39
+ <I18nWrapper>
40
+ <div style={{ textAlign: 'left' }}>
41
+ <ExportHistoryButton {...args} />
42
+ </div>
43
+ </I18nWrapper>
39
44
  );
40
45
 
41
46
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import FeedbackButtons, { Props } from './FeedbackButtons';
4
5
  import { memori } from '../../mocks/data';
5
6
 
@@ -23,8 +24,11 @@ const meta: Meta = {
23
24
 
24
25
  export default meta;
25
26
 
26
- const Template: Story<Props> = args => <FeedbackButtons {...args} />;
27
-
27
+ const Template: Story<Props> = args => (
28
+ <I18nWrapper>
29
+ <FeedbackButtons {...args} />
30
+ </I18nWrapper>
31
+ );
28
32
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
29
33
  // https://storybook.js.org/docs/react/workflows/unit-testing
30
34
  export const Default = Template.bind({});
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
3
  import { memori, history } from '../../mocks/data';
4
+ import I18nWrapper from '../../I18nWrapper';
4
5
  import Header, { Props } from './Header';
6
+ import SettingsDrawer from '../SettingsDrawer/SettingsDrawer';
5
7
 
6
8
  import './Header.css';
7
- import SettingsDrawer from '../SettingsDrawer/SettingsDrawer';
8
9
 
9
10
  const meta: Meta = {
10
11
  title: 'Widget/Header',
@@ -31,7 +32,7 @@ const Template: Story<Props> = args => {
31
32
  React.useState(2);
32
33
 
33
34
  return (
34
- <>
35
+ <I18nWrapper>
35
36
  <Header
36
37
  {...args}
37
38
  speakerMuted={speakerMuted}
@@ -51,7 +52,7 @@ const Template: Story<Props> = args => {
51
52
  hideEmissions={false}
52
53
  setHideEmissions={() => {}}
53
54
  />
54
- </>
55
+ </I18nWrapper>
55
56
  );
56
57
  };
57
58
 
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import ImageUpload, { Props } from './ImageUpload';
4
5
  import memoriAPIClient from '@memori.ai/memori-api-client';
5
6
 
@@ -18,8 +19,11 @@ const meta: Meta = {
18
19
 
19
20
  export default meta;
20
21
 
21
- const Template: Story<Props> = args => <ImageUpload {...args} />;
22
-
22
+ const Template: Story<Props> = args => (
23
+ <I18nWrapper>
24
+ <ImageUpload {...args} />
25
+ </I18nWrapper>
26
+ );
23
27
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
24
28
  // https://storybook.js.org/docs/react/workflows/unit-testing
25
29
  export const Default = Template.bind({});
@@ -371,8 +371,11 @@ const ImageUpload: React.FC<Props> = ({
371
371
  {t(
372
372
  allowedMimeTypes
373
373
  ? 'media.uploadHelper'
374
- : 'media.uploadHelperImages'
375
- ).replace('@size@', (maxFileSizeInMB ?? 2).toString())}
374
+ : 'media.uploadHelperImages',
375
+ {
376
+ size: maxFileSizeInMB ?? 2,
377
+ }
378
+ )}
376
379
  </p>
377
380
  {imageProportionsHelper && useImageCrop && (
378
381
  <p>
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import LinkItemWidget, { Props } from './LinkItemWidget';
4
5
 
5
6
  import './LinkItemWidget.css';
@@ -15,7 +16,11 @@ const meta: Meta = {
15
16
 
16
17
  export default meta;
17
18
 
18
- const Template: Story<Props> = args => <LinkItemWidget {...args} />;
19
+ const Template: Story<Props> = args => (
20
+ <I18nWrapper>
21
+ <LinkItemWidget {...args} />
22
+ </I18nWrapper>
23
+ );
19
24
 
20
25
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
21
26
  // https://storybook.js.org/docs/react/workflows/unit-testing
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import MediaItemWidget, { Props } from './MediaItemWidget';
4
5
 
5
6
  import './MediaItemWidget.css';
@@ -22,7 +23,11 @@ const meta: Meta = {
22
23
 
23
24
  export default meta;
24
25
 
25
- const Template: Story<Props> = args => <MediaItemWidget {...args} />;
26
+ const Template: Story<Props> = args => (
27
+ <I18nWrapper>
28
+ <MediaItemWidget {...args} />
29
+ </I18nWrapper>
30
+ );
26
31
 
27
32
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
28
33
  // https://storybook.js.org/docs/react/workflows/unit-testing
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
+ import I18nWrapper from '../../I18nWrapper';
3
4
  import MediaWidget, { Props } from './MediaWidget';
4
5
  import {
5
6
  Medium,
@@ -92,7 +93,11 @@ const hints: TranslatedHint[] = [
92
93
  },
93
94
  ];
94
95
 
95
- const Template: Story<Props> = args => <MediaWidget {...args} />;
96
+ const Template: Story<Props> = args => (
97
+ <I18nWrapper>
98
+ <MediaWidget {...args} />
99
+ </I18nWrapper>
100
+ );
96
101
 
97
102
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
98
103
  // https://storybook.js.org/docs/react/workflows/unit-testing
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
3
  import { memori, integration, tenant } from '../../mocks/data';
4
+ import I18nWrapper from '../../I18nWrapper';
4
5
  import MemoriWidget, { Props } from './MemoriWidget';
5
6
 
6
7
  import './MemoriWidget.css';
@@ -33,8 +34,11 @@ const meta: Meta = {
33
34
 
34
35
  export default meta;
35
36
 
36
- const Template: Story<Props> = args => <MemoriWidget {...args} />;
37
-
37
+ const Template: Story<Props> = args => (
38
+ <I18nWrapper>
39
+ <MemoriWidget {...args} />
40
+ </I18nWrapper>
41
+ );
38
42
  // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
39
43
  // https://storybook.js.org/docs/react/workflows/unit-testing
40
44
  export const Default = Template.bind({});
@@ -15,6 +15,7 @@ import {
15
15
  Asset,
16
16
  MemoriSession,
17
17
  User,
18
+ ExpertReference,
18
19
  } from '@memori.ai/memori-api-client/src/types';
19
20
  import {
20
21
  SpeakerAudioDestination,
@@ -411,6 +412,7 @@ const MemoriWidget = ({
411
412
  postTagChangedEvent,
412
413
  getSession,
413
414
  getContentQualityIndexes,
415
+ getExpertReferences,
414
416
  } = client;
415
417
 
416
418
  const [instruct, setInstruct] = useState(false);
@@ -635,6 +637,7 @@ const MemoriWidget = ({
635
637
  if (emission) {
636
638
  pushMessage({
637
639
  text: emission,
640
+ emitter: currentState.emitter,
638
641
  media: currentState.media,
639
642
  fromUser: false,
640
643
  });
@@ -663,6 +666,7 @@ const MemoriWidget = ({
663
666
  if (emission) {
664
667
  pushMessage({
665
668
  text: emission,
669
+ emitter: currentState.emitter,
666
670
  media: currentState.media,
667
671
  fromUser: false,
668
672
  });
@@ -698,6 +702,7 @@ const MemoriWidget = ({
698
702
  if (emission) {
699
703
  pushMessage({
700
704
  text: emission,
705
+ emitter: currentState.emitter,
701
706
  media: currentState.media,
702
707
  fromUser: false,
703
708
  generatedByAI: !!currentState.completion,
@@ -757,6 +762,7 @@ const MemoriWidget = ({
757
762
  if (emission) {
758
763
  translatedMsg = {
759
764
  text: emission,
765
+ emitter: state.emitter,
760
766
  media: state.media,
761
767
  fromUser: false,
762
768
  };
@@ -796,6 +802,7 @@ const MemoriWidget = ({
796
802
  if (t.text.length > 0)
797
803
  translatedMsg = {
798
804
  text: t.text,
805
+ emitter: state.emitter,
799
806
  media: state.media,
800
807
  fromUser: false,
801
808
  generatedByAI: !!state.completion,
@@ -1025,6 +1032,7 @@ const MemoriWidget = ({
1025
1032
  ? setHistory([
1026
1033
  {
1027
1034
  text: currentState.emission,
1035
+ emitter: currentState.emitter,
1028
1036
  media: currentState.media,
1029
1037
  fromUser: false,
1030
1038
  initial: true,
@@ -1032,6 +1040,7 @@ const MemoriWidget = ({
1032
1040
  ])
1033
1041
  : pushMessage({
1034
1042
  text: currentState.emission,
1043
+ emitter: currentState.emitter,
1035
1044
  media: currentState.media,
1036
1045
  fromUser: false,
1037
1046
  initial: true,
@@ -1246,6 +1255,7 @@ const MemoriWidget = ({
1246
1255
  } else if (emission && emission.length > 0) {
1247
1256
  pushMessage({
1248
1257
  text: emission,
1258
+ emitter: currentState.emitter,
1249
1259
  media: currentState.media,
1250
1260
  fromUser: false,
1251
1261
  generatedByAI: !!currentState.completion,
@@ -2141,6 +2151,7 @@ const MemoriWidget = ({
2141
2151
  if (currentState.emission) {
2142
2152
  pushMessage({
2143
2153
  text: currentState.emission,
2154
+ emitter: currentState.emitter,
2144
2155
  media: currentState.media,
2145
2156
  fromUser: false,
2146
2157
  });
@@ -2154,6 +2165,7 @@ const MemoriWidget = ({
2154
2165
  if (currentState.emission) {
2155
2166
  pushMessage({
2156
2167
  text: currentState.emission,
2168
+ emitter: currentState.emitter,
2157
2169
  media: currentState.media,
2158
2170
  fromUser: false,
2159
2171
  });
@@ -2548,6 +2560,29 @@ const MemoriWidget = ({
2548
2560
  };
2549
2561
  }, []);
2550
2562
 
2563
+ /**
2564
+ * Experts references
2565
+ */
2566
+ const [experts, setExperts] = useState<ExpertReference[]>();
2567
+ const fetchExperts = useCallback(async () => {
2568
+ if (!sessionId || !memori?.enableBoardOfExperts) return;
2569
+
2570
+ try {
2571
+ const { experts, count, ...resp } = await getExpertReferences(sessionId);
2572
+
2573
+ if (resp.resultCode === 0) {
2574
+ setExperts(experts);
2575
+ } else {
2576
+ console.warn('Error fetching experts', resp);
2577
+ }
2578
+ } catch (err) {
2579
+ console.warn(err);
2580
+ }
2581
+ }, [sessionId, memori?.enableBoardOfExperts]);
2582
+ useEffect(() => {
2583
+ fetchExperts();
2584
+ }, [sessionId, fetchExperts]);
2585
+
2551
2586
  const showFullHistory =
2552
2587
  showOnlyLastMessages === undefined
2553
2588
  ? layout !== 'TOTEM' && layout !== 'WEBSITE_ASSISTANT'
@@ -2676,6 +2711,7 @@ const MemoriWidget = ({
2676
2711
  customMediaRenderer,
2677
2712
  user,
2678
2713
  userAvatar,
2714
+ experts,
2679
2715
  };
2680
2716
 
2681
2717
  const integrationBackground =
@@ -2905,6 +2941,7 @@ const MemoriWidget = ({
2905
2941
  if (currentState.emission) {
2906
2942
  pushMessage({
2907
2943
  text: currentState.emission,
2944
+ emitter: currentState.emitter,
2908
2945
  media: currentState.media,
2909
2946
  fromUser: false,
2910
2947
  });
@@ -2962,6 +2999,7 @@ const MemoriWidget = ({
2962
2999
  if (currentState.emission) {
2963
3000
  pushMessage({
2964
3001
  text: currentState.emission,
3002
+ emitter: currentState.emitter,
2965
3003
  media: currentState.media,
2966
3004
  fromUser: false,
2967
3005
  });