@memori.ai/memori-react 2.23.0 → 3.0.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 +13 -0
- package/dist/I18nWrapper.d.ts +6 -0
- package/dist/I18nWrapper.js +9 -0
- package/dist/I18nWrapper.js.map +1 -0
- 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/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 +1 -0
- package/dist/locales/it.json +1 -0
- package/esm/I18nWrapper.d.ts +6 -0
- package/esm/I18nWrapper.js +6 -0
- package/esm/I18nWrapper.js.map +1 -0
- 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/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 +1 -0
- package/esm/locales/it.json +1 -0
- package/package.json +1 -1
- 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/__snapshots__/Chat.test.tsx.snap +11 -0
- package/src/components/ChatBubble/ChatBubble.stories.tsx +6 -2
- 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/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.stories.tsx +9 -6
- package/src/components/Typing/Typing.stories.tsx +6 -2
- package/src/components/UploadMenu/UploadMenu.stories.tsx +16 -13
- package/src/i18n.ts +4 -3
- package/src/index.tsx +12 -4
- package/src/locales/en.json +1 -0
- package/src/locales/it.json +1 -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 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 =>
|
|
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 =>
|
|
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({});
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
|
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