@memori.ai/memori-react 4.4.0 → 5.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 +43 -0
- package/README.md +4 -7
- package/dist/components/Chat/Chat.js +1 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +4 -2
- package/dist/components/ChatBubble/ChatBubble.js +1 -1
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/Header/Header.d.ts +2 -1
- package/dist/components/Header/Header.js +2 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MediaWidget/LinkItemWidget.js +1 -1
- package/dist/components/MediaWidget/LinkItemWidget.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +43 -45
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/PoweredBy/PoweredBy.css +2 -1
- package/dist/components/PoweredBy/PoweredBy.js +14 -2
- package/dist/components/PoweredBy/PoweredBy.js.map +1 -1
- package/dist/components/ShareButton/ShareButton.js +2 -2
- package/dist/components/ShareButton/ShareButton.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.css +1 -0
- package/dist/components/StartPanel/StartPanel.d.ts +2 -1
- package/dist/components/StartPanel/StartPanel.js +4 -2
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/Typing/Typing.js +6 -3
- package/dist/components/Typing/Typing.js.map +1 -1
- package/dist/components/layouts/website-assistant.css +0 -5
- package/dist/helpers/constants.js +8 -0
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/tenant.js +3 -3
- package/dist/helpers/tenant.js.map +1 -1
- package/dist/helpers/translations.js +1 -1
- package/dist/helpers/translations.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +4 -2
- package/dist/locales/it.json +4 -2
- package/esm/components/Chat/Chat.js +1 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +4 -2
- package/esm/components/ChatBubble/ChatBubble.js +1 -1
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/Header/Header.d.ts +2 -1
- package/esm/components/Header/Header.js +2 -2
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MediaWidget/LinkItemWidget.js +1 -1
- package/esm/components/MediaWidget/LinkItemWidget.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +43 -45
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/PoweredBy/PoweredBy.css +2 -1
- package/esm/components/PoweredBy/PoweredBy.js +14 -2
- package/esm/components/PoweredBy/PoweredBy.js.map +1 -1
- package/esm/components/ShareButton/ShareButton.js +2 -2
- package/esm/components/ShareButton/ShareButton.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.css +1 -0
- package/esm/components/StartPanel/StartPanel.d.ts +2 -1
- package/esm/components/StartPanel/StartPanel.js +4 -2
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/Typing/Typing.js +6 -3
- package/esm/components/Typing/Typing.js.map +1 -1
- package/esm/components/layouts/website-assistant.css +0 -5
- package/esm/helpers/constants.js +8 -0
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/tenant.js +3 -3
- package/esm/helpers/tenant.js.map +1 -1
- package/esm/helpers/translations.js +1 -1
- package/esm/helpers/translations.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/locales/en.json +4 -2
- package/esm/locales/it.json +4 -2
- package/package.json +2 -2
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +2 -2
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +44 -44
- package/src/components/ChatBubble/ChatBubble.css +4 -2
- package/src/components/ChatBubble/ChatBubble.tsx +1 -1
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +3 -3
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +1 -1
- package/src/components/ExpertsDrawer/ExpertsDrawer.test.tsx +2 -2
- package/src/components/Header/Header.test.tsx +58 -2
- package/src/components/Header/Header.tsx +4 -1
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +105 -32
- package/src/components/MediaWidget/LinkItemWidget.tsx +3 -3
- package/src/components/MemoriWidget/MemoriWidget.tsx +45 -42
- package/src/components/PoweredBy/PoweredBy.css +2 -1
- package/src/components/PoweredBy/PoweredBy.stories.tsx +17 -3
- package/src/components/PoweredBy/PoweredBy.tsx +18 -9
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +3 -3
- package/src/components/ShareButton/ShareButton.tsx +2 -2
- package/src/components/StartPanel/StartPanel.css +1 -0
- package/src/components/StartPanel/StartPanel.stories.tsx +45 -1
- package/src/components/StartPanel/StartPanel.test.tsx +52 -1
- package/src/components/StartPanel/StartPanel.tsx +15 -11
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +339 -26
- package/src/components/Typing/Typing.stories.tsx +42 -0
- package/src/components/Typing/Typing.tsx +6 -3
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +6 -6
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +6 -6
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +6 -6
- package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +2 -2
- package/src/components/layouts/layouts.stories.tsx +3 -3
- package/src/components/layouts/website-assistant.css +0 -5
- package/src/components/ui/definitions.stories.tsx +1 -1
- package/src/helpers/constants.ts +8 -0
- package/src/helpers/tenant.ts +3 -3
- package/src/helpers/translations.ts +1 -3
- package/src/index.stories.tsx +10 -10
- package/src/index.tsx +2 -2
- package/src/locales/en.json +4 -2
- package/src/locales/it.json +4 -2
- package/src/mocks/data.ts +28 -17
|
@@ -17,7 +17,7 @@ it('renders ExpertsDrawer unchanged', () => {
|
|
|
17
17
|
const { container } = render(
|
|
18
18
|
<ExpertsDrawer
|
|
19
19
|
onClose={jest.fn()}
|
|
20
|
-
baseUrl="https://
|
|
20
|
+
baseUrl="https://aisuru.com"
|
|
21
21
|
apiUrl="https://backend.memori.ai"
|
|
22
22
|
tenant={tenant}
|
|
23
23
|
experts={[
|
|
@@ -37,7 +37,7 @@ it('renders ExpertsDrawer open unchanged', () => {
|
|
|
37
37
|
<ExpertsDrawer
|
|
38
38
|
open
|
|
39
39
|
onClose={jest.fn()}
|
|
40
|
-
baseUrl="https://
|
|
40
|
+
baseUrl="https://aisuru.com"
|
|
41
41
|
apiUrl="https://backend.memori.ai"
|
|
42
42
|
tenant={tenant}
|
|
43
43
|
experts={[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
|
-
import { memori, history } from '../../mocks/data';
|
|
3
|
+
import { memori, history, user } from '../../mocks/data';
|
|
4
4
|
import Header from './Header';
|
|
5
5
|
|
|
6
6
|
it('renders Header unchanged', () => {
|
|
@@ -152,7 +152,7 @@ it('renders Header with user activated speak unchanged', () => {
|
|
|
152
152
|
expect(container).toMatchSnapshot();
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
it('renders Header with deep thought unchanged', () => {
|
|
155
|
+
it('renders Header with deep thought unlogged unchanged', () => {
|
|
156
156
|
const { container } = render(
|
|
157
157
|
<Header
|
|
158
158
|
memori={{
|
|
@@ -176,6 +176,62 @@ it('renders Header with deep thought unchanged', () => {
|
|
|
176
176
|
expect(container).toMatchSnapshot();
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
+
it('renders Header with deep thought logged but without permission flag unchanged', () => {
|
|
180
|
+
const { container } = render(
|
|
181
|
+
<Header
|
|
182
|
+
memori={{
|
|
183
|
+
...memori,
|
|
184
|
+
enableDeepThought: true,
|
|
185
|
+
}}
|
|
186
|
+
history={history}
|
|
187
|
+
setShowPositionDrawer={jest.fn()}
|
|
188
|
+
setShowSettingsDrawer={jest.fn()}
|
|
189
|
+
setShowKnownFactsDrawer={jest.fn()}
|
|
190
|
+
setShowExpertsDrawer={jest.fn()}
|
|
191
|
+
speakerMuted={false}
|
|
192
|
+
setSpeakerMuted={jest.fn()}
|
|
193
|
+
hasUserActivatedSpeak={false}
|
|
194
|
+
showShare={false}
|
|
195
|
+
showSettings={false}
|
|
196
|
+
clearHistory={jest.fn()}
|
|
197
|
+
loginToken="abcd"
|
|
198
|
+
user={{
|
|
199
|
+
...user,
|
|
200
|
+
pAndCUAccepted: false,
|
|
201
|
+
}}
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
204
|
+
expect(container).toMatchSnapshot();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('renders Header with deep thought logged with permission flag unchanged', () => {
|
|
208
|
+
const { container } = render(
|
|
209
|
+
<Header
|
|
210
|
+
memori={{
|
|
211
|
+
...memori,
|
|
212
|
+
enableDeepThought: true,
|
|
213
|
+
}}
|
|
214
|
+
history={history}
|
|
215
|
+
setShowPositionDrawer={jest.fn()}
|
|
216
|
+
setShowSettingsDrawer={jest.fn()}
|
|
217
|
+
setShowKnownFactsDrawer={jest.fn()}
|
|
218
|
+
setShowExpertsDrawer={jest.fn()}
|
|
219
|
+
speakerMuted={false}
|
|
220
|
+
setSpeakerMuted={jest.fn()}
|
|
221
|
+
hasUserActivatedSpeak={false}
|
|
222
|
+
showShare={false}
|
|
223
|
+
showSettings={false}
|
|
224
|
+
clearHistory={jest.fn()}
|
|
225
|
+
loginToken="abcd"
|
|
226
|
+
user={{
|
|
227
|
+
...user,
|
|
228
|
+
pAndCUAccepted: true,
|
|
229
|
+
}}
|
|
230
|
+
/>
|
|
231
|
+
);
|
|
232
|
+
expect(container).toMatchSnapshot();
|
|
233
|
+
});
|
|
234
|
+
|
|
179
235
|
it('renders Header with deep thought and session open unchanged', () => {
|
|
180
236
|
const { container } = render(
|
|
181
237
|
<Header
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Message,
|
|
6
6
|
Tenant,
|
|
7
7
|
Venue,
|
|
8
|
+
User,
|
|
8
9
|
} from '@memori.ai/memori-api-client/dist/types';
|
|
9
10
|
import Button from '../ui/Button';
|
|
10
11
|
import MapMarker from '../icons/MapMarker';
|
|
@@ -41,6 +42,7 @@ export interface Props {
|
|
|
41
42
|
showClear?: boolean;
|
|
42
43
|
clearHistory: () => void;
|
|
43
44
|
loginToken?: string;
|
|
45
|
+
user?: User;
|
|
44
46
|
sessionID?: string;
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -64,6 +66,7 @@ const Header: React.FC<Props> = ({
|
|
|
64
66
|
showClear = false,
|
|
65
67
|
clearHistory,
|
|
66
68
|
loginToken,
|
|
69
|
+
user,
|
|
67
70
|
sessionID,
|
|
68
71
|
}) => {
|
|
69
72
|
const { t } = useTranslation();
|
|
@@ -134,7 +137,7 @@ const Header: React.FC<Props> = ({
|
|
|
134
137
|
}}
|
|
135
138
|
/>
|
|
136
139
|
)}
|
|
137
|
-
{memori.enableDeepThought && !!loginToken && (
|
|
140
|
+
{memori.enableDeepThought && !!loginToken && user?.pAndCUAccepted && (
|
|
138
141
|
<Button
|
|
139
142
|
primary={!!sessionID && !!hasUserActivatedSpeak}
|
|
140
143
|
shape="circle"
|
|
@@ -62,7 +62,7 @@ exports[`renders Header for board of experts unchanged 1`] = `
|
|
|
62
62
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
63
63
|
data-headlessui-state=""
|
|
64
64
|
disabled=""
|
|
65
|
-
id="headlessui-popover-button-:
|
|
65
|
+
id="headlessui-popover-button-:r1p:"
|
|
66
66
|
type="button"
|
|
67
67
|
>
|
|
68
68
|
<div
|
|
@@ -147,7 +147,7 @@ exports[`renders Header for board of experts with session open unchanged 1`] = `
|
|
|
147
147
|
aria-expanded="false"
|
|
148
148
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
149
149
|
data-headlessui-state=""
|
|
150
|
-
id="headlessui-popover-button-:
|
|
150
|
+
id="headlessui-popover-button-:r1u:"
|
|
151
151
|
type="button"
|
|
152
152
|
>
|
|
153
153
|
<div
|
|
@@ -313,48 +313,63 @@ exports[`renders Header with deep thought and session open unchanged 1`] = `
|
|
|
313
313
|
class="memori-header"
|
|
314
314
|
>
|
|
315
315
|
<button
|
|
316
|
-
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--
|
|
317
|
-
title="
|
|
316
|
+
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--speaker"
|
|
317
|
+
title="widget.sound"
|
|
318
318
|
>
|
|
319
319
|
<span
|
|
320
320
|
class="memori-button--icon"
|
|
321
321
|
>
|
|
322
322
|
<svg
|
|
323
323
|
aria-hidden="true"
|
|
324
|
-
fill="none"
|
|
325
324
|
focusable="false"
|
|
326
|
-
height="20"
|
|
327
325
|
role="img"
|
|
328
|
-
|
|
329
|
-
stroke-linecap="round"
|
|
330
|
-
stroke-linejoin="round"
|
|
331
|
-
stroke-width="3"
|
|
332
|
-
viewBox="0 0 48 48"
|
|
333
|
-
width="20"
|
|
326
|
+
viewBox="0 0 1024 1024"
|
|
334
327
|
xmlns="http://www.w3.org/2000/svg"
|
|
335
328
|
>
|
|
336
329
|
<path
|
|
337
|
-
d="
|
|
338
|
-
stroke-miterlimit="10"
|
|
339
|
-
/>
|
|
340
|
-
<path
|
|
341
|
-
d="M27.917 12L31.417 12"
|
|
342
|
-
/>
|
|
343
|
-
<path
|
|
344
|
-
d="M27.917 26L31.417 26"
|
|
345
|
-
/>
|
|
346
|
-
<path
|
|
347
|
-
d="M29.667 12L29.667 26"
|
|
348
|
-
/>
|
|
349
|
-
<path
|
|
350
|
-
d="M23.992 26L19.904 12 19.226 12 15.159 26"
|
|
351
|
-
/>
|
|
352
|
-
<path
|
|
353
|
-
d="M16.854 21.133L22.276 21.133"
|
|
330
|
+
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"
|
|
354
331
|
/>
|
|
355
332
|
</svg>
|
|
356
333
|
</span>
|
|
357
334
|
</button>
|
|
335
|
+
<div
|
|
336
|
+
class="memori-export-history-button memori-header--button memori-header--button--export"
|
|
337
|
+
data-headlessui-state=""
|
|
338
|
+
title="write_and_speak.exportChatHistoryMessage"
|
|
339
|
+
>
|
|
340
|
+
<button
|
|
341
|
+
aria-expanded="false"
|
|
342
|
+
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
343
|
+
data-headlessui-state=""
|
|
344
|
+
id="headlessui-popover-button-:r1k:"
|
|
345
|
+
type="button"
|
|
346
|
+
>
|
|
347
|
+
<div
|
|
348
|
+
class="memori-button--icon"
|
|
349
|
+
>
|
|
350
|
+
<svg
|
|
351
|
+
aria-hidden="true"
|
|
352
|
+
focusable="false"
|
|
353
|
+
role="img"
|
|
354
|
+
viewBox="0 0 1024 1024"
|
|
355
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
356
|
+
>
|
|
357
|
+
<path
|
|
358
|
+
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"
|
|
359
|
+
/>
|
|
360
|
+
</svg>
|
|
361
|
+
</div>
|
|
362
|
+
</button>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
`;
|
|
367
|
+
|
|
368
|
+
exports[`renders Header with deep thought logged but without permission flag unchanged 1`] = `
|
|
369
|
+
<div>
|
|
370
|
+
<div
|
|
371
|
+
class="memori-header"
|
|
372
|
+
>
|
|
358
373
|
<button
|
|
359
374
|
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--speaker"
|
|
360
375
|
title="widget.sound"
|
|
@@ -381,9 +396,9 @@ exports[`renders Header with deep thought and session open unchanged 1`] = `
|
|
|
381
396
|
title="write_and_speak.exportChatHistoryMessage"
|
|
382
397
|
>
|
|
383
398
|
<button
|
|
384
|
-
|
|
385
|
-
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
399
|
+
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
386
400
|
data-headlessui-state=""
|
|
401
|
+
disabled=""
|
|
387
402
|
id="headlessui-popover-button-:r1a:"
|
|
388
403
|
type="button"
|
|
389
404
|
>
|
|
@@ -408,7 +423,7 @@ exports[`renders Header with deep thought and session open unchanged 1`] = `
|
|
|
408
423
|
</div>
|
|
409
424
|
`;
|
|
410
425
|
|
|
411
|
-
exports[`renders Header with deep thought unchanged 1`] = `
|
|
426
|
+
exports[`renders Header with deep thought logged with permission flag unchanged 1`] = `
|
|
412
427
|
<div>
|
|
413
428
|
<div
|
|
414
429
|
class="memori-header"
|
|
@@ -457,6 +472,64 @@ exports[`renders Header with deep thought unchanged 1`] = `
|
|
|
457
472
|
</svg>
|
|
458
473
|
</span>
|
|
459
474
|
</button>
|
|
475
|
+
<button
|
|
476
|
+
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--speaker"
|
|
477
|
+
title="widget.sound"
|
|
478
|
+
>
|
|
479
|
+
<span
|
|
480
|
+
class="memori-button--icon"
|
|
481
|
+
>
|
|
482
|
+
<svg
|
|
483
|
+
aria-hidden="true"
|
|
484
|
+
focusable="false"
|
|
485
|
+
role="img"
|
|
486
|
+
viewBox="0 0 1024 1024"
|
|
487
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
488
|
+
>
|
|
489
|
+
<path
|
|
490
|
+
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"
|
|
491
|
+
/>
|
|
492
|
+
</svg>
|
|
493
|
+
</span>
|
|
494
|
+
</button>
|
|
495
|
+
<div
|
|
496
|
+
class="memori-export-history-button memori-header--button memori-header--button--export"
|
|
497
|
+
data-headlessui-state=""
|
|
498
|
+
title="write_and_speak.exportChatHistoryMessage"
|
|
499
|
+
>
|
|
500
|
+
<button
|
|
501
|
+
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
502
|
+
data-headlessui-state=""
|
|
503
|
+
disabled=""
|
|
504
|
+
id="headlessui-popover-button-:r1f:"
|
|
505
|
+
type="button"
|
|
506
|
+
>
|
|
507
|
+
<div
|
|
508
|
+
class="memori-button--icon"
|
|
509
|
+
>
|
|
510
|
+
<svg
|
|
511
|
+
aria-hidden="true"
|
|
512
|
+
focusable="false"
|
|
513
|
+
role="img"
|
|
514
|
+
viewBox="0 0 1024 1024"
|
|
515
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
516
|
+
>
|
|
517
|
+
<path
|
|
518
|
+
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"
|
|
519
|
+
/>
|
|
520
|
+
</svg>
|
|
521
|
+
</div>
|
|
522
|
+
</button>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
`;
|
|
527
|
+
|
|
528
|
+
exports[`renders Header with deep thought unlogged unchanged 1`] = `
|
|
529
|
+
<div>
|
|
530
|
+
<div
|
|
531
|
+
class="memori-header"
|
|
532
|
+
>
|
|
460
533
|
<button
|
|
461
534
|
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--speaker"
|
|
462
535
|
title="widget.sound"
|
|
@@ -31,9 +31,9 @@ export interface Props {
|
|
|
31
31
|
const getSiteInfo = async (url: string, baseUrl?: string) => {
|
|
32
32
|
try {
|
|
33
33
|
const data = await fetch(
|
|
34
|
-
`${
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
`${baseUrl || 'https://aisuru.com'}/api/linkpreview/${encodeURIComponent(
|
|
35
|
+
url
|
|
36
|
+
)}`
|
|
37
37
|
);
|
|
38
38
|
const siteInfo: ILinkPreviewInfo = await data.json();
|
|
39
39
|
return siteInfo;
|
|
@@ -377,7 +377,7 @@ const MemoriWidget = ({
|
|
|
377
377
|
showOnlyLastMessages,
|
|
378
378
|
height = '100vh',
|
|
379
379
|
secret,
|
|
380
|
-
baseUrl = 'https://
|
|
380
|
+
baseUrl = 'https://aisuru.com',
|
|
381
381
|
apiUrl = 'https://backend.memori.ai',
|
|
382
382
|
initialContextVars,
|
|
383
383
|
initialQuestion,
|
|
@@ -415,9 +415,19 @@ const MemoriWidget = ({
|
|
|
415
415
|
|
|
416
416
|
const [instruct, setInstruct] = useState(false);
|
|
417
417
|
|
|
418
|
+
const [loginToken, setLoginToken] = useState<string | undefined>(
|
|
419
|
+
additionalInfo?.loginToken ?? authToken
|
|
420
|
+
);
|
|
418
421
|
const [user, setUser] = useState<User>({
|
|
419
422
|
avatarURL: typeof userAvatar === 'string' ? userAvatar : undefined,
|
|
420
423
|
} as User);
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
if (loginToken) {
|
|
426
|
+
client.backend.getCurrentUser(loginToken).then(({ user, resultCode }) => {
|
|
427
|
+
if (user && resultCode === 0) setUser(user);
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}, [loginToken]);
|
|
421
431
|
|
|
422
432
|
const [clickedStart, setClickedStart] = useState(false);
|
|
423
433
|
const [gotErrorInOpening, setGotErrorInOpening] = useState(false);
|
|
@@ -1354,88 +1364,83 @@ const MemoriWidget = ({
|
|
|
1354
1364
|
i18n.language ??
|
|
1355
1365
|
'IT'
|
|
1356
1366
|
).toUpperCase();
|
|
1367
|
+
|
|
1368
|
+
let voiceType = memori.voiceType;
|
|
1369
|
+
if (memori.enableBoardOfExperts && currentDialogState?.emitter) {
|
|
1370
|
+
let expert = experts?.find(e => e.name === currentDialogState?.emitter);
|
|
1371
|
+
|
|
1372
|
+
// TODO: once got info from backend, select voice from expert
|
|
1373
|
+
// if (expert?.voiceType) {
|
|
1374
|
+
// voiceType = expert.voiceType;
|
|
1375
|
+
// }
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1357
1378
|
switch (voiceLang) {
|
|
1358
1379
|
case 'IT':
|
|
1359
1380
|
voice = `${
|
|
1360
|
-
|
|
1361
|
-
? 'it-IT-DiegoNeural'
|
|
1362
|
-
: 'it-IT-ElsaNeural'
|
|
1381
|
+
voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-ElsaNeural'
|
|
1363
1382
|
}`;
|
|
1364
1383
|
break;
|
|
1365
1384
|
case 'DE':
|
|
1366
1385
|
voice = `${
|
|
1367
|
-
|
|
1368
|
-
? 'de-DE-ConradNeural'
|
|
1369
|
-
: 'de-DE-KatjaNeural'
|
|
1386
|
+
voiceType === 'MALE' ? 'de-DE-ConradNeural' : 'de-DE-KatjaNeural'
|
|
1370
1387
|
}`;
|
|
1371
1388
|
break;
|
|
1372
1389
|
case 'EN':
|
|
1373
1390
|
voice = `${
|
|
1374
|
-
|
|
1375
|
-
? 'en-GB-RyanNeural'
|
|
1376
|
-
: 'en-GB-SoniaNeural'
|
|
1391
|
+
voiceType === 'MALE' ? 'en-GB-RyanNeural' : 'en-GB-SoniaNeural'
|
|
1377
1392
|
}`;
|
|
1378
1393
|
break;
|
|
1379
1394
|
case 'ES':
|
|
1380
1395
|
voice = `${
|
|
1381
|
-
|
|
1382
|
-
? 'es-ES-AlvaroNeural'
|
|
1383
|
-
: 'es-ES-ElviraNeural'
|
|
1396
|
+
voiceType === 'MALE' ? 'es-ES-AlvaroNeural' : 'es-ES-ElviraNeural'
|
|
1384
1397
|
}`;
|
|
1385
1398
|
break;
|
|
1386
1399
|
case 'FR':
|
|
1387
1400
|
voice = `${
|
|
1388
|
-
|
|
1389
|
-
? 'fr-FR-HenriNeural'
|
|
1390
|
-
: 'fr-FR-DeniseNeural'
|
|
1401
|
+
voiceType === 'MALE' ? 'fr-FR-HenriNeural' : 'fr-FR-DeniseNeural'
|
|
1391
1402
|
}`;
|
|
1392
1403
|
break;
|
|
1393
1404
|
case 'PT':
|
|
1394
1405
|
voice = `${
|
|
1395
|
-
|
|
1396
|
-
? 'pt-PT-DuarteNeural'
|
|
1397
|
-
: 'pt-PT-RaquelNeural'
|
|
1406
|
+
voiceType === 'MALE' ? 'pt-PT-DuarteNeural' : 'pt-PT-RaquelNeural'
|
|
1398
1407
|
}`;
|
|
1399
1408
|
break;
|
|
1400
1409
|
case 'UK':
|
|
1401
1410
|
voice = `${
|
|
1402
|
-
|
|
1403
|
-
? 'uk-UA-OstapNeural'
|
|
1404
|
-
: 'uk-UA-PolinaNeural'
|
|
1411
|
+
voiceType === 'MALE' ? 'uk-UA-OstapNeural' : 'uk-UA-PolinaNeural'
|
|
1405
1412
|
}`;
|
|
1406
1413
|
break;
|
|
1407
1414
|
case 'RU':
|
|
1408
1415
|
voice = `${
|
|
1409
|
-
|
|
1410
|
-
? 'ru-RU-DmitryNeural'
|
|
1411
|
-
: 'ru-RU-SvetlanaNeural'
|
|
1416
|
+
voiceType === 'MALE' ? 'ru-RU-DmitryNeural' : 'ru-RU-SvetlanaNeural'
|
|
1412
1417
|
}`;
|
|
1413
1418
|
break;
|
|
1414
1419
|
case 'PL':
|
|
1415
1420
|
voice = `${
|
|
1416
|
-
|
|
1417
|
-
? 'pl-PL-MarekNeural'
|
|
1418
|
-
: 'pl-PL-AgnieszkaNeural'
|
|
1421
|
+
voiceType === 'MALE' ? 'pl-PL-MarekNeural' : 'pl-PL-AgnieszkaNeural'
|
|
1419
1422
|
}`;
|
|
1420
1423
|
break;
|
|
1421
1424
|
case 'FI':
|
|
1422
1425
|
voice = `${
|
|
1423
|
-
|
|
1424
|
-
? 'fi-FI-HarriNeural'
|
|
1425
|
-
: 'fi-FI-SelmaNeural'
|
|
1426
|
+
voiceType === 'MALE' ? 'fi-FI-HarriNeural' : 'fi-FI-SelmaNeural'
|
|
1426
1427
|
}`;
|
|
1427
1428
|
break;
|
|
1428
1429
|
default:
|
|
1429
1430
|
voice = `${
|
|
1430
|
-
|
|
1431
|
-
? 'it-IT-DiegoNeural'
|
|
1432
|
-
: 'it-IT-IsabellaNeural'
|
|
1431
|
+
voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-IsabellaNeural'
|
|
1433
1432
|
}`;
|
|
1434
1433
|
break;
|
|
1435
1434
|
}
|
|
1436
1435
|
return voice;
|
|
1437
1436
|
},
|
|
1438
|
-
[
|
|
1437
|
+
[
|
|
1438
|
+
memori.voiceType,
|
|
1439
|
+
memori.enableBoardOfExperts,
|
|
1440
|
+
currentDialogState?.emitter,
|
|
1441
|
+
i18n.language,
|
|
1442
|
+
memori.culture,
|
|
1443
|
+
]
|
|
1439
1444
|
);
|
|
1440
1445
|
|
|
1441
1446
|
const getCultureCodeByLanguage = (lang?: string): string => {
|
|
@@ -1498,7 +1503,7 @@ const MemoriWidget = ({
|
|
|
1498
1503
|
const fetchLexiconJSON = async () => {
|
|
1499
1504
|
try {
|
|
1500
1505
|
const lexiconReq = await fetch(
|
|
1501
|
-
`${baseUrl || 'https://
|
|
1506
|
+
`${baseUrl || 'https://aisuru.com'}/api/lexiconmap`
|
|
1502
1507
|
);
|
|
1503
1508
|
const lexicon = await lexiconReq.json();
|
|
1504
1509
|
return lexicon;
|
|
@@ -2517,10 +2522,6 @@ const MemoriWidget = ({
|
|
|
2517
2522
|
},
|
|
2518
2523
|
[memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang]
|
|
2519
2524
|
);
|
|
2520
|
-
|
|
2521
|
-
const [loginToken, setLoginToken] = useState<string | undefined>(
|
|
2522
|
-
additionalInfo?.loginToken ?? authToken
|
|
2523
|
-
);
|
|
2524
2525
|
useEffect(() => {
|
|
2525
2526
|
const targetNode =
|
|
2526
2527
|
document.querySelector(`memori-client[memoriname="${memori.name}"]`) ||
|
|
@@ -2620,6 +2621,7 @@ const MemoriWidget = ({
|
|
|
2620
2621
|
showClear,
|
|
2621
2622
|
clearHistory: () => setHistory(h => h.slice(-1)),
|
|
2622
2623
|
loginToken,
|
|
2624
|
+
user,
|
|
2623
2625
|
sessionID: sessionId,
|
|
2624
2626
|
};
|
|
2625
2627
|
|
|
@@ -2639,7 +2641,7 @@ const MemoriWidget = ({
|
|
|
2639
2641
|
};
|
|
2640
2642
|
|
|
2641
2643
|
const startPanelProps: StartPanelProps = {
|
|
2642
|
-
memori
|
|
2644
|
+
memori,
|
|
2643
2645
|
tenant: tenant,
|
|
2644
2646
|
gamificationLevel: gamificationLevel,
|
|
2645
2647
|
language: language,
|
|
@@ -2656,6 +2658,7 @@ const MemoriWidget = ({
|
|
|
2656
2658
|
onClickStart: onClickStart,
|
|
2657
2659
|
initializeTTS: initializeTTS,
|
|
2658
2660
|
isUserLoggedIn: !!loginToken,
|
|
2661
|
+
user,
|
|
2659
2662
|
};
|
|
2660
2663
|
|
|
2661
2664
|
const chatProps: ChatProps = {
|
|
@@ -2812,7 +2815,7 @@ const MemoriWidget = ({
|
|
|
2812
2815
|
<audio
|
|
2813
2816
|
id="memori-audio"
|
|
2814
2817
|
style={{ display: 'none' }}
|
|
2815
|
-
src="https://
|
|
2818
|
+
src="https://aisuru.com/intro.mp3"
|
|
2816
2819
|
/>
|
|
2817
2820
|
|
|
2818
2821
|
{isClient && (
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
left: 0;
|
|
6
6
|
display: inline-flex;
|
|
7
7
|
flex-wrap: wrap;
|
|
8
|
+
align-items: center;
|
|
8
9
|
padding: 0.25rem 0.5rem;
|
|
9
10
|
border-radius: 10px;
|
|
10
11
|
background-color: var(--memori-inner-bg, transparent);
|
|
@@ -42,4 +43,4 @@
|
|
|
42
43
|
color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
|
|
43
44
|
opacity: 0.8;
|
|
44
45
|
text-decoration: underline;
|
|
45
|
-
}
|
|
46
|
+
}
|
|
@@ -21,6 +21,11 @@ Default.args = {
|
|
|
21
21
|
userLang: 'en',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
export const Italian = Template.bind({});
|
|
25
|
+
Italian.args = {
|
|
26
|
+
userLang: 'it',
|
|
27
|
+
};
|
|
28
|
+
|
|
24
29
|
export const MemoryTwin = Template.bind({});
|
|
25
30
|
MemoryTwin.args = {
|
|
26
31
|
tenant: {
|
|
@@ -35,7 +40,16 @@ MemoryTwin.args = {
|
|
|
35
40
|
},
|
|
36
41
|
};
|
|
37
42
|
|
|
38
|
-
export const
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
export const TwinCreator = Template.bind({});
|
|
44
|
+
TwinCreator.args = {
|
|
45
|
+
tenant: {
|
|
46
|
+
id: 'twincreator',
|
|
47
|
+
theme: 'twincreator',
|
|
48
|
+
config: {
|
|
49
|
+
name: 'twincreator',
|
|
50
|
+
showNewUser: true,
|
|
51
|
+
requirePosition: false,
|
|
52
|
+
feedbackURL: '',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
41
55
|
};
|
|
@@ -7,24 +7,33 @@ export interface Props {
|
|
|
7
7
|
|
|
8
8
|
const PoweredBy = ({ tenant, userLang = 'en' }: Props) => {
|
|
9
9
|
const tenantId =
|
|
10
|
-
tenant?.theme === 'memorytwin'
|
|
10
|
+
tenant?.theme === 'memorytwin'
|
|
11
|
+
? 'memorytwin'
|
|
12
|
+
: tenant?.theme === 'twincreator'
|
|
13
|
+
? 'twincreator'
|
|
14
|
+
: 'aisuru';
|
|
11
15
|
|
|
12
16
|
return (
|
|
13
17
|
<div className="memori--powered-by">
|
|
14
|
-
<img
|
|
15
|
-
src={`https://app.twincreator.com/images/${tenantId}/logo.png`}
|
|
16
|
-
alt=""
|
|
17
|
-
/>
|
|
18
|
+
<img src={`https://aisuru.com/images/${tenantId}/logo.png`} alt="" />
|
|
18
19
|
<p>
|
|
19
20
|
Powered by{' '}
|
|
20
21
|
<a
|
|
21
|
-
href={`https
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
href={`https://${
|
|
23
|
+
tenant?.theme === 'twincreator'
|
|
24
|
+
? 'app.twincreator.com'
|
|
25
|
+
: tenant?.theme === 'memorytwin'
|
|
26
|
+
? 'app.memorytwin.com'
|
|
27
|
+
: 'aisuru.com'
|
|
28
|
+
}/${userLang ? userLang.toLowerCase() : ''}`}
|
|
24
29
|
target="_blank"
|
|
25
30
|
rel="noopener noreferrer"
|
|
26
31
|
>
|
|
27
|
-
{tenantId === 'memorytwin'
|
|
32
|
+
{tenantId === 'memorytwin'
|
|
33
|
+
? 'MemoryTwin'
|
|
34
|
+
: tenantId === 'twincreator'
|
|
35
|
+
? 'TwinCreator'
|
|
36
|
+
: 'AIsuru'}
|
|
28
37
|
</a>
|
|
29
38
|
</p>
|
|
30
39
|
</div>
|
|
@@ -7,17 +7,17 @@ exports[`renders PoweredBy unchanged 1`] = `
|
|
|
7
7
|
>
|
|
8
8
|
<img
|
|
9
9
|
alt=""
|
|
10
|
-
src="https://
|
|
10
|
+
src="https://aisuru.com/images/aisuru/logo.png"
|
|
11
11
|
/>
|
|
12
12
|
<p>
|
|
13
13
|
Powered by
|
|
14
14
|
|
|
15
15
|
<a
|
|
16
|
-
href="https://
|
|
16
|
+
href="https://aisuru.com/en"
|
|
17
17
|
rel="noopener noreferrer"
|
|
18
18
|
target="_blank"
|
|
19
19
|
>
|
|
20
|
-
|
|
20
|
+
AIsuru
|
|
21
21
|
</a>
|
|
22
22
|
</p>
|
|
23
23
|
</div>
|