@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.
- package/CHANGELOG.md +18 -0
- package/dist/I18nWrapper.d.ts +6 -0
- package/dist/I18nWrapper.js +9 -0
- package/dist/I18nWrapper.js.map +1 -0
- package/dist/components/Chat/Chat.d.ts +2 -1
- package/dist/components/Chat/Chat.js +2 -2
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.d.ts +2 -1
- package/dist/components/ChatBubble/ChatBubble.js +30 -18
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.test.js +22 -0
- package/dist/components/ChatBubble/ChatBubble.test.js.map +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.js +3 -1
- package/dist/components/ChatTextArea/ChatTextArea.js.map +1 -1
- package/dist/components/ImageUpload/ImageUpload.js +3 -1
- package/dist/components/ImageUpload/ImageUpload.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +34 -1
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.css +12 -0
- package/dist/components/StartPanel/StartPanel.js +2 -1
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.test.js +7 -0
- package/dist/components/StartPanel/StartPanel.test.js.map +1 -1
- package/dist/components/icons/Group.d.ts +5 -0
- package/dist/components/icons/Group.js +6 -0
- package/dist/components/icons/Group.js.map +1 -0
- package/dist/helpers/media.js +1 -1
- package/dist/helpers/media.js.map +1 -1
- package/dist/helpers/media.test.js +1 -1
- package/dist/helpers/media.test.js.map +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +2 -0
- package/dist/locales/it.json +2 -0
- package/esm/I18nWrapper.d.ts +6 -0
- package/esm/I18nWrapper.js +6 -0
- package/esm/I18nWrapper.js.map +1 -0
- package/esm/components/Chat/Chat.d.ts +2 -1
- package/esm/components/Chat/Chat.js +2 -2
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.d.ts +2 -1
- package/esm/components/ChatBubble/ChatBubble.js +30 -18
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.test.js +22 -0
- package/esm/components/ChatBubble/ChatBubble.test.js.map +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.js +3 -1
- package/esm/components/ChatTextArea/ChatTextArea.js.map +1 -1
- package/esm/components/ImageUpload/ImageUpload.js +3 -1
- package/esm/components/ImageUpload/ImageUpload.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +34 -1
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.css +12 -0
- package/esm/components/StartPanel/StartPanel.js +2 -1
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.test.js +7 -0
- package/esm/components/StartPanel/StartPanel.test.js.map +1 -1
- package/esm/components/icons/Group.d.ts +5 -0
- package/esm/components/icons/Group.js +4 -0
- package/esm/components/icons/Group.js.map +1 -0
- package/esm/helpers/media.js +1 -1
- package/esm/helpers/media.js.map +1 -1
- package/esm/helpers/media.test.js +1 -1
- package/esm/helpers/media.test.js.map +1 -1
- package/esm/i18n.d.ts +1 -1
- package/esm/i18n.js +3 -3
- package/esm/i18n.js.map +1 -1
- package/esm/index.js +8 -3
- package/esm/index.js.map +1 -1
- package/esm/locales/en.json +2 -0
- package/esm/locales/it.json +2 -0
- package/package.json +2 -2
- package/src/I18nWrapper.tsx +13 -0
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +6 -1
- package/src/components/AttachmentLinkModal/AttachmentLinkModal.stories.tsx +6 -1
- package/src/components/AttachmentMediaModal/AttachmentMediaModal.stories.tsx +6 -1
- package/src/components/Auth/Auth.stories.tsx +16 -11
- package/src/components/Avatar/Avatar.stories.tsx +28 -25
- package/src/components/AvatarView/AvatarView.stories.tsx +8 -5
- package/src/components/Blob/Blob.stories.tsx +6 -3
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +6 -1
- package/src/components/ChangeMode/ChangeMode.stories.tsx +9 -6
- package/src/components/Chat/Chat.stories.tsx +8 -5
- package/src/components/Chat/Chat.tsx +4 -0
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +55 -0
- package/src/components/ChatBubble/ChatBubble.stories.tsx +34 -2
- package/src/components/ChatBubble/ChatBubble.test.tsx +32 -0
- package/src/components/ChatBubble/ChatBubble.tsx +37 -9
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +82 -0
- package/src/components/ChatInputs/ChatInputs.stories.tsx +13 -10
- package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +6 -0
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +6 -3
- package/src/components/ChatTextArea/ChatTextArea.tsx +5 -0
- package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +3 -0
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +6 -1
- package/src/components/DateSelector/DateSelector.stories.tsx +6 -2
- package/src/components/ExportHistoryButton/ExportHistoryButton.stories.tsx +11 -6
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +6 -2
- package/src/components/Header/Header.stories.tsx +4 -3
- package/src/components/ImageUpload/ImageUpload.stories.tsx +6 -2
- package/src/components/ImageUpload/ImageUpload.tsx +5 -2
- package/src/components/MediaWidget/LinkItemWidget.stories.tsx +6 -1
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +6 -1
- package/src/components/MediaWidget/MediaWidget.stories.tsx +6 -1
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +6 -2
- package/src/components/MemoriWidget/MemoriWidget.tsx +38 -0
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +11 -8
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +17 -13
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +11 -7
- package/src/components/ShareButton/ShareButton.stories.tsx +11 -4
- package/src/components/Snippet/Snippet.stories.tsx +12 -9
- package/src/components/StartPanel/StartPanel.css +12 -0
- package/src/components/StartPanel/StartPanel.stories.tsx +32 -6
- package/src/components/StartPanel/StartPanel.test.tsx +21 -0
- package/src/components/StartPanel/StartPanel.tsx +12 -2
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +89 -0
- package/src/components/Typing/Typing.stories.tsx +6 -2
- package/src/components/UploadMenu/UploadMenu.stories.tsx +16 -13
- package/src/components/icons/Group.tsx +30 -0
- package/src/helpers/media.test.ts +1 -1
- package/src/helpers/media.ts +1 -1
- package/src/i18n.ts +4 -3
- package/src/index.tsx +12 -4
- package/src/locales/en.json +2 -0
- package/src/locales/it.json +2 -0
|
@@ -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 MicrophoneButton, { Props } from './MicrophoneButton';
|
|
4
5
|
|
|
5
6
|
import './MicrophoneButton.css';
|
|
@@ -27,14 +28,16 @@ const Template: Story<Props> = args => {
|
|
|
27
28
|
const stopListening = () => setListening(false);
|
|
28
29
|
|
|
29
30
|
return (
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
<I18nWrapper>
|
|
32
|
+
<div style={{ paddingTop: '10rem', textAlign: 'right' }}>
|
|
33
|
+
<MicrophoneButton
|
|
34
|
+
{...args}
|
|
35
|
+
listening={listening}
|
|
36
|
+
startListening={startListening}
|
|
37
|
+
stopListening={stopListening}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</I18nWrapper>
|
|
38
41
|
);
|
|
39
42
|
};
|
|
40
43
|
|
|
@@ -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 SendOnEnterMenu, { Props } from './SendOnEnterMenu';
|
|
4
5
|
|
|
5
6
|
import './SendOnEnterMenu.css';
|
|
@@ -24,20 +25,23 @@ export default meta;
|
|
|
24
25
|
|
|
25
26
|
const Template: Story<Props> = args => {
|
|
26
27
|
const [sendOnEnter, setSendOnEnter] = React.useState(args.sendOnEnter);
|
|
28
|
+
|
|
27
29
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
<I18nWrapper>
|
|
31
|
+
<div
|
|
32
|
+
style={{
|
|
33
|
+
minHeight: '200px',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'flex-end',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<SendOnEnterMenu
|
|
39
|
+
{...args}
|
|
40
|
+
sendOnEnter={sendOnEnter}
|
|
41
|
+
setSendOnEnter={setSendOnEnter}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
</I18nWrapper>
|
|
41
45
|
);
|
|
42
46
|
};
|
|
43
47
|
|
|
@@ -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 SettingsDrawer, { Props } from './SettingsDrawer';
|
|
4
5
|
import './SettingsDrawer.css';
|
|
5
6
|
|
|
@@ -27,14 +28,17 @@ const Template: Story<Props> = args => {
|
|
|
27
28
|
const [controlsPosition, setControlsPosition] = React.useState<
|
|
28
29
|
'bottom' | 'center'
|
|
29
30
|
>('bottom');
|
|
31
|
+
|
|
30
32
|
return (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
<I18nWrapper>
|
|
34
|
+
<SettingsDrawer
|
|
35
|
+
{...args}
|
|
36
|
+
microphoneMode={microphoneMode}
|
|
37
|
+
setMicrophoneMode={setMicrophoneMode}
|
|
38
|
+
controlsPosition={controlsPosition}
|
|
39
|
+
setControlsPosition={setControlsPosition}
|
|
40
|
+
/>
|
|
41
|
+
</I18nWrapper>
|
|
38
42
|
);
|
|
39
43
|
};
|
|
40
44
|
|
|
@@ -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 ShareButton, { Props } from './ShareButton';
|
|
4
5
|
import { tenant } from '../../mocks/data';
|
|
5
6
|
|
|
@@ -27,11 +28,17 @@ const meta: Meta = {
|
|
|
27
28
|
|
|
28
29
|
export default meta;
|
|
29
30
|
|
|
30
|
-
const Template: Story<Props> = args =>
|
|
31
|
-
|
|
32
|
-
<div style={{ textAlign: 'right' }}>
|
|
31
|
+
const Template: Story<Props> = args => (
|
|
32
|
+
<I18nWrapper>
|
|
33
33
|
<ShareButton {...args} />
|
|
34
|
-
</
|
|
34
|
+
</I18nWrapper>
|
|
35
|
+
);
|
|
36
|
+
const TemplateRight: Story<Props> = args => (
|
|
37
|
+
<I18nWrapper>
|
|
38
|
+
<div style={{ textAlign: 'right' }}>
|
|
39
|
+
<ShareButton {...args} />
|
|
40
|
+
</div>
|
|
41
|
+
</I18nWrapper>
|
|
35
42
|
);
|
|
36
43
|
|
|
37
44
|
export const Default = Template.bind({});
|
|
@@ -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 Snippet from './Snippet';
|
|
4
5
|
import { prismSyntaxLangs } from '../../helpers/constants';
|
|
5
6
|
|
|
@@ -82,15 +83,17 @@ const Template: Story<{
|
|
|
82
83
|
content: string;
|
|
83
84
|
preview?: boolean;
|
|
84
85
|
}> = args => (
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
<I18nWrapper>
|
|
87
|
+
<Snippet
|
|
88
|
+
{...args}
|
|
89
|
+
medium={{
|
|
90
|
+
mediumID: '95226d7e-7bae-465e-8b80-995587bb5971',
|
|
91
|
+
mimeType: args.mimeType,
|
|
92
|
+
title: 'Snippet',
|
|
93
|
+
content: args.content,
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
</I18nWrapper>
|
|
94
97
|
);
|
|
95
98
|
|
|
96
99
|
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.memori--completions-enabled,
|
|
136
|
+
.memori--board-of-experts,
|
|
136
137
|
.memori--nsfw {
|
|
137
138
|
position: absolute;
|
|
138
139
|
right: 2.5rem;
|
|
@@ -161,4 +162,15 @@
|
|
|
161
162
|
|
|
162
163
|
.memori--completions-enabled+.memori--nsfw {
|
|
163
164
|
right: 4.75rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.memori--board-of-experts {
|
|
168
|
+
right: 0.25rem;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.memori--board-of-experts svg {
|
|
172
|
+
overflow: visible;
|
|
173
|
+
width: 1rem;
|
|
174
|
+
height: 1rem;
|
|
175
|
+
fill: #000;
|
|
164
176
|
}
|
|
@@ -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 { memori, sessionID, integration, tenant } from '../../mocks/data';
|
|
4
5
|
import StartPanel, { Props } from './StartPanel';
|
|
5
6
|
|
|
@@ -80,12 +81,14 @@ const integrationStylesheet = `
|
|
|
80
81
|
`;
|
|
81
82
|
|
|
82
83
|
const Template: Story<Props> = args => (
|
|
83
|
-
<
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
<I18nWrapper>
|
|
85
|
+
<div style={{ maxWidth: '600px', margin: 'auto' }}>
|
|
86
|
+
{args.integrationConfig && (
|
|
87
|
+
<style dangerouslySetInnerHTML={{ __html: integrationStylesheet }} />
|
|
88
|
+
)}
|
|
89
|
+
<StartPanel {...args} />
|
|
90
|
+
</div>
|
|
91
|
+
</I18nWrapper>
|
|
89
92
|
);
|
|
90
93
|
|
|
91
94
|
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
@@ -187,6 +190,29 @@ WithAllTheBadges.args = {
|
|
|
187
190
|
onClickStart: () => {},
|
|
188
191
|
};
|
|
189
192
|
|
|
193
|
+
export const BoardOfExpert = Template.bind({});
|
|
194
|
+
BoardOfExpert.args = {
|
|
195
|
+
memori: {
|
|
196
|
+
...memori,
|
|
197
|
+
enableBoardOfExperts: true,
|
|
198
|
+
enableCompletions: true,
|
|
199
|
+
},
|
|
200
|
+
gamificationLevel: {
|
|
201
|
+
points: 61,
|
|
202
|
+
pointsForCurrentBadge: 60,
|
|
203
|
+
badge: '🌍',
|
|
204
|
+
},
|
|
205
|
+
tenant,
|
|
206
|
+
language: 'it',
|
|
207
|
+
userLang: 'en',
|
|
208
|
+
setUserLang: () => {},
|
|
209
|
+
openPositionDrawer: () => {},
|
|
210
|
+
instruct: false,
|
|
211
|
+
sessionId: sessionID,
|
|
212
|
+
clickedStart: false,
|
|
213
|
+
onClickStart: () => {},
|
|
214
|
+
};
|
|
215
|
+
|
|
190
216
|
export const Instruct = Template.bind({});
|
|
191
217
|
Instruct.args = {
|
|
192
218
|
memori,
|
|
@@ -65,6 +65,27 @@ it('renders StartPanel with completions enabled unchanged', () => {
|
|
|
65
65
|
expect(container).toMatchSnapshot();
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
it('renders StartPanel for board of experts unchanged', () => {
|
|
69
|
+
const { container } = render(
|
|
70
|
+
<StartPanel
|
|
71
|
+
memori={{
|
|
72
|
+
...memori,
|
|
73
|
+
enableBoardOfExperts: true,
|
|
74
|
+
}}
|
|
75
|
+
tenant={tenant}
|
|
76
|
+
language="it"
|
|
77
|
+
userLang="en"
|
|
78
|
+
setUserLang={() => {}}
|
|
79
|
+
openPositionDrawer={() => {}}
|
|
80
|
+
instruct={false}
|
|
81
|
+
sessionId={sessionID}
|
|
82
|
+
clickedStart={false}
|
|
83
|
+
onClickStart={() => {}}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
expect(container).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
|
|
68
89
|
it('renders StartPanel on instruct unchanged', () => {
|
|
69
90
|
const { container } = render(
|
|
70
91
|
<StartPanel
|
|
@@ -14,6 +14,7 @@ import Translation from '../icons/Translation';
|
|
|
14
14
|
import { chatLanguages } from '../../helpers/constants';
|
|
15
15
|
import BlockedMemoriBadge from '../BlockedMemoriBadge/BlockedMemoriBadge';
|
|
16
16
|
import AI from '../icons/AI';
|
|
17
|
+
import Group from '../icons/Group';
|
|
17
18
|
import CompletionProviderStatus from '../CompletionProviderStatus/CompletionProviderStatus';
|
|
18
19
|
|
|
19
20
|
export interface Props {
|
|
@@ -101,7 +102,7 @@ const StartPanel: React.FC<Props> = ({
|
|
|
101
102
|
})}")`,
|
|
102
103
|
}}
|
|
103
104
|
>
|
|
104
|
-
{!!gamificationLevel?.badge?.length && (
|
|
105
|
+
{!!gamificationLevel?.badge?.length && !memori.enableBoardOfExperts && (
|
|
105
106
|
<div className="memori--gamification-badge">
|
|
106
107
|
<Tooltip
|
|
107
108
|
align="left"
|
|
@@ -119,7 +120,7 @@ const StartPanel: React.FC<Props> = ({
|
|
|
119
120
|
</Tooltip>
|
|
120
121
|
</div>
|
|
121
122
|
)}
|
|
122
|
-
{!!memori.enableCompletions && (
|
|
123
|
+
{!!memori.enableCompletions && !memori.enableBoardOfExperts && (
|
|
123
124
|
<div className="memori--completions-enabled">
|
|
124
125
|
<Tooltip align="left" content={t('completionsEnabled')}>
|
|
125
126
|
<span aria-label={t('completionsEnabled') || 'Completions'}>
|
|
@@ -128,6 +129,15 @@ const StartPanel: React.FC<Props> = ({
|
|
|
128
129
|
</Tooltip>
|
|
129
130
|
</div>
|
|
130
131
|
)}
|
|
132
|
+
{!!memori.enableBoardOfExperts && (
|
|
133
|
+
<div className="memori--board-of-experts">
|
|
134
|
+
<Tooltip align="left" content={t('boardOfExperts')}>
|
|
135
|
+
<span aria-label={t('boardOfExperts') || 'Board of Experts'}>
|
|
136
|
+
<Group />
|
|
137
|
+
</span>
|
|
138
|
+
</Tooltip>
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
131
141
|
{!!memori.nsfw && (
|
|
132
142
|
<div className="memori--nsfw">
|
|
133
143
|
<Tooltip align="left" content={t('nsfw')}>
|
|
@@ -1,5 +1,94 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders StartPanel for board of experts unchanged 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="memori--start-panel"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="memori--cover"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
class="memori--board-of-experts"
|
|
13
|
+
>
|
|
14
|
+
<div
|
|
15
|
+
class="memori-tooltip memori-tooltip--align-left"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="memori-tooltip--content"
|
|
19
|
+
>
|
|
20
|
+
boardOfExperts
|
|
21
|
+
</div>
|
|
22
|
+
<div
|
|
23
|
+
class="memori-tooltip--trigger"
|
|
24
|
+
>
|
|
25
|
+
<span
|
|
26
|
+
aria-label="boardOfExperts"
|
|
27
|
+
>
|
|
28
|
+
<svg
|
|
29
|
+
aria-hidden="true"
|
|
30
|
+
fill="none"
|
|
31
|
+
focusable="false"
|
|
32
|
+
height="16"
|
|
33
|
+
role="img"
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
stroke-linecap="round"
|
|
36
|
+
stroke-linejoin="round"
|
|
37
|
+
stroke-width="2"
|
|
38
|
+
viewBox="0 0 640 512"
|
|
39
|
+
width="20"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
>
|
|
42
|
+
<path
|
|
43
|
+
d="M211.2 96a64 64 0 10-128 0 64 64 0 10128 0zM32 256c0 17.7 14.3 32 32 32h85.6c10.1-39.4 38.6-71.5 75.8-86.6-9.7-6-21.2-9.4-33.4-9.4H96c-35.3 0-64 28.7-64 64zm461.6 32H576c17.7 0 32-14.3 32-32 0-35.3-28.7-64-64-64h-96c-11.7 0-22.7 3.1-32.1 8.6 38.1 14.8 67.4 47.3 77.7 87.4zm-102.4-61.6c-6.9-1.6-14.2-2.4-21.6-2.4h-96c-8.5 0-16.7 1.1-24.5 3.1-30.8 8.1-55.6 31.1-66.1 60.9-3.5 10-5.5 20.8-5.5 32 0 17.7 14.3 32 32 32h224c17.7 0 32-14.3 32-32 0-11.2-1.9-22-5.5-32-10.8-30.7-36.8-54.2-68.9-61.6zM563.2 96a64 64 0 10-128 0 64 64 0 10128 0zm-241.6 96a80 80 0 100-160 80 80 0 100 160zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32h576c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
</span>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<picture
|
|
52
|
+
class="memori--avatar"
|
|
53
|
+
>
|
|
54
|
+
<source
|
|
55
|
+
src="https://app.twincreator.com/images/twincreator/square_logo.png"
|
|
56
|
+
/>
|
|
57
|
+
<img
|
|
58
|
+
alt="Memori"
|
|
59
|
+
src="https://app.twincreator.com/images/twincreator/square_logo.png"
|
|
60
|
+
/>
|
|
61
|
+
</picture>
|
|
62
|
+
<h2
|
|
63
|
+
class="memori--title"
|
|
64
|
+
>
|
|
65
|
+
Memori
|
|
66
|
+
</h2>
|
|
67
|
+
<div
|
|
68
|
+
class="memori--description"
|
|
69
|
+
>
|
|
70
|
+
<p>
|
|
71
|
+
<span
|
|
72
|
+
class="memori--description-text"
|
|
73
|
+
>
|
|
74
|
+
Lorem ipsum.
|
|
75
|
+
</span>
|
|
76
|
+
</p>
|
|
77
|
+
<button
|
|
78
|
+
class="memori-button memori-button--primary memori-button--rounded memori-button--padded memori--start-button"
|
|
79
|
+
>
|
|
80
|
+
write_and_speak.tryMeButton
|
|
81
|
+
</button>
|
|
82
|
+
<p
|
|
83
|
+
class="memori--start-description"
|
|
84
|
+
>
|
|
85
|
+
write_and_speak.pageTryMeExplanation
|
|
86
|
+
</p>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
91
|
+
|
|
3
92
|
exports[`renders StartPanel on instruct unchanged 1`] = `
|
|
4
93
|
<div>
|
|
5
94
|
<div
|
|
@@ -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 Typing, { Props } from './Typing';
|
|
4
5
|
|
|
5
6
|
const meta: Meta = {
|
|
@@ -30,8 +31,11 @@ const meta: Meta = {
|
|
|
30
31
|
|
|
31
32
|
export default meta;
|
|
32
33
|
|
|
33
|
-
const Template: Story<Props> = args =>
|
|
34
|
-
|
|
34
|
+
const Template: Story<Props> = args => (
|
|
35
|
+
<I18nWrapper>
|
|
36
|
+
<Typing {...args} />
|
|
37
|
+
</I18nWrapper>
|
|
38
|
+
);
|
|
35
39
|
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
36
40
|
// https://storybook.js.org/docs/react/workflows/unit-testing
|
|
37
41
|
export const Default = Template.bind({});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
|
+
import I18nWrapper from '../../I18nWrapper';
|
|
3
4
|
import UploadMenu, { Props } from './UploadMenu';
|
|
4
5
|
|
|
5
6
|
import './UploadMenu.css';
|
|
@@ -27,19 +28,21 @@ const Template: Story<Props> = args => {
|
|
|
27
28
|
'link' | 'media' | undefined
|
|
28
29
|
>(args.attachmentsMenuOpen);
|
|
29
30
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
<I18nWrapper>
|
|
32
|
+
<div
|
|
33
|
+
style={{
|
|
34
|
+
minHeight: '200px',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'flex-end',
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<UploadMenu
|
|
40
|
+
{...args}
|
|
41
|
+
attachmentsMenuOpen={attachmentsMenuOpen}
|
|
42
|
+
setAttachmentsMenuOpen={setAttachmentsMenuOpen}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</I18nWrapper>
|
|
43
46
|
);
|
|
44
47
|
};
|
|
45
48
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const Group = ({
|
|
4
|
+
className,
|
|
5
|
+
title,
|
|
6
|
+
}: {
|
|
7
|
+
className?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
}) => (
|
|
10
|
+
<svg
|
|
11
|
+
{...(!title ? { 'aria-hidden': 'true' } : {})}
|
|
12
|
+
focusable="false"
|
|
13
|
+
role="img"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
fill="none"
|
|
16
|
+
stroke="currentColor"
|
|
17
|
+
strokeLinecap="round"
|
|
18
|
+
strokeLinejoin="round"
|
|
19
|
+
strokeWidth="2"
|
|
20
|
+
width="20"
|
|
21
|
+
height="16"
|
|
22
|
+
viewBox="0 0 640 512"
|
|
23
|
+
className={className}
|
|
24
|
+
aria-label={title}
|
|
25
|
+
>
|
|
26
|
+
<path d="M211.2 96a64 64 0 10-128 0 64 64 0 10128 0zM32 256c0 17.7 14.3 32 32 32h85.6c10.1-39.4 38.6-71.5 75.8-86.6-9.7-6-21.2-9.4-33.4-9.4H96c-35.3 0-64 28.7-64 64zm461.6 32H576c17.7 0 32-14.3 32-32 0-35.3-28.7-64-64-64h-96c-11.7 0-22.7 3.1-32.1 8.6 38.1 14.8 67.4 47.3 77.7 87.4zm-102.4-61.6c-6.9-1.6-14.2-2.4-21.6-2.4h-96c-8.5 0-16.7 1.1-24.5 3.1-30.8 8.1-55.6 31.1-66.1 60.9-3.5 10-5.5 20.8-5.5 32 0 17.7 14.3 32 32 32h224c17.7 0 32-14.3 32-32 0-11.2-1.9-22-5.5-32-10.8-30.7-36.8-54.2-68.9-61.6zM563.2 96a64 64 0 10-128 0 64 64 0 10128 0zm-241.6 96a80 80 0 100-160 80 80 0 100 160zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32h576c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"></path>
|
|
27
|
+
</svg>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export default Group;
|
|
@@ -12,7 +12,7 @@ describe('Media URL helper', () => {
|
|
|
12
12
|
baseURL: 'https://twin.memori.ai',
|
|
13
13
|
apiURL: 'https://backend.memori.ai/api/v2',
|
|
14
14
|
})
|
|
15
|
-
).toBe('https://twin.memori.ai/images/memoriAvatar.png');
|
|
15
|
+
).toBe('https://twin.memori.ai/images/memoriAvatar.png?v=20231208');
|
|
16
16
|
});
|
|
17
17
|
it('Get default cover URL with no url', async () => {
|
|
18
18
|
expect(
|
package/src/helpers/media.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const getResourceUrl = ({
|
|
|
16
16
|
let defaultUri =
|
|
17
17
|
type === 'cover'
|
|
18
18
|
? `${baseURL}/images/memoriCover.png`
|
|
19
|
-
: `${baseURL}/images/memoriAvatar.png`;
|
|
19
|
+
: `${baseURL}/images/memoriAvatar.png?v=20231208`;
|
|
20
20
|
|
|
21
21
|
try {
|
|
22
22
|
if (!resourceURI || resourceURI.length === 0) {
|
package/src/i18n.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { initReactI18next } from 'react-i18next';
|
|
1
|
+
import { createInstance } from 'i18next';
|
|
3
2
|
import it from './locales/it.json';
|
|
4
3
|
import en from './locales/en.json';
|
|
5
4
|
|
|
@@ -12,7 +11,7 @@ const resources = {
|
|
|
12
11
|
},
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
i18n
|
|
14
|
+
const i18n = createInstance({
|
|
16
15
|
resources,
|
|
17
16
|
lng: 'en',
|
|
18
17
|
fallbackLng: 'it',
|
|
@@ -23,4 +22,6 @@ i18n.use(initReactI18next).init({
|
|
|
23
22
|
},
|
|
24
23
|
});
|
|
25
24
|
|
|
25
|
+
i18n.init();
|
|
26
|
+
|
|
26
27
|
export default i18n;
|
package/src/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import MemoriWidget, {
|
|
|
12
12
|
import { getTenant } from './helpers/tenant';
|
|
13
13
|
|
|
14
14
|
import i18n from './i18n';
|
|
15
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { I18nextProvider, useTranslation } from 'react-i18next';
|
|
16
16
|
|
|
17
17
|
export interface Props {
|
|
18
18
|
memoriName?: string | null;
|
|
@@ -202,7 +202,7 @@ const Memori: React.FC<Props> = ({
|
|
|
202
202
|
}
|
|
203
203
|
}, [uiLang]);
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
const renderer = memori ? (
|
|
206
206
|
<MemoriWidget
|
|
207
207
|
layout={layout}
|
|
208
208
|
customLayout={customLayout}
|
|
@@ -256,11 +256,19 @@ const Memori: React.FC<Props> = ({
|
|
|
256
256
|
justifyContent: 'center',
|
|
257
257
|
}}
|
|
258
258
|
>
|
|
259
|
-
<p
|
|
260
|
-
{
|
|
259
|
+
<p
|
|
260
|
+
style={{
|
|
261
|
+
textAlign: 'center',
|
|
262
|
+
margin: '2rem auto',
|
|
263
|
+
textTransform: 'capitalize',
|
|
264
|
+
}}
|
|
265
|
+
>
|
|
266
|
+
{t('loading') || 'Loading'}...
|
|
261
267
|
</p>
|
|
262
268
|
</div>
|
|
263
269
|
);
|
|
270
|
+
|
|
271
|
+
return <I18nextProvider i18n={i18n}>{renderer}</I18nextProvider>;
|
|
264
272
|
};
|
|
265
273
|
|
|
266
274
|
Memori.propTypes = {
|
package/src/locales/en.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"delete": "Delete",
|
|
13
13
|
"loading": "Loading",
|
|
14
14
|
"expand": "Expand",
|
|
15
|
+
"collapse": "Collapse",
|
|
15
16
|
"fullscreenEnter": "Enter fullscreen",
|
|
16
17
|
"fullscreenExit": "Exit fullscreen",
|
|
17
18
|
"center": "Center",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"completionProviderDown": "This Twin is integrated with a generative AI from {{provider}}, but it is currently unavailable. Try again later.",
|
|
35
36
|
"completionProviderFallbackName": "an external provider",
|
|
36
37
|
"completionProviderCheckStatusPage": "Check status page",
|
|
38
|
+
"boardOfExperts": "Board of experts",
|
|
37
39
|
"birthDate": "Birth date",
|
|
38
40
|
"birthDateHelper": "We ask for your birth date only to enable or disable functionalities that have age restrictions",
|
|
39
41
|
"underage": "You must be at least {{age}} years old to sign up.",
|
package/src/locales/it.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"delete": "Elimina",
|
|
13
13
|
"loading": "Caricamento",
|
|
14
14
|
"expand": "Espandi",
|
|
15
|
+
"collapse": "Riduci",
|
|
15
16
|
"fullscreenEnter": "Passa a schermo intero",
|
|
16
17
|
"fullscreenExit": "Esci da schermo intero",
|
|
17
18
|
"center": "Centro",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"completionProviderDown": "Questo Twin è integrato con una IA generativa di {{provider}}, ma al momento non è disponibile. Riprova più tardi.",
|
|
35
36
|
"completionProviderFallbackName": "un provider esterno",
|
|
36
37
|
"completionProviderCheckStatusPage": "Vedi pagina di stato",
|
|
38
|
+
"boardOfExperts": "Gruppo di esperti",
|
|
37
39
|
"birthDate": "Data di nascita",
|
|
38
40
|
"birthDateHelper": "Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all'età",
|
|
39
41
|
"underage": "Devi avere almeno {{age}} anni per registrarti.",
|