@memori.ai/memori-react 2.0.11 → 2.2.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 +29 -0
- package/README.md +74 -26
- package/dist/components/Chat/Chat.d.ts +1 -0
- package/dist/components/Chat/Chat.js +2 -2
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.js +1 -1
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.css +1 -41
- package/dist/components/ChatInputs/ChatInputs.d.ts +1 -0
- package/dist/components/ChatInputs/ChatInputs.js +9 -3
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/FeedbackButtons/FeedbackButtons.js +1 -1
- package/dist/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.js +1 -12
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +17 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +31 -19
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.css +101 -0
- package/dist/components/MicrophoneButton/MicrophoneButton.d.ts +9 -0
- package/dist/components/MicrophoneButton/MicrophoneButton.js +46 -0
- package/dist/components/MicrophoneButton/MicrophoneButton.js.map +1 -0
- package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +3 -3
- package/dist/components/SettingsDrawer/SettingsDrawer.js +8 -6
- package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/dist/components/SettingsDrawer/SettingsDrawer.test.js +7 -7
- package/dist/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.js +1 -1
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/layouts/FullPage.d.ts +2 -15
- package/dist/components/layouts/FullPage.js.map +1 -1
- package/dist/components/layouts/Totem.d.ts +2 -15
- package/dist/components/layouts/Totem.js.map +1 -1
- package/dist/components/ui/Button.d.ts +5 -1
- package/dist/components/ui/Button.js +1 -1
- package/dist/components/ui/Button.js.map +1 -1
- package/dist/components/ui/Tooltip.css +33 -2
- package/dist/components/ui/Tooltip.d.ts +2 -1
- package/dist/components/ui/Tooltip.js +1 -2
- package/dist/components/ui/Tooltip.js.map +1 -1
- package/dist/components/ui/Tooltip.test.js +16 -0
- package/dist/components/ui/Tooltip.test.js.map +1 -1
- package/dist/helpers/configuration.js +1 -1
- package/dist/helpers/configuration.js.map +1 -1
- package/dist/helpers/media.js +25 -19
- package/dist/helpers/media.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +4 -0
- package/dist/locales/it.json +4 -0
- package/dist/styles.css +3 -2
- package/esm/components/Chat/Chat.d.ts +1 -0
- package/esm/components/Chat/Chat.js +2 -2
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +1 -1
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.css +1 -41
- package/esm/components/ChatInputs/ChatInputs.d.ts +1 -0
- package/esm/components/ChatInputs/ChatInputs.js +9 -3
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/FeedbackButtons/FeedbackButtons.js +1 -1
- package/esm/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.js +1 -12
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +17 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +31 -19
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.css +101 -0
- package/esm/components/MicrophoneButton/MicrophoneButton.d.ts +9 -0
- package/esm/components/MicrophoneButton/MicrophoneButton.js +43 -0
- package/esm/components/MicrophoneButton/MicrophoneButton.js.map +1 -0
- package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +3 -3
- package/esm/components/SettingsDrawer/SettingsDrawer.js +9 -7
- package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.test.js +7 -7
- package/esm/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.js +1 -1
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/layouts/FullPage.d.ts +2 -15
- package/esm/components/layouts/FullPage.js.map +1 -1
- package/esm/components/layouts/Totem.d.ts +2 -15
- package/esm/components/layouts/Totem.js.map +1 -1
- package/esm/components/ui/Button.d.ts +5 -1
- package/esm/components/ui/Button.js +1 -1
- package/esm/components/ui/Button.js.map +1 -1
- package/esm/components/ui/Tooltip.css +33 -2
- package/esm/components/ui/Tooltip.d.ts +2 -1
- package/esm/components/ui/Tooltip.js +1 -2
- package/esm/components/ui/Tooltip.js.map +1 -1
- package/esm/components/ui/Tooltip.test.js +16 -0
- package/esm/components/ui/Tooltip.test.js.map +1 -1
- package/esm/helpers/configuration.js +1 -1
- package/esm/helpers/configuration.js.map +1 -1
- package/esm/helpers/media.js +25 -19
- package/esm/helpers/media.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/locales/en.json +4 -0
- package/esm/locales/it.json +4 -0
- package/esm/styles.css +3 -2
- package/package.json +1 -1
- package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +4 -4
- package/src/components/Chat/Chat.tsx +3 -0
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +6 -6
- package/src/components/ChatBubble/ChatBubble.tsx +1 -1
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +1 -1
- package/src/components/ChatInputs/ChatInputs.css +1 -41
- package/src/components/ChatInputs/ChatInputs.stories.tsx +50 -3
- package/src/components/ChatInputs/ChatInputs.tsx +20 -3
- package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +160 -85
- package/src/components/FeedbackButtons/FeedbackButtons.tsx +1 -1
- package/src/components/Header/Header.stories.tsx +3 -0
- package/src/components/MediaWidget/MediaItemWidget.tsx +1 -12
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +6 -6
- package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +1 -1
- package/src/components/MemoriWidget/MemoriWidget.tsx +53 -18
- package/src/components/MicrophoneButton/MicrophoneButton.css +101 -0
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +49 -0
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +95 -0
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +6 -4
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +14 -14
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +57 -25
- package/src/components/StartPanel/StartPanel.tsx +3 -3
- package/src/components/layouts/FullPage.tsx +2 -16
- package/src/components/layouts/Totem.tsx +2 -16
- package/src/components/layouts/layouts.stories.tsx +41 -1
- package/src/components/ui/Button.tsx +21 -1
- package/src/components/ui/Tooltip.css +33 -2
- package/src/components/ui/Tooltip.stories.tsx +40 -3
- package/src/components/ui/Tooltip.test.tsx +52 -0
- package/src/components/ui/Tooltip.tsx +12 -7
- package/src/components/ui/__snapshots__/Tooltip.test.tsx.snap +80 -4
- package/src/helpers/configuration.ts +1 -1
- package/src/helpers/media.ts +29 -23
- package/src/index.tsx +3 -0
- package/src/locales/en.json +4 -0
- package/src/locales/it.json +4 -0
- package/src/styles.css +3 -2
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Spin from '../ui/Spin';
|
|
3
|
+
import { LayoutProps } from '../MemoriWidget/MemoriWidget';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
header?: JSX.Element | null;
|
|
6
|
-
avatar: JSX.Element;
|
|
7
|
-
chat?: JSX.Element | null;
|
|
8
|
-
startPanel: JSX.Element;
|
|
9
|
-
integrationStyle?: JSX.Element | null;
|
|
10
|
-
integrationBackground?: JSX.Element | null;
|
|
11
|
-
changeMode?: JSX.Element | null;
|
|
12
|
-
poweredBy?: JSX.Element | null;
|
|
13
|
-
sessionId?: string;
|
|
14
|
-
hasUserActivatedSpeak?: boolean;
|
|
15
|
-
showInstruct?: boolean;
|
|
16
|
-
loading?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const TotemLayout: React.FC<Props> = ({
|
|
5
|
+
const TotemLayout: React.FC<LayoutProps> = ({
|
|
20
6
|
header,
|
|
21
7
|
avatar,
|
|
22
8
|
chat,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import { memori, tenant, integration } from '../../mocks/data';
|
|
4
|
-
import Memori, { Props } from '../MemoriWidget/MemoriWidget';
|
|
4
|
+
import Memori, { LayoutProps, Props } from '../MemoriWidget/MemoriWidget';
|
|
5
|
+
import Spin from '../ui/Spin';
|
|
5
6
|
|
|
6
7
|
const meta: Meta = {
|
|
7
8
|
title: 'General/Layouts',
|
|
@@ -21,6 +22,34 @@ const meta: Meta = {
|
|
|
21
22
|
|
|
22
23
|
export default meta;
|
|
23
24
|
|
|
25
|
+
const CustomLayout: React.FC<LayoutProps> = ({
|
|
26
|
+
header,
|
|
27
|
+
avatar,
|
|
28
|
+
chat,
|
|
29
|
+
startPanel,
|
|
30
|
+
integrationStyle,
|
|
31
|
+
integrationBackground,
|
|
32
|
+
changeMode,
|
|
33
|
+
sessionId,
|
|
34
|
+
hasUserActivatedSpeak,
|
|
35
|
+
showInstruct = false,
|
|
36
|
+
loading = false,
|
|
37
|
+
poweredBy,
|
|
38
|
+
}) => (
|
|
39
|
+
<>
|
|
40
|
+
{integrationStyle}
|
|
41
|
+
{integrationBackground}
|
|
42
|
+
|
|
43
|
+
<Spin spinning={loading} className="memori-mycustom-layout">
|
|
44
|
+
{poweredBy}
|
|
45
|
+
|
|
46
|
+
<div className="memori-mycustom-layout--controls">
|
|
47
|
+
{sessionId && hasUserActivatedSpeak ? chat : startPanel}
|
|
48
|
+
</div>
|
|
49
|
+
</Spin>
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
|
|
24
53
|
const Template: Story<Props> = args => <Memori {...args} />;
|
|
25
54
|
|
|
26
55
|
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
@@ -153,3 +182,14 @@ Totem.args = {
|
|
|
153
182
|
tenant,
|
|
154
183
|
layout: 'TOTEM',
|
|
155
184
|
};
|
|
185
|
+
|
|
186
|
+
export const Custom = Template.bind({});
|
|
187
|
+
Custom.args = {
|
|
188
|
+
uiLang: 'it',
|
|
189
|
+
showShare: true,
|
|
190
|
+
showSettings: true,
|
|
191
|
+
memori,
|
|
192
|
+
tenant,
|
|
193
|
+
layout: 'FULLPAGE',
|
|
194
|
+
customLayout: CustomLayout,
|
|
195
|
+
};
|
|
@@ -23,7 +23,19 @@ export interface Props {
|
|
|
23
23
|
id?: string;
|
|
24
24
|
htmlType?: 'button' | 'submit' | 'reset';
|
|
25
25
|
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
26
|
-
|
|
26
|
+
onMouseDown?: (
|
|
27
|
+
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
|
|
28
|
+
) => void;
|
|
29
|
+
onMouseUp?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
30
|
+
onMouseLeave?: (
|
|
31
|
+
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
|
|
32
|
+
) => void;
|
|
33
|
+
onTouchStart?: (
|
|
34
|
+
event: React.TouchEvent<HTMLButtonElement> | React.MouseEvent
|
|
35
|
+
) => void;
|
|
36
|
+
onTouchEnd?: (
|
|
37
|
+
event: React.TouchEvent<HTMLButtonElement> | React.MouseEvent
|
|
38
|
+
) => void;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
const Button: FC<Props> = ({
|
|
@@ -42,6 +54,10 @@ const Button: FC<Props> = ({
|
|
|
42
54
|
id,
|
|
43
55
|
htmlType,
|
|
44
56
|
onClick,
|
|
57
|
+
onMouseDown,
|
|
58
|
+
onMouseUp,
|
|
59
|
+
onMouseLeave,
|
|
60
|
+
onTouchStart,
|
|
45
61
|
onTouchEnd,
|
|
46
62
|
children,
|
|
47
63
|
}) => (
|
|
@@ -49,6 +65,10 @@ const Button: FC<Props> = ({
|
|
|
49
65
|
id={id}
|
|
50
66
|
type={htmlType}
|
|
51
67
|
onClick={onClick}
|
|
68
|
+
onMouseDown={onMouseDown}
|
|
69
|
+
onMouseUp={onMouseUp}
|
|
70
|
+
onMouseLeave={onMouseLeave}
|
|
71
|
+
onTouchStart={onTouchStart}
|
|
52
72
|
onTouchEnd={onTouchEnd}
|
|
53
73
|
title={title}
|
|
54
74
|
disabled={loading || disabled}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* stylelint-disable no-descending-specificity */
|
|
2
|
+
|
|
1
3
|
.memori-tooltip {
|
|
2
4
|
position: relative;
|
|
3
5
|
display: inline-block;
|
|
@@ -23,7 +25,8 @@
|
|
|
23
25
|
transition: 0.3s 0.1s all ease;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
.memori-tooltip.memori-tooltip--align-left .memori-tooltip--content
|
|
28
|
+
.memori-tooltip.memori-tooltip--align-left .memori-tooltip--content,
|
|
29
|
+
.memori-tooltip.memori-tooltip--align-topLeft .memori-tooltip--content {
|
|
27
30
|
right: 100%;
|
|
28
31
|
left: initial;
|
|
29
32
|
margin: initial;
|
|
@@ -52,6 +55,15 @@
|
|
|
52
55
|
margin-left: 0;
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
.memori-tooltip.memori-tooltip--align-topRight .memori-tooltip--content::before {
|
|
59
|
+
top: 100%;
|
|
60
|
+
right: auto;
|
|
61
|
+
left: 10px;
|
|
62
|
+
border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
|
|
63
|
+
margin-top: 10px;
|
|
64
|
+
margin-left: 5px;
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content,
|
|
56
68
|
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content::before {
|
|
57
69
|
display: block;
|
|
@@ -69,6 +81,25 @@
|
|
|
69
81
|
opacity: 1;
|
|
70
82
|
}
|
|
71
83
|
|
|
84
|
+
.memori-tooltip.memori-tooltip--align-topRight:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content,
|
|
85
|
+
.memori-tooltip.memori-tooltip--align-topRight:not(.memori-tooltip--disabled):not(.memori-tooltip--visible):hover .memori-tooltip--content {
|
|
86
|
+
transform: translateY(-150%) translateX(-33%);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.memori-tooltip.memori-tooltip--align-topLeft .memori-tooltip--content::before {
|
|
90
|
+
top: 100%;
|
|
91
|
+
right: 10px;
|
|
92
|
+
left: auto;
|
|
93
|
+
border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
|
|
94
|
+
margin-top: 10px;
|
|
95
|
+
margin-left: 5px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.memori-tooltip.memori-tooltip--align-topLeft:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content,
|
|
99
|
+
.memori-tooltip.memori-tooltip--align-topLeft:not(.memori-tooltip--disabled):not(.memori-tooltip--visible):hover .memori-tooltip--content {
|
|
100
|
+
transform: translateY(-150%) translateX(33%);
|
|
101
|
+
}
|
|
102
|
+
|
|
72
103
|
.memori-tooltip:not(.memori-tooltip--disabled).memori-tooltip--visible .memori-tooltip--content a,
|
|
73
104
|
.memori-tooltip:not(.memori-tooltip--disabled):not(.memori-tooltip--visible):hover .memori-tooltip--content a {
|
|
74
105
|
color: #fff;
|
|
@@ -77,4 +108,4 @@
|
|
|
77
108
|
|
|
78
109
|
.memori-tooltip.memori-tooltip--disabled {
|
|
79
110
|
cursor: not-allowed;
|
|
80
|
-
}
|
|
111
|
+
}
|
|
@@ -20,9 +20,21 @@ const meta: Meta = {
|
|
|
20
20
|
|
|
21
21
|
export default meta;
|
|
22
22
|
|
|
23
|
-
const Template: Story<Props> = args =>
|
|
23
|
+
const Template: Story<Props> = args => (
|
|
24
|
+
<div
|
|
25
|
+
style={{
|
|
26
|
+
display: 'flex',
|
|
27
|
+
justifyContent: 'flex-start',
|
|
28
|
+
paddingTop: '10rem',
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<Tooltip {...args} />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
24
34
|
const TemplateRight: Story<Props> = args => (
|
|
25
|
-
<div
|
|
35
|
+
<div
|
|
36
|
+
style={{ display: 'flex', justifyContent: 'flex-end', paddingTop: '10rem' }}
|
|
37
|
+
>
|
|
26
38
|
<Tooltip {...args} />
|
|
27
39
|
</div>
|
|
28
40
|
);
|
|
@@ -68,5 +80,30 @@ export const AlignLeft = TemplateRight.bind({});
|
|
|
68
80
|
AlignLeft.args = {
|
|
69
81
|
content: 'Here is some tooltip content',
|
|
70
82
|
children: <span>Hover me</span>,
|
|
71
|
-
|
|
83
|
+
align: 'left',
|
|
84
|
+
visible: true,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const AlignRight = Template.bind({});
|
|
88
|
+
AlignRight.args = {
|
|
89
|
+
content: 'Here is some tooltip content',
|
|
90
|
+
children: <span>Hover me</span>,
|
|
91
|
+
align: 'right',
|
|
92
|
+
visible: true,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const AlignTopLeft = TemplateRight.bind({});
|
|
96
|
+
AlignTopLeft.args = {
|
|
97
|
+
content: 'Here is some tooltip content',
|
|
98
|
+
children: <span>Hover me</span>,
|
|
99
|
+
align: 'topLeft',
|
|
100
|
+
visible: true,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const AlignTopRight = Template.bind({});
|
|
104
|
+
AlignTopRight.args = {
|
|
105
|
+
content: 'Here is some tooltip content',
|
|
106
|
+
children: <span>Hover me</span>,
|
|
107
|
+
align: 'topRight',
|
|
108
|
+
visible: true,
|
|
72
109
|
};
|
|
@@ -48,3 +48,55 @@ it('renders Tooltip visible unchanged', () => {
|
|
|
48
48
|
);
|
|
49
49
|
expect(container).toMatchSnapshot();
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
it('renders Tooltip aligned left unchanged', () => {
|
|
53
|
+
const { container } = render(
|
|
54
|
+
<Tooltip
|
|
55
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
56
|
+
visible
|
|
57
|
+
align="left"
|
|
58
|
+
>
|
|
59
|
+
Hover me
|
|
60
|
+
</Tooltip>
|
|
61
|
+
);
|
|
62
|
+
expect(container).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('renders Tooltip aligned top left unchanged', () => {
|
|
66
|
+
const { container } = render(
|
|
67
|
+
<Tooltip
|
|
68
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
69
|
+
visible
|
|
70
|
+
align="topLeft"
|
|
71
|
+
>
|
|
72
|
+
Hover me
|
|
73
|
+
</Tooltip>
|
|
74
|
+
);
|
|
75
|
+
expect(container).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('renders Tooltip aligned right unchanged', () => {
|
|
79
|
+
const { container } = render(
|
|
80
|
+
<Tooltip
|
|
81
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
82
|
+
visible
|
|
83
|
+
align="right"
|
|
84
|
+
>
|
|
85
|
+
Hover me
|
|
86
|
+
</Tooltip>
|
|
87
|
+
);
|
|
88
|
+
expect(container).toMatchSnapshot();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('renders Tooltip aligned top right unchanged', () => {
|
|
92
|
+
const { container } = render(
|
|
93
|
+
<Tooltip
|
|
94
|
+
content="Here is some tooltip content by default as I am controlled"
|
|
95
|
+
visible
|
|
96
|
+
align="topRight"
|
|
97
|
+
>
|
|
98
|
+
Hover me
|
|
99
|
+
</Tooltip>
|
|
100
|
+
);
|
|
101
|
+
expect(container).toMatchSnapshot();
|
|
102
|
+
});
|
|
@@ -4,7 +4,8 @@ import cx from 'classnames';
|
|
|
4
4
|
export interface Props {
|
|
5
5
|
content: string | JSX.Element | React.ReactNode;
|
|
6
6
|
className?: string;
|
|
7
|
-
|
|
7
|
+
align?: 'left' | 'right' | 'topLeft' | 'topRight';
|
|
8
|
+
alignTop?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
visible?: boolean;
|
|
@@ -13,17 +14,21 @@ export interface Props {
|
|
|
13
14
|
const Tooltip: FC<Props> = ({
|
|
14
15
|
content,
|
|
15
16
|
className,
|
|
16
|
-
|
|
17
|
+
align = 'right',
|
|
17
18
|
disabled = false,
|
|
18
19
|
visible = false,
|
|
19
20
|
children,
|
|
20
21
|
}) => (
|
|
21
22
|
<div
|
|
22
|
-
className={cx(
|
|
23
|
-
'memori-tooltip
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
className={cx(
|
|
24
|
+
'memori-tooltip',
|
|
25
|
+
`memori-tooltip--align-${align}`,
|
|
26
|
+
className,
|
|
27
|
+
{
|
|
28
|
+
'memori-tooltip--disabled': disabled,
|
|
29
|
+
'memori-tooltip--visible': visible,
|
|
30
|
+
}
|
|
31
|
+
)}
|
|
27
32
|
>
|
|
28
33
|
<div className="memori-tooltip--content">{content}</div>
|
|
29
34
|
<div className="memori-tooltip--trigger">{children}</div>
|
|
@@ -1,9 +1,85 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders Tooltip aligned left unchanged 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="memori-tooltip memori-tooltip--align-left memori-tooltip--visible"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="memori-tooltip--content"
|
|
10
|
+
>
|
|
11
|
+
Here is some tooltip content by default as I am controlled
|
|
12
|
+
</div>
|
|
13
|
+
<div
|
|
14
|
+
class="memori-tooltip--trigger"
|
|
15
|
+
>
|
|
16
|
+
Hover me
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`renders Tooltip aligned right unchanged 1`] = `
|
|
23
|
+
<div>
|
|
24
|
+
<div
|
|
25
|
+
class="memori-tooltip memori-tooltip--align-right memori-tooltip--visible"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="memori-tooltip--content"
|
|
29
|
+
>
|
|
30
|
+
Here is some tooltip content by default as I am controlled
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
class="memori-tooltip--trigger"
|
|
34
|
+
>
|
|
35
|
+
Hover me
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`renders Tooltip aligned top left unchanged 1`] = `
|
|
42
|
+
<div>
|
|
43
|
+
<div
|
|
44
|
+
class="memori-tooltip memori-tooltip--align-topLeft memori-tooltip--visible"
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
class="memori-tooltip--content"
|
|
48
|
+
>
|
|
49
|
+
Here is some tooltip content by default as I am controlled
|
|
50
|
+
</div>
|
|
51
|
+
<div
|
|
52
|
+
class="memori-tooltip--trigger"
|
|
53
|
+
>
|
|
54
|
+
Hover me
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`renders Tooltip aligned top right unchanged 1`] = `
|
|
61
|
+
<div>
|
|
62
|
+
<div
|
|
63
|
+
class="memori-tooltip memori-tooltip--align-topRight memori-tooltip--visible"
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
class="memori-tooltip--content"
|
|
67
|
+
>
|
|
68
|
+
Here is some tooltip content by default as I am controlled
|
|
69
|
+
</div>
|
|
70
|
+
<div
|
|
71
|
+
class="memori-tooltip--trigger"
|
|
72
|
+
>
|
|
73
|
+
Hover me
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
`;
|
|
78
|
+
|
|
3
79
|
exports[`renders Tooltip disabled unchanged 1`] = `
|
|
4
80
|
<div>
|
|
5
81
|
<div
|
|
6
|
-
class="memori-tooltip memori-tooltip--disabled"
|
|
82
|
+
class="memori-tooltip memori-tooltip--align-right memori-tooltip--disabled"
|
|
7
83
|
>
|
|
8
84
|
<div
|
|
9
85
|
class="memori-tooltip--content"
|
|
@@ -22,7 +98,7 @@ exports[`renders Tooltip disabled unchanged 1`] = `
|
|
|
22
98
|
exports[`renders Tooltip unchanged 1`] = `
|
|
23
99
|
<div>
|
|
24
100
|
<div
|
|
25
|
-
class="memori-tooltip"
|
|
101
|
+
class="memori-tooltip memori-tooltip--align-right"
|
|
26
102
|
>
|
|
27
103
|
<div
|
|
28
104
|
class="memori-tooltip--content"
|
|
@@ -41,7 +117,7 @@ exports[`renders Tooltip unchanged 1`] = `
|
|
|
41
117
|
exports[`renders Tooltip visible unchanged 1`] = `
|
|
42
118
|
<div>
|
|
43
119
|
<div
|
|
44
|
-
class="memori-tooltip memori-tooltip--visible"
|
|
120
|
+
class="memori-tooltip memori-tooltip--align-right memori-tooltip--visible"
|
|
45
121
|
>
|
|
46
122
|
<div
|
|
47
123
|
class="memori-tooltip--content"
|
|
@@ -60,7 +136,7 @@ exports[`renders Tooltip visible unchanged 1`] = `
|
|
|
60
136
|
exports[`renders Tooltip with jsx content unchanged 1`] = `
|
|
61
137
|
<div>
|
|
62
138
|
<div
|
|
63
|
-
class="memori-tooltip"
|
|
139
|
+
class="memori-tooltip memori-tooltip--align-right"
|
|
64
140
|
>
|
|
65
141
|
<div
|
|
66
142
|
class="memori-tooltip--content"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const keys: { [key: string]: string } = {
|
|
2
2
|
muteSpeaker: '@memori:muteSpeaker',
|
|
3
|
-
|
|
3
|
+
microphoneMode: '@memori:microphoneMode',
|
|
4
4
|
continuousSpeechTimeout: '@memori:continuousSpeechTimeout',
|
|
5
5
|
sendOnEnter: '@memori:sendOnEnter',
|
|
6
6
|
birthDate: '@memori:birthDate',
|
package/src/helpers/media.ts
CHANGED
|
@@ -17,28 +17,34 @@ export const getResourceUrl = ({
|
|
|
17
17
|
type === 'cover'
|
|
18
18
|
? `${baseURL}/images/memoriCover.png`
|
|
19
19
|
: `${baseURL}/images/memoriAvatar.png`;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
if (!resourceURI || resourceURI.length === 0) {
|
|
23
|
+
return defaultUri;
|
|
24
|
+
} else if (
|
|
25
|
+
resourceURI.includes('memoriai/memory') &&
|
|
26
|
+
!resourceURI.includes('memori-ai-session-id') &&
|
|
27
|
+
sessionID
|
|
28
|
+
) {
|
|
29
|
+
return `${resourceURI}?memori-ai-session-id=${sessionID}`;
|
|
30
|
+
} else if (
|
|
31
|
+
(resourceURI.startsWith('https://') ||
|
|
32
|
+
resourceURI.startsWith('http://')) &&
|
|
33
|
+
new URL(resourceURI).hostname.includes('memori.ai')
|
|
34
|
+
) {
|
|
35
|
+
return `${resourceURI}${sessionID ? `/${sessionID}` : ''}`;
|
|
36
|
+
} else if (resourceURI.startsWith('cloud://')) {
|
|
37
|
+
return `${
|
|
38
|
+
apiURL?.replace(/v2/, 'v1') || ''
|
|
39
|
+
}/CloudAsset/${resourceURI.replace('cloud://', '')}`;
|
|
40
|
+
} else if (resourceURI.startsWith('guid://')) {
|
|
41
|
+
return `${
|
|
42
|
+
apiURL?.replace(/v2/, 'v1') || ''
|
|
43
|
+
}/GuidAsset/${resourceURI.replace('guid://', '')}`;
|
|
44
|
+
} else {
|
|
45
|
+
return resourceURI || defaultUri;
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return resourceURI || defaultUri;
|
|
43
49
|
}
|
|
44
50
|
};
|
package/src/index.tsx
CHANGED
|
@@ -22,6 +22,7 @@ export interface Props {
|
|
|
22
22
|
secretToken?: string;
|
|
23
23
|
sessionID?: string;
|
|
24
24
|
layout?: WidgetProps['layout'];
|
|
25
|
+
customLayout?: WidgetProps['customLayout'];
|
|
25
26
|
showShare?: boolean;
|
|
26
27
|
showSettings?: boolean;
|
|
27
28
|
showInstruct?: boolean;
|
|
@@ -66,6 +67,7 @@ const Memori: React.FC<Props> = ({
|
|
|
66
67
|
secretToken,
|
|
67
68
|
sessionID,
|
|
68
69
|
layout = 'DEFAULT',
|
|
70
|
+
customLayout,
|
|
69
71
|
showShare = true,
|
|
70
72
|
showSettings = true,
|
|
71
73
|
showInstruct = false,
|
|
@@ -147,6 +149,7 @@ const Memori: React.FC<Props> = ({
|
|
|
147
149
|
return memori ? (
|
|
148
150
|
<MemoriWidget
|
|
149
151
|
layout={layout}
|
|
152
|
+
customLayout={customLayout}
|
|
150
153
|
height={height}
|
|
151
154
|
baseUrl={
|
|
152
155
|
baseURL ||
|
package/src/locales/en.json
CHANGED
|
@@ -70,6 +70,10 @@
|
|
|
70
70
|
"conversationStartedLabel": "Conversation started on",
|
|
71
71
|
"settingsHeaderLabel": "Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.",
|
|
72
72
|
"continuousSpeechLabel": "Continuous speech",
|
|
73
|
+
"holdToSpeak": "Hold to speak",
|
|
74
|
+
"releaseToEndListening": "Release to end listening",
|
|
75
|
+
"pressAndHoldToSpeak": "Press and hold to speak",
|
|
76
|
+
"microphoneMode": "Microphone mode",
|
|
73
77
|
"hideEmissionsLabel": "Hide text emitted by the Twin",
|
|
74
78
|
"secondsLabel": "Set seconds",
|
|
75
79
|
"controlsPosition": "Controls position",
|
package/src/locales/it.json
CHANGED
|
@@ -70,6 +70,10 @@
|
|
|
70
70
|
"conversationStartedLabel": "Conversazione avvenuta il",
|
|
71
71
|
"settingsHeaderLabel": "Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell'invio.",
|
|
72
72
|
"continuousSpeechLabel": "Conversazione continua",
|
|
73
|
+
"holdToSpeak": "Tieni premuto per parlare",
|
|
74
|
+
"releaseToEndListening": "Rilascia per smettere di parlare",
|
|
75
|
+
"pressAndHoldToSpeak": "Premi e tieni premuto per parlare",
|
|
76
|
+
"microphoneMode": "Modalità microfono",
|
|
73
77
|
"hideEmissionsLabel": "Nascondi testo emesso dal Twin",
|
|
74
78
|
"secondsLabel": "Secondi",
|
|
75
79
|
"controlsPosition": "Posizione dei controlli",
|
package/src/styles.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
@import url('./components/Chat/Chat.css');
|
|
18
18
|
@import url('./components/ChatBubble/ChatBubble.css');
|
|
19
19
|
@import url('./components/ChatInputs/ChatInputs.css');
|
|
20
|
+
@import url('./components/MicrophoneButton/MicrophoneButton.css');
|
|
20
21
|
@import url('./components/ChatTextArea/ChatTextArea.css');
|
|
21
22
|
@import url('./components/CustomGLBModelViewer/ModelViewer.css');
|
|
22
23
|
@import url('./components/SettingsDrawer/SettingsDrawer.css');
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
|
|
56
57
|
memori-client,
|
|
57
58
|
memori-client #root,
|
|
58
|
-
memori-client
|
|
59
|
+
memori-client+#headlessui-portal-root,
|
|
59
60
|
body.sb-show-main #root,
|
|
60
61
|
body.sb-show-main #headlessui-portal-root,
|
|
61
62
|
#storybook-root,
|
|
@@ -83,4 +84,4 @@ body.sb-show-main #headlessui-portal-root,
|
|
|
83
84
|
--memori-modal--width: 100%;
|
|
84
85
|
--memori-modal--width--md: 80%;
|
|
85
86
|
--memori-error-color: #ff4d4f;
|
|
86
|
-
}
|
|
87
|
+
}
|