@memori.ai/memori-react 2.17.1 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +2 -0
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +2 -2
- package/dist/components/Header/Header.d.ts +2 -0
- package/dist/components/Header/Header.js +3 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/Header.test.js +10 -6
- package/dist/components/Header/Header.test.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +3 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +13 -4
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/icons/Clear.d.ts +5 -0
- package/dist/components/icons/Clear.js +6 -0
- package/dist/components/icons/Clear.js.map +1 -0
- package/dist/components/layouts/website-assistant.css +54 -23
- package/dist/styles.css +2 -1
- package/esm/components/Avatar/Avatar.js +1 -1
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +2 -2
- package/esm/components/Header/Header.d.ts +2 -0
- package/esm/components/Header/Header.js +3 -2
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/Header/Header.test.js +10 -6
- package/esm/components/Header/Header.test.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +3 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +13 -4
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/icons/Clear.d.ts +5 -0
- package/esm/components/icons/Clear.js +4 -0
- package/esm/components/icons/Clear.js.map +1 -0
- package/esm/components/layouts/website-assistant.css +54 -23
- package/esm/styles.css +2 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.tsx +7 -3
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +2 -2
- package/src/components/ChatBubble/ChatBubble.css +2 -2
- package/src/components/Header/Header.stories.tsx +26 -5
- package/src/components/Header/Header.test.tsx +25 -0
- package/src/components/Header/Header.tsx +15 -0
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +79 -1
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +22 -0
- package/src/components/MemoriWidget/MemoriWidget.tsx +20 -2
- package/src/components/icons/Clear.tsx +23 -0
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +1 -1
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +2 -2
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +2 -2
- package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +1 -1
- package/src/components/layouts/website-assistant.css +54 -23
- package/src/styles.css +2 -1
|
@@ -75,9 +75,13 @@ const Avatar: React.FC<Props> = ({
|
|
|
75
75
|
integrationConfig?.avatarURL ? (
|
|
76
76
|
<>
|
|
77
77
|
<div
|
|
78
|
-
className={cx(
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
className={cx(
|
|
79
|
+
'memori--avatar-wrapper',
|
|
80
|
+
`memori--avatar-${integrationConfig?.avatar || 'default'}`,
|
|
81
|
+
{
|
|
82
|
+
hidden: !avatar3dVisible,
|
|
83
|
+
}
|
|
84
|
+
)}
|
|
81
85
|
>
|
|
82
86
|
{isClient &&
|
|
83
87
|
(integrationConfig.avatar === 'readyplayerme' ||
|
|
@@ -38,7 +38,7 @@ exports[`renders Avatar with blob and avatar in blob unchanged 1`] = `
|
|
|
38
38
|
exports[`renders Avatar with custom glb model unchanged 1`] = `
|
|
39
39
|
<div>
|
|
40
40
|
<div
|
|
41
|
-
class="memori--avatar-wrapper"
|
|
41
|
+
class="memori--avatar-wrapper memori--avatar-customglb"
|
|
42
42
|
>
|
|
43
43
|
<div
|
|
44
44
|
class="model-viewer"
|
|
@@ -92,7 +92,7 @@ exports[`renders Avatar with custom glb model unchanged 1`] = `
|
|
|
92
92
|
exports[`renders Avatar with rpm 3d avatar unchanged 1`] = `
|
|
93
93
|
<div>
|
|
94
94
|
<div
|
|
95
|
-
class="memori--avatar-wrapper"
|
|
95
|
+
class="memori--avatar-wrapper memori--avatar-readyplayerme"
|
|
96
96
|
>
|
|
97
97
|
<div
|
|
98
98
|
class="memori--blob-container"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
.memori-chat--bubble.memori-chat--user-bubble {
|
|
83
83
|
border-radius: 16px 16px 0 16px;
|
|
84
84
|
margin: 10px 10px 5px auto;
|
|
85
|
-
background: var(--memori-
|
|
85
|
+
background: var(--memori-chat-user-bubble-bg);
|
|
86
86
|
box-shadow: 0 1px 6px 0 #d1d3de, 0 1px 3px 0 #c5c6d1;
|
|
87
87
|
color: var(--memori-primary-text);
|
|
88
88
|
}
|
|
@@ -236,4 +236,4 @@
|
|
|
236
236
|
30% {
|
|
237
237
|
transform: translateY(-10px);
|
|
238
238
|
}
|
|
239
|
-
}
|
|
239
|
+
}
|
|
@@ -42,12 +42,13 @@ const Template: Story<Props> = args => {
|
|
|
42
42
|
<SettingsDrawer
|
|
43
43
|
open={!!showSettingsDrawer}
|
|
44
44
|
onClose={() => setShowSettingsDrawer(false)}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
setContinuousSpeechTimeout={
|
|
49
|
-
setControlsPosition={() => {}}
|
|
45
|
+
microphoneMode="HOLD_TO_TALK"
|
|
46
|
+
setMicrophoneMode={() => {}}
|
|
47
|
+
continuousSpeechTimeout={2}
|
|
48
|
+
setContinuousSpeechTimeout={() => {}}
|
|
50
49
|
controlsPosition="bottom"
|
|
50
|
+
setControlsPosition={() => {}}
|
|
51
|
+
hideEmissions={false}
|
|
51
52
|
setHideEmissions={() => {}}
|
|
52
53
|
/>
|
|
53
54
|
</>
|
|
@@ -62,6 +63,7 @@ Default.args = {
|
|
|
62
63
|
history,
|
|
63
64
|
setShowPositionDrawer: () => {},
|
|
64
65
|
setShowSettingsDrawer: () => {},
|
|
66
|
+
clearHistory: () => {},
|
|
65
67
|
speakerMuted: false,
|
|
66
68
|
hasUserActivatedSpeak: false,
|
|
67
69
|
showShare: false,
|
|
@@ -82,6 +84,7 @@ WithPosition.args = {
|
|
|
82
84
|
},
|
|
83
85
|
setShowPositionDrawer: () => {},
|
|
84
86
|
setShowSettingsDrawer: () => {},
|
|
87
|
+
clearHistory: () => {},
|
|
85
88
|
speakerMuted: false,
|
|
86
89
|
hasUserActivatedSpeak: false,
|
|
87
90
|
showShare: false,
|
|
@@ -94,6 +97,7 @@ SpeakerMuted.args = {
|
|
|
94
97
|
history,
|
|
95
98
|
setShowPositionDrawer: () => {},
|
|
96
99
|
setShowSettingsDrawer: () => {},
|
|
100
|
+
clearHistory: () => {},
|
|
97
101
|
speakerMuted: true,
|
|
98
102
|
hasUserActivatedSpeak: false,
|
|
99
103
|
showShare: false,
|
|
@@ -106,6 +110,7 @@ WithShare.args = {
|
|
|
106
110
|
history,
|
|
107
111
|
setShowPositionDrawer: () => {},
|
|
108
112
|
setShowSettingsDrawer: () => {},
|
|
113
|
+
clearHistory: () => {},
|
|
109
114
|
speakerMuted: false,
|
|
110
115
|
hasUserActivatedSpeak: false,
|
|
111
116
|
showShare: true,
|
|
@@ -118,18 +123,34 @@ WithSettings.args = {
|
|
|
118
123
|
history,
|
|
119
124
|
setShowPositionDrawer: () => {},
|
|
120
125
|
setShowSettingsDrawer: () => {},
|
|
126
|
+
clearHistory: () => {},
|
|
121
127
|
speakerMuted: false,
|
|
122
128
|
hasUserActivatedSpeak: false,
|
|
123
129
|
showShare: false,
|
|
124
130
|
showSettings: true,
|
|
125
131
|
};
|
|
126
132
|
|
|
133
|
+
export const WithClear = Template.bind({});
|
|
134
|
+
WithClear.args = {
|
|
135
|
+
memori,
|
|
136
|
+
history,
|
|
137
|
+
setShowPositionDrawer: () => {},
|
|
138
|
+
setShowSettingsDrawer: () => {},
|
|
139
|
+
clearHistory: () => {},
|
|
140
|
+
speakerMuted: false,
|
|
141
|
+
hasUserActivatedSpeak: false,
|
|
142
|
+
showShare: false,
|
|
143
|
+
showSettings: false,
|
|
144
|
+
showClear: true,
|
|
145
|
+
};
|
|
146
|
+
|
|
127
147
|
export const WithOngoingChat = Template.bind({});
|
|
128
148
|
WithOngoingChat.args = {
|
|
129
149
|
memori,
|
|
130
150
|
history,
|
|
131
151
|
setShowPositionDrawer: () => {},
|
|
132
152
|
setShowSettingsDrawer: () => {},
|
|
153
|
+
clearHistory: () => {},
|
|
133
154
|
speakerMuted: false,
|
|
134
155
|
hasUserActivatedSpeak: true,
|
|
135
156
|
showShare: false,
|
|
@@ -15,6 +15,7 @@ it('renders Header unchanged', () => {
|
|
|
15
15
|
hasUserActivatedSpeak={false}
|
|
16
16
|
showShare={false}
|
|
17
17
|
showSettings={false}
|
|
18
|
+
clearHistory={jest.fn()}
|
|
18
19
|
/>
|
|
19
20
|
);
|
|
20
21
|
expect(container).toMatchSnapshot();
|
|
@@ -40,6 +41,7 @@ it('renders Header with position unchanged', () => {
|
|
|
40
41
|
hasUserActivatedSpeak={false}
|
|
41
42
|
showShare={false}
|
|
42
43
|
showSettings={false}
|
|
44
|
+
clearHistory={jest.fn()}
|
|
43
45
|
/>
|
|
44
46
|
);
|
|
45
47
|
expect(container).toMatchSnapshot();
|
|
@@ -57,6 +59,7 @@ it('renders Header with speaker muted unchanged', () => {
|
|
|
57
59
|
hasUserActivatedSpeak={false}
|
|
58
60
|
showShare={false}
|
|
59
61
|
showSettings={false}
|
|
62
|
+
clearHistory={jest.fn()}
|
|
60
63
|
/>
|
|
61
64
|
);
|
|
62
65
|
expect(container).toMatchSnapshot();
|
|
@@ -74,6 +77,7 @@ it('renders Header with share button unchanged', () => {
|
|
|
74
77
|
hasUserActivatedSpeak={false}
|
|
75
78
|
showShare={true}
|
|
76
79
|
showSettings={false}
|
|
80
|
+
clearHistory={jest.fn()}
|
|
77
81
|
/>
|
|
78
82
|
);
|
|
79
83
|
expect(container).toMatchSnapshot();
|
|
@@ -91,6 +95,26 @@ it('renders Header with settings button unchanged', () => {
|
|
|
91
95
|
hasUserActivatedSpeak={false}
|
|
92
96
|
showShare={false}
|
|
93
97
|
showSettings={true}
|
|
98
|
+
clearHistory={jest.fn()}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
expect(container).toMatchSnapshot();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('renders Header with clear button unchanged', () => {
|
|
105
|
+
const { container } = render(
|
|
106
|
+
<Header
|
|
107
|
+
memori={memori}
|
|
108
|
+
history={history}
|
|
109
|
+
setShowPositionDrawer={jest.fn()}
|
|
110
|
+
setShowSettingsDrawer={jest.fn()}
|
|
111
|
+
speakerMuted={false}
|
|
112
|
+
setSpeakerMuted={jest.fn()}
|
|
113
|
+
hasUserActivatedSpeak={false}
|
|
114
|
+
showShare={false}
|
|
115
|
+
showSettings={false}
|
|
116
|
+
showClear
|
|
117
|
+
clearHistory={jest.fn()}
|
|
94
118
|
/>
|
|
95
119
|
);
|
|
96
120
|
expect(container).toMatchSnapshot();
|
|
@@ -108,6 +132,7 @@ it('renders Header with user activated speak unchanged', () => {
|
|
|
108
132
|
hasUserActivatedSpeak={true}
|
|
109
133
|
showShare={false}
|
|
110
134
|
showSettings={false}
|
|
135
|
+
clearHistory={jest.fn()}
|
|
111
136
|
/>
|
|
112
137
|
);
|
|
113
138
|
expect(container).toMatchSnapshot();
|
|
@@ -16,6 +16,7 @@ import ShareButton from '../ShareButton/ShareButton';
|
|
|
16
16
|
import FullscreenExit from '../icons/FullscreenExit';
|
|
17
17
|
import Fullscreen from '../icons/Fullscreen';
|
|
18
18
|
import Refresh from '../icons/Refresh';
|
|
19
|
+
import Clear from '../icons/Clear';
|
|
19
20
|
|
|
20
21
|
export interface Props {
|
|
21
22
|
className?: string;
|
|
@@ -31,6 +32,8 @@ export interface Props {
|
|
|
31
32
|
showSettings?: boolean;
|
|
32
33
|
showSpeaker?: boolean;
|
|
33
34
|
showReload?: boolean;
|
|
35
|
+
showClear?: boolean;
|
|
36
|
+
clearHistory: () => void;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
const Header: React.FC<Props> = ({
|
|
@@ -47,6 +50,8 @@ const Header: React.FC<Props> = ({
|
|
|
47
50
|
showSettings = true,
|
|
48
51
|
showSpeaker = true,
|
|
49
52
|
showReload = false,
|
|
53
|
+
showClear = false,
|
|
54
|
+
clearHistory,
|
|
50
55
|
}) => {
|
|
51
56
|
const { t } = useTranslation();
|
|
52
57
|
const [fullScreenAvailable, setFullScreenAvailable] = useState(false);
|
|
@@ -71,6 +76,16 @@ const Header: React.FC<Props> = ({
|
|
|
71
76
|
}}
|
|
72
77
|
/>
|
|
73
78
|
)}
|
|
79
|
+
{showClear && (
|
|
80
|
+
<Button
|
|
81
|
+
primary
|
|
82
|
+
shape="circle"
|
|
83
|
+
className="memori-header--button memori-header--button--clear"
|
|
84
|
+
title={t('clearHistory') || 'Clear chat'}
|
|
85
|
+
icon={<Clear />}
|
|
86
|
+
onClick={clearHistory}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
74
89
|
{memori.needsPosition && position && (
|
|
75
90
|
<div className="memori-header--position">
|
|
76
91
|
<span className="memori-header--position-placeName">
|
|
@@ -58,6 +58,84 @@ exports[`renders Header unchanged 1`] = `
|
|
|
58
58
|
</div>
|
|
59
59
|
`;
|
|
60
60
|
|
|
61
|
+
exports[`renders Header with clear button unchanged 1`] = `
|
|
62
|
+
<div>
|
|
63
|
+
<div
|
|
64
|
+
class="memori-header"
|
|
65
|
+
>
|
|
66
|
+
<button
|
|
67
|
+
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--clear"
|
|
68
|
+
title="clearHistory"
|
|
69
|
+
>
|
|
70
|
+
<span
|
|
71
|
+
class="memori-button--icon"
|
|
72
|
+
>
|
|
73
|
+
<svg
|
|
74
|
+
aria-hidden="true"
|
|
75
|
+
focusable="false"
|
|
76
|
+
role="img"
|
|
77
|
+
viewBox="0 0 1024 1024"
|
|
78
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
79
|
+
>
|
|
80
|
+
<path
|
|
81
|
+
d="M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-.3 1.5-.4 3-.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-.1 4.4-.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"
|
|
82
|
+
/>
|
|
83
|
+
</svg>
|
|
84
|
+
</span>
|
|
85
|
+
</button>
|
|
86
|
+
<button
|
|
87
|
+
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--speaker"
|
|
88
|
+
title="widget.sound"
|
|
89
|
+
>
|
|
90
|
+
<span
|
|
91
|
+
class="memori-button--icon"
|
|
92
|
+
>
|
|
93
|
+
<svg
|
|
94
|
+
aria-hidden="true"
|
|
95
|
+
focusable="false"
|
|
96
|
+
role="img"
|
|
97
|
+
viewBox="0 0 1024 1024"
|
|
98
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
99
|
+
>
|
|
100
|
+
<path
|
|
101
|
+
d="M625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1zM586 803L293.4 611.7l-18-11.7H146V424h129.4l17.9-11.7L586 221v582zm348-327H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zm-41.9 261.8l-110.3-63.7a15.9 15.9 0 00-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0021.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM760 344a15.9 15.9 0 0021.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 00-21.7-5.9L746 287.8a15.99 15.99 0 00-5.8 21.8L760 344z"
|
|
102
|
+
/>
|
|
103
|
+
</svg>
|
|
104
|
+
</span>
|
|
105
|
+
</button>
|
|
106
|
+
<div
|
|
107
|
+
class="memori-export-history-button memori-header--button memori-header--button--export"
|
|
108
|
+
data-headlessui-state=""
|
|
109
|
+
title="write_and_speak.exportChatHistoryMessage"
|
|
110
|
+
>
|
|
111
|
+
<button
|
|
112
|
+
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
113
|
+
data-headlessui-state=""
|
|
114
|
+
disabled=""
|
|
115
|
+
id="headlessui-popover-button-:rr:"
|
|
116
|
+
type="button"
|
|
117
|
+
>
|
|
118
|
+
<div
|
|
119
|
+
class="memori-button--icon"
|
|
120
|
+
>
|
|
121
|
+
<svg
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
focusable="false"
|
|
124
|
+
role="img"
|
|
125
|
+
viewBox="0 0 1024 1024"
|
|
126
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
127
|
+
>
|
|
128
|
+
<path
|
|
129
|
+
d="M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"
|
|
130
|
+
/>
|
|
131
|
+
</svg>
|
|
132
|
+
</div>
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
`;
|
|
138
|
+
|
|
61
139
|
exports[`renders Header with position unchanged 1`] = `
|
|
62
140
|
<div>
|
|
63
141
|
<div
|
|
@@ -405,7 +483,7 @@ exports[`renders Header with user activated speak unchanged 1`] = `
|
|
|
405
483
|
aria-expanded="false"
|
|
406
484
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
407
485
|
data-headlessui-state=""
|
|
408
|
-
id="headlessui-popover-button-:
|
|
486
|
+
id="headlessui-popover-button-:r10:"
|
|
409
487
|
type="button"
|
|
410
488
|
>
|
|
411
489
|
<div
|
|
@@ -121,6 +121,28 @@ ShowSettings.args = {
|
|
|
121
121
|
showSettings: true,
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
+
export const ShowClear = Template.bind({});
|
|
125
|
+
ShowClear.args = {
|
|
126
|
+
memori,
|
|
127
|
+
tenant,
|
|
128
|
+
showClear: true,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const ShowOnlyLastMessages = Template.bind({});
|
|
132
|
+
ShowOnlyLastMessages.args = {
|
|
133
|
+
memori,
|
|
134
|
+
tenant,
|
|
135
|
+
showOnlyLastMessages: true,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const ShowOnlyLastMessagesWithAnotherDefault = Template.bind({});
|
|
139
|
+
ShowOnlyLastMessagesWithAnotherDefault.args = {
|
|
140
|
+
memori,
|
|
141
|
+
tenant,
|
|
142
|
+
showOnlyLastMessages: false,
|
|
143
|
+
layout: 'WEBSITE_ASSISTANT',
|
|
144
|
+
};
|
|
145
|
+
|
|
124
146
|
export const WithAzureSpeechKey = Template.bind({});
|
|
125
147
|
WithAzureSpeechKey.args = {
|
|
126
148
|
memori,
|
|
@@ -298,6 +298,8 @@ export interface Props {
|
|
|
298
298
|
showDates?: boolean;
|
|
299
299
|
showContextPerLine?: boolean;
|
|
300
300
|
showSettings?: boolean;
|
|
301
|
+
showClear?: boolean;
|
|
302
|
+
showOnlyLastMessages?: boolean;
|
|
301
303
|
showTypingText?: boolean;
|
|
302
304
|
preview?: boolean;
|
|
303
305
|
embed?: boolean;
|
|
@@ -340,6 +342,8 @@ const MemoriWidget = ({
|
|
|
340
342
|
showContextPerLine = false,
|
|
341
343
|
showSettings = true,
|
|
342
344
|
showTypingText = false,
|
|
345
|
+
showClear = false,
|
|
346
|
+
showOnlyLastMessages,
|
|
343
347
|
height = '100vh',
|
|
344
348
|
secret,
|
|
345
349
|
baseUrl = 'https://app.twincreator.com',
|
|
@@ -1984,7 +1988,13 @@ const MemoriWidget = ({
|
|
|
1984
1988
|
) as CSSProperties;
|
|
1985
1989
|
|
|
1986
1990
|
const integrationStylesheet = `
|
|
1987
|
-
${
|
|
1991
|
+
${
|
|
1992
|
+
preview
|
|
1993
|
+
? '#preview,'
|
|
1994
|
+
: selectedLayout === 'WEBSITE_ASSISTANT'
|
|
1995
|
+
? ''
|
|
1996
|
+
: ':root,'
|
|
1997
|
+
} .memori-widget {
|
|
1988
1998
|
${Object.entries(integrationProperties)
|
|
1989
1999
|
.map(([key, value]) => `${key}: ${value};`)
|
|
1990
2000
|
.join('\n')}
|
|
@@ -2495,6 +2505,11 @@ const MemoriWidget = ({
|
|
|
2495
2505
|
};
|
|
2496
2506
|
}, []);
|
|
2497
2507
|
|
|
2508
|
+
const showFullHistory =
|
|
2509
|
+
showOnlyLastMessages === undefined
|
|
2510
|
+
? layout !== 'TOTEM' && layout !== 'WEBSITE_ASSISTANT'
|
|
2511
|
+
: !showOnlyLastMessages;
|
|
2512
|
+
|
|
2498
2513
|
const headerProps: HeaderProps = {
|
|
2499
2514
|
memori,
|
|
2500
2515
|
history,
|
|
@@ -2521,6 +2536,8 @@ const MemoriWidget = ({
|
|
|
2521
2536
|
showSettings,
|
|
2522
2537
|
hasUserActivatedSpeak,
|
|
2523
2538
|
showReload: selectedLayout === 'TOTEM',
|
|
2539
|
+
showClear,
|
|
2540
|
+
clearHistory: () => setHistory(h => h.slice(-1)),
|
|
2524
2541
|
};
|
|
2525
2542
|
|
|
2526
2543
|
const avatarProps: AvatarProps = {
|
|
@@ -2577,7 +2594,7 @@ const MemoriWidget = ({
|
|
|
2577
2594
|
memoriTyping,
|
|
2578
2595
|
typingText,
|
|
2579
2596
|
showTypingText,
|
|
2580
|
-
history:
|
|
2597
|
+
history: showFullHistory ? history : history.slice(-2),
|
|
2581
2598
|
authToken: loginToken,
|
|
2582
2599
|
dialogState: currentDialogState,
|
|
2583
2600
|
setDialogState: setCurrentDialogState,
|
|
@@ -2663,6 +2680,7 @@ const MemoriWidget = ({
|
|
|
2663
2680
|
'memori-widget',
|
|
2664
2681
|
`memori-layout-${layout.toLowerCase()}`,
|
|
2665
2682
|
`memori-controls-${controlsPosition.toLowerCase()}`,
|
|
2683
|
+
`memori--avatar-${integrationConfig?.avatar || 'default'}`,
|
|
2666
2684
|
{
|
|
2667
2685
|
'memori--preview': preview,
|
|
2668
2686
|
'memori--embed': embed,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const Clear = ({
|
|
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
|
+
viewBox="0 0 1024 1024"
|
|
16
|
+
className={className}
|
|
17
|
+
aria-label={title}
|
|
18
|
+
>
|
|
19
|
+
<path d="M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-.3 1.5-.4 3-.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-.1 4.4-.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"></path>
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default Clear;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`renders Chat layout unchanged 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="memori memori-widget memori-layout-chat memori-controls-bottom memori--with-integration"
|
|
6
|
+
class="memori memori-widget memori-layout-chat memori-controls-bottom memori--avatar-readyplayerme memori--with-integration"
|
|
7
7
|
data-memori-engine-state="{}"
|
|
8
8
|
data-memori-id="66b4e161-2431-4b21-9b70-d8c27de730ca"
|
|
9
9
|
data-memori-integration="cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`renders FullPage layout unchanged 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="memori memori-widget memori-layout-fullpage memori-controls-bottom memori--with-integration"
|
|
6
|
+
class="memori memori-widget memori-layout-fullpage memori-controls-bottom memori--avatar-readyplayerme memori--with-integration"
|
|
7
7
|
data-memori-engine-state="{}"
|
|
8
8
|
data-memori-id="66b4e161-2431-4b21-9b70-d8c27de730ca"
|
|
9
9
|
data-memori-integration="cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1"
|
|
@@ -128,7 +128,7 @@ exports[`renders FullPage layout unchanged 1`] = `
|
|
|
128
128
|
class="memori--grid-column memori--grid-column-left"
|
|
129
129
|
>
|
|
130
130
|
<div
|
|
131
|
-
class="memori--avatar-wrapper"
|
|
131
|
+
class="memori--avatar-wrapper memori--avatar-readyplayerme"
|
|
132
132
|
>
|
|
133
133
|
<div
|
|
134
134
|
class="memori--blob-container"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`renders Totem layout unchanged 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="memori memori-widget memori-layout-totem memori-controls-bottom memori--with-integration"
|
|
6
|
+
class="memori memori-widget memori-layout-totem memori-controls-bottom memori--avatar-readyplayerme memori--with-integration"
|
|
7
7
|
data-memori-engine-state="{}"
|
|
8
8
|
data-memori-id="66b4e161-2431-4b21-9b70-d8c27de730ca"
|
|
9
9
|
data-memori-integration="cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1"
|
|
@@ -179,7 +179,7 @@ exports[`renders Totem layout unchanged 1`] = `
|
|
|
179
179
|
class="memori-totem-layout--avatar"
|
|
180
180
|
>
|
|
181
181
|
<div
|
|
182
|
-
class="memori--avatar-wrapper"
|
|
182
|
+
class="memori--avatar-wrapper memori--avatar-readyplayerme"
|
|
183
183
|
>
|
|
184
184
|
<div
|
|
185
185
|
class="memori--blob-container"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`renders WEBSITE_ASSISTANT layout unchanged 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="memori memori-widget memori-layout-website_assistant memori-controls-bottom memori--with-integration"
|
|
6
|
+
class="memori memori-widget memori-layout-website_assistant memori-controls-bottom memori--avatar-readyplayerme memori--with-integration"
|
|
7
7
|
data-memori-engine-state="{}"
|
|
8
8
|
data-memori-id="66b4e161-2431-4b21-9b70-d8c27de730ca"
|
|
9
9
|
data-memori-integration="cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1"
|
|
@@ -44,6 +44,12 @@
|
|
|
44
44
|
box-shadow: 0 0 0.5em 0.2em rgba(0, 0, 0, 0.85) inset, 0 0 0.15em 0 rgba(255, 255, 255, 0.85);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
.memori-website_assistant--trigger-button .memori-blob,
|
|
48
|
+
.memori-website_assistant--trigger-button .memori-blob .mainDiv,
|
|
49
|
+
.memori-website_assistant--trigger-button .memori-blob figure {
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
touch-action: none;
|
|
52
|
+
}
|
|
47
53
|
|
|
48
54
|
@media (max-width: 768px) {
|
|
49
55
|
.memori-website_assistant--trigger-button .memori-blob {
|
|
@@ -94,7 +100,7 @@
|
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
.memori-website_assistant--trigger-button .memori-blob figure {
|
|
97
|
-
width:
|
|
103
|
+
width: 85%;
|
|
98
104
|
border-radius: 0;
|
|
99
105
|
opacity: 0.75;
|
|
100
106
|
}
|
|
@@ -221,23 +227,7 @@
|
|
|
221
227
|
margin-top: auto;
|
|
222
228
|
}
|
|
223
229
|
|
|
224
|
-
.memori-website_assistant-layout--avatar .memori--avatar-wrapper>div {
|
|
225
|
-
overflow: visible !important;
|
|
226
|
-
/* width: 100% !important;
|
|
227
|
-
height: 100% !important; */
|
|
228
|
-
width: auto !important;
|
|
229
|
-
height: 90% !important;
|
|
230
|
-
max-height: 90%;
|
|
231
|
-
border-radius: 0;
|
|
232
|
-
transform: scale(1.7) translate(0px, 10vh);
|
|
233
|
-
}
|
|
234
230
|
|
|
235
|
-
.memori-website_assistant-layout--avatar .memori--avatar-wrapper canvas {
|
|
236
|
-
width: auto !important;
|
|
237
|
-
max-width: 100%;
|
|
238
|
-
height: 100% !important;
|
|
239
|
-
max-height: 100%;
|
|
240
|
-
}
|
|
241
231
|
|
|
242
232
|
.memori-website_assistant-layout--controls {
|
|
243
233
|
position: relative;
|
|
@@ -331,26 +321,51 @@
|
|
|
331
321
|
z-index: 2;
|
|
332
322
|
}
|
|
333
323
|
|
|
334
|
-
.memori-website_assistant-layout--avatar .memori--avatar-wrapper
|
|
335
|
-
|
|
324
|
+
.memori-website_assistant-layout--avatar .memori--avatar-wrapper .avatar-loader {
|
|
325
|
+
display: flex;
|
|
336
326
|
width: 100%;
|
|
337
327
|
height: 100%;
|
|
328
|
+
align-items: center;
|
|
329
|
+
justify-content: center;
|
|
338
330
|
transform: none !important;
|
|
339
331
|
}
|
|
340
332
|
|
|
341
|
-
.memori-website_assistant
|
|
342
|
-
|
|
333
|
+
.memori-layout-website_assistant .memori--avatar-wrapper>div {
|
|
334
|
+
overflow: visible !important;
|
|
335
|
+
/* width: 100% !important;
|
|
336
|
+
height: 100% !important; */
|
|
337
|
+
width: auto !important;
|
|
338
|
+
height: 90% !important;
|
|
339
|
+
max-height: 90%;
|
|
340
|
+
border-radius: 0;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.memori-layout-website_assistant .memori--avatar-wrapper>div canvas+div {
|
|
344
|
+
position: absolute !important;
|
|
343
345
|
width: 100%;
|
|
344
346
|
height: 100%;
|
|
345
|
-
align-items: center;
|
|
346
|
-
justify-content: center;
|
|
347
347
|
transform: none !important;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
+
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper>div {
|
|
351
|
+
transform: scale(1.7) translate(0px, 10vh);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.memori-website_assistant-layout--avatar .memori--avatar-wrapper canvas {
|
|
355
|
+
width: auto !important;
|
|
356
|
+
max-width: 100%;
|
|
357
|
+
height: 100% !important;
|
|
358
|
+
max-height: 100%;
|
|
359
|
+
}
|
|
360
|
+
|
|
350
361
|
.memori-website_assistant-layout--avatar .memori--avatar-wrapper .avatar-loader figure {
|
|
351
362
|
text-align: center;
|
|
352
363
|
}
|
|
353
364
|
|
|
365
|
+
.memori-layout-website_assistant.memori--avatar-readyplayerme .memori-website_assistant--trigger-button .memori-blob figure {
|
|
366
|
+
width: 100%;
|
|
367
|
+
}
|
|
368
|
+
|
|
354
369
|
.memori-website_assistant-layout--avatar .memori--avatar-wrapper .avatar-loader .memori-spin--spinner {
|
|
355
370
|
background: none;
|
|
356
371
|
}
|
|
@@ -358,4 +373,20 @@
|
|
|
358
373
|
.memori-website_assistant-layout .memori--description-text,
|
|
359
374
|
.memori-website_assistant-layout .memori--translation-toggle {
|
|
360
375
|
display: none;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.memori-website_assistant-layout .memori-chat--bubble,
|
|
379
|
+
.memori-website_assistant-layout .memori-chat--bubble.memori-chat--user-bubble {
|
|
380
|
+
opacity: 0.6;
|
|
381
|
+
transition: opacity 0.2s ease-in-out;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.memori-website_assistant-layout .memori-chat--bubble p,
|
|
385
|
+
.memori-website_assistant-layout .memori-chat--bubble.memori-chat--user-bubble p {
|
|
386
|
+
opacity: 1;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.memori-website_assistant-layout .memori-chat--bubble:hover,
|
|
390
|
+
.memori-website_assistant-layout .memori-chat--bubble.memori-chat--user-bubble:hover {
|
|
391
|
+
opacity: 1;
|
|
361
392
|
}
|
package/src/styles.css
CHANGED
|
@@ -70,7 +70,8 @@ body.sb-show-main #root,
|
|
|
70
70
|
--memori-primary-text: #fff;
|
|
71
71
|
--memori-inner-content-pad: 1rem;
|
|
72
72
|
--memori-inner-bg: transparent;
|
|
73
|
-
--memori-chat-bubble-bg: #
|
|
73
|
+
--memori-chat-bubble-bg: #fff;
|
|
74
|
+
--memori-chat-user-bubble-bg: var(--memori-primary);
|
|
74
75
|
--memori-text-color: #000;
|
|
75
76
|
--memori-button-bg: #fff;
|
|
76
77
|
--memori-button-text: #000;
|