@memori.ai/memori-react 7.3.0 → 7.4.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 +24 -0
- package/README.md +2 -0
- package/dist/components/Header/Header.d.ts +1 -0
- package/dist/components/Header/Header.js +2 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +2 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +13 -41
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.css +5 -8
- package/dist/components/StartPanel/StartPanel.d.ts +2 -2
- package/dist/components/StartPanel/StartPanel.js +4 -4
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/ui/Button.css +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/esm/components/Header/Header.d.ts +1 -0
- package/esm/components/Header/Header.js +2 -2
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +2 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +13 -41
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.css +5 -8
- package/esm/components/StartPanel/StartPanel.d.ts +2 -2
- package/esm/components/StartPanel/StartPanel.js +4 -4
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/ui/Button.css +3 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/esm/styles.css +1 -0
- package/package.json +1 -1
- package/src/components/ChatBubble/ChatBubble.stories.tsx +13 -0
- package/src/components/Header/Header.stories.tsx +14 -0
- package/src/components/Header/Header.test.tsx +22 -0
- package/src/components/Header/Header.tsx +3 -1
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +69 -11
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +16 -0
- package/src/components/MemoriWidget/MemoriWidget.tsx +9 -46
- package/src/components/StartPanel/StartPanel.css +5 -8
- package/src/components/StartPanel/StartPanel.stories.tsx +20 -38
- package/src/components/StartPanel/StartPanel.test.tsx +20 -34
- package/src/components/StartPanel/StartPanel.tsx +3 -23
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +2 -68
- package/src/components/ui/Button.css +3 -1
- package/src/index.tsx +4 -0
- package/src/styles.css +1 -0
package/esm/styles.css
CHANGED
|
@@ -97,6 +97,7 @@ body.sb-show-main #root,
|
|
|
97
97
|
--memori-modal--width--md: 80%;
|
|
98
98
|
--memori-error-color: #ff4d4f;
|
|
99
99
|
--memori-warning-color: #faad14;
|
|
100
|
+
--memori-button-disabled-bg: #f9f9f9;
|
|
100
101
|
|
|
101
102
|
font-family: var(--memori-font-family, 'Lexend Deca Variable', 'Lexend Deca', sans-serif);
|
|
102
103
|
font-size: 16px;
|
package/package.json
CHANGED
|
@@ -272,6 +272,19 @@ WithMarkdownAndBreakLine.args = {
|
|
|
272
272
|
},
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
+
export const WithMarkdownAndMultipleBreakLine = Template.bind({});
|
|
276
|
+
WithMarkdownAndMultipleBreakLine.args = {
|
|
277
|
+
memori,
|
|
278
|
+
apiUrl: 'https://backend.memori.ai',
|
|
279
|
+
tenant,
|
|
280
|
+
message: {
|
|
281
|
+
fromUser: false,
|
|
282
|
+
initial: false,
|
|
283
|
+
generatedByAI: true,
|
|
284
|
+
text: `Ah, ottima domanda! Stavo giusto riflettendo su come spiegare al meglio le funzionalità di questo sistema. \n\nDa qui puoi fare diverse cose interessanti:\n\n1. Puoi conversare con me, Nunzio Fiore, e io risponderò basandomi sulle mie conoscenze ed esperienze.\n\n2. Puoi aggiungere nuove "memorie" o informazioni al mio database. Questo significa che puoi insegnarmi cose nuove o aggiornare le mie conoscenze esistenti.\n\n3. Puoi creare, modificare o eliminare "ricevitori". Questi sono come utenti specifici che possono interagire con me in modo personalizzato.\n\n4. Puoi associare determinate memorie a ricevitori specifici, creando così contenuti personalizzati per diverse persone.\n\n5. Puoi cercare tra le memorie esistenti, visualizzare le ultime aggiunte, o modificare quelle già presenti.\n\nIn pratica, stai interagendo con un sistema che permette di creare e gestire un "gemello digitale" - in questo caso, me stesso. È un po' come scrivere un libro interattivo sulla mia vita e le mie conoscenze.\n\nC'è qualcosa in particolare che ti interessa esplorare o su cui vorresti saperne di più?`,
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
|
|
275
288
|
export const WithMarkdownCode = Template.bind({});
|
|
276
289
|
WithMarkdownCode.args = {
|
|
277
290
|
memori,
|
|
@@ -123,6 +123,20 @@ SpeakerMuted.args = {
|
|
|
123
123
|
showSettings: false,
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
+
export const WithoutAudio = Template.bind({});
|
|
127
|
+
WithoutAudio.args = {
|
|
128
|
+
memori,
|
|
129
|
+
history,
|
|
130
|
+
setShowPositionDrawer: () => {},
|
|
131
|
+
setShowSettingsDrawer: () => {},
|
|
132
|
+
clearHistory: () => {},
|
|
133
|
+
speakerMuted: true,
|
|
134
|
+
enableAudio: false,
|
|
135
|
+
hasUserActivatedSpeak: false,
|
|
136
|
+
showShare: false,
|
|
137
|
+
showSettings: false,
|
|
138
|
+
};
|
|
139
|
+
|
|
126
140
|
export const WithShare = Template.bind({});
|
|
127
141
|
WithShare.args = {
|
|
128
142
|
memori,
|
|
@@ -74,6 +74,28 @@ it('renders Header with speaker muted unchanged', () => {
|
|
|
74
74
|
expect(container).toMatchSnapshot();
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
+
it('renders Header with audio disabled unchanged', () => {
|
|
78
|
+
const { container } = render(
|
|
79
|
+
<Header
|
|
80
|
+
memori={memori}
|
|
81
|
+
history={history}
|
|
82
|
+
setShowPositionDrawer={jest.fn()}
|
|
83
|
+
setShowSettingsDrawer={jest.fn()}
|
|
84
|
+
setShowKnownFactsDrawer={jest.fn()}
|
|
85
|
+
setShowExpertsDrawer={jest.fn()}
|
|
86
|
+
speakerMuted={true}
|
|
87
|
+
setSpeakerMuted={jest.fn()}
|
|
88
|
+
enableAudio={false}
|
|
89
|
+
hasUserActivatedSpeak={false}
|
|
90
|
+
showShare={false}
|
|
91
|
+
showSettings={false}
|
|
92
|
+
clearHistory={jest.fn()}
|
|
93
|
+
setShowLoginDrawer={jest.fn()}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
expect(container).toMatchSnapshot();
|
|
97
|
+
});
|
|
98
|
+
|
|
77
99
|
it('renders Header with share button unchanged', () => {
|
|
78
100
|
const { container } = render(
|
|
79
101
|
<Header
|
|
@@ -33,6 +33,7 @@ export interface Props {
|
|
|
33
33
|
setShowSettingsDrawer: (show: boolean) => void;
|
|
34
34
|
setShowKnownFactsDrawer: (show: boolean) => void;
|
|
35
35
|
setShowExpertsDrawer: (show: boolean) => void;
|
|
36
|
+
enableAudio?: boolean;
|
|
36
37
|
speakerMuted: boolean;
|
|
37
38
|
setSpeakerMuted: (mute: boolean) => void;
|
|
38
39
|
hasUserActivatedSpeak?: boolean;
|
|
@@ -59,6 +60,7 @@ const Header: React.FC<Props> = ({
|
|
|
59
60
|
setShowSettingsDrawer,
|
|
60
61
|
setShowKnownFactsDrawer,
|
|
61
62
|
setShowExpertsDrawer,
|
|
63
|
+
enableAudio = true,
|
|
62
64
|
speakerMuted,
|
|
63
65
|
setSpeakerMuted,
|
|
64
66
|
hasUserActivatedSpeak = false,
|
|
@@ -168,7 +170,7 @@ const Header: React.FC<Props> = ({
|
|
|
168
170
|
title={t('widget.showExpertsInTheBoard') || 'Experts in this board'}
|
|
169
171
|
/>
|
|
170
172
|
)}
|
|
171
|
-
{showSpeaker && (
|
|
173
|
+
{enableAudio && showSpeaker && (
|
|
172
174
|
<Button
|
|
173
175
|
primary
|
|
174
176
|
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-:r1u:"
|
|
66
66
|
type="button"
|
|
67
67
|
>
|
|
68
68
|
<div
|
|
@@ -167,7 +167,7 @@ exports[`renders Header for board of experts with session open unchanged 1`] = `
|
|
|
167
167
|
aria-expanded="false"
|
|
168
168
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
169
169
|
data-headlessui-state=""
|
|
170
|
-
id="headlessui-popover-button-:
|
|
170
|
+
id="headlessui-popover-button-:r23:"
|
|
171
171
|
type="button"
|
|
172
172
|
>
|
|
173
173
|
<div
|
|
@@ -289,6 +289,64 @@ exports[`renders Header unchanged 1`] = `
|
|
|
289
289
|
</div>
|
|
290
290
|
`;
|
|
291
291
|
|
|
292
|
+
exports[`renders Header with audio disabled unchanged 1`] = `
|
|
293
|
+
<div>
|
|
294
|
+
<div
|
|
295
|
+
class="memori-header"
|
|
296
|
+
>
|
|
297
|
+
<div
|
|
298
|
+
class="memori-export-history-button memori-header--button memori-header--button--export"
|
|
299
|
+
data-headlessui-state=""
|
|
300
|
+
title="write_and_speak.exportChatHistoryMessage"
|
|
301
|
+
>
|
|
302
|
+
<button
|
|
303
|
+
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
304
|
+
data-headlessui-state=""
|
|
305
|
+
disabled=""
|
|
306
|
+
id="headlessui-popover-button-:rf:"
|
|
307
|
+
type="button"
|
|
308
|
+
>
|
|
309
|
+
<div
|
|
310
|
+
class="memori-button--icon"
|
|
311
|
+
>
|
|
312
|
+
<svg
|
|
313
|
+
aria-hidden="true"
|
|
314
|
+
focusable="false"
|
|
315
|
+
role="img"
|
|
316
|
+
viewBox="0 0 1024 1024"
|
|
317
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
318
|
+
>
|
|
319
|
+
<path
|
|
320
|
+
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"
|
|
321
|
+
/>
|
|
322
|
+
</svg>
|
|
323
|
+
</div>
|
|
324
|
+
</button>
|
|
325
|
+
</div>
|
|
326
|
+
<button
|
|
327
|
+
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button-login"
|
|
328
|
+
title="login.login"
|
|
329
|
+
>
|
|
330
|
+
<span
|
|
331
|
+
class="memori-button--icon"
|
|
332
|
+
>
|
|
333
|
+
<svg
|
|
334
|
+
aria-hidden="true"
|
|
335
|
+
focusable="false"
|
|
336
|
+
role="img"
|
|
337
|
+
viewBox="0 0 1024 1024"
|
|
338
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
339
|
+
>
|
|
340
|
+
<path
|
|
341
|
+
d="M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"
|
|
342
|
+
/>
|
|
343
|
+
</svg>
|
|
344
|
+
</span>
|
|
345
|
+
</button>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
`;
|
|
349
|
+
|
|
292
350
|
exports[`renders Header with clear button unchanged 1`] = `
|
|
293
351
|
<div>
|
|
294
352
|
<div
|
|
@@ -343,7 +401,7 @@ exports[`renders Header with clear button unchanged 1`] = `
|
|
|
343
401
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
344
402
|
data-headlessui-state=""
|
|
345
403
|
disabled=""
|
|
346
|
-
id="headlessui-popover-button-:
|
|
404
|
+
id="headlessui-popover-button-:r10:"
|
|
347
405
|
type="button"
|
|
348
406
|
>
|
|
349
407
|
<div
|
|
@@ -421,7 +479,7 @@ exports[`renders Header with deep thought and session open unchanged 1`] = `
|
|
|
421
479
|
aria-expanded="false"
|
|
422
480
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
423
481
|
data-headlessui-state=""
|
|
424
|
-
id="headlessui-popover-button-:
|
|
482
|
+
id="headlessui-popover-button-:r1p:"
|
|
425
483
|
type="button"
|
|
426
484
|
>
|
|
427
485
|
<div
|
|
@@ -499,7 +557,7 @@ exports[`renders Header with deep thought logged but without permission flag unc
|
|
|
499
557
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
500
558
|
data-headlessui-state=""
|
|
501
559
|
disabled=""
|
|
502
|
-
id="headlessui-popover-button-:
|
|
560
|
+
id="headlessui-popover-button-:r1f:"
|
|
503
561
|
type="button"
|
|
504
562
|
>
|
|
505
563
|
<div
|
|
@@ -621,7 +679,7 @@ exports[`renders Header with deep thought logged with permission flag unchanged
|
|
|
621
679
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
622
680
|
data-headlessui-state=""
|
|
623
681
|
disabled=""
|
|
624
|
-
id="headlessui-popover-button-:
|
|
682
|
+
id="headlessui-popover-button-:r1k:"
|
|
625
683
|
type="button"
|
|
626
684
|
>
|
|
627
685
|
<div
|
|
@@ -699,7 +757,7 @@ exports[`renders Header with deep thought unlogged unchanged 1`] = `
|
|
|
699
757
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
700
758
|
data-headlessui-state=""
|
|
701
759
|
disabled=""
|
|
702
|
-
id="headlessui-popover-button-:
|
|
760
|
+
id="headlessui-popover-button-:r1a:"
|
|
703
761
|
type="button"
|
|
704
762
|
>
|
|
705
763
|
<div
|
|
@@ -885,7 +943,7 @@ exports[`renders Header with settings button unchanged 1`] = `
|
|
|
885
943
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
886
944
|
data-headlessui-state=""
|
|
887
945
|
disabled=""
|
|
888
|
-
id="headlessui-popover-button-:
|
|
946
|
+
id="headlessui-popover-button-:rr:"
|
|
889
947
|
type="button"
|
|
890
948
|
>
|
|
891
949
|
<div
|
|
@@ -983,7 +1041,7 @@ exports[`renders Header with share button unchanged 1`] = `
|
|
|
983
1041
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--disabled"
|
|
984
1042
|
data-headlessui-state=""
|
|
985
1043
|
disabled=""
|
|
986
|
-
id="headlessui-popover-button-:
|
|
1044
|
+
id="headlessui-popover-button-:rk:"
|
|
987
1045
|
type="button"
|
|
988
1046
|
>
|
|
989
1047
|
<div
|
|
@@ -1012,7 +1070,7 @@ exports[`renders Header with share button unchanged 1`] = `
|
|
|
1012
1070
|
aria-haspopup="true"
|
|
1013
1071
|
class="memori-button memori-button--circle memori-button--icon-only memori-share-button--button memori-header--button memori-header--button-share memori-button--primary"
|
|
1014
1072
|
data-headlessui-state=""
|
|
1015
|
-
id="headlessui-menu-button-:
|
|
1073
|
+
id="headlessui-menu-button-:rp:"
|
|
1016
1074
|
title="widget.share"
|
|
1017
1075
|
type="button"
|
|
1018
1076
|
>
|
|
@@ -1171,7 +1229,7 @@ exports[`renders Header with user activated speak unchanged 1`] = `
|
|
|
1171
1229
|
aria-expanded="false"
|
|
1172
1230
|
class="memori-button memori-button--circle memori-button--icon-only memori-button--primary"
|
|
1173
1231
|
data-headlessui-state=""
|
|
1174
|
-
id="headlessui-popover-button-:
|
|
1232
|
+
id="headlessui-popover-button-:r15:"
|
|
1175
1233
|
type="button"
|
|
1176
1234
|
>
|
|
1177
1235
|
<div
|
|
@@ -141,6 +141,22 @@ ShowClear.args = {
|
|
|
141
141
|
showClear: true,
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
+
export const WithoutAudio = Template.bind({});
|
|
145
|
+
WithoutAudio.args = {
|
|
146
|
+
memori,
|
|
147
|
+
tenant,
|
|
148
|
+
enableAudio: false,
|
|
149
|
+
AZURE_COGNITIVE_SERVICES_TTS_KEY: 'provide your key here',
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const DefautSpeakerDisabled = Template.bind({});
|
|
153
|
+
DefautSpeakerDisabled.args = {
|
|
154
|
+
memori,
|
|
155
|
+
tenant,
|
|
156
|
+
defaultSpeakerActive: false,
|
|
157
|
+
AZURE_COGNITIVE_SERVICES_TTS_KEY: 'provide your key here',
|
|
158
|
+
};
|
|
159
|
+
|
|
144
160
|
export const ShowOnlyLastMessages = Template.bind({});
|
|
145
161
|
ShowOnlyLastMessages.args = {
|
|
146
162
|
memori,
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
MemoriConfig,
|
|
11
11
|
TranslatedHint,
|
|
12
12
|
Invitation,
|
|
13
|
-
GamificationLevel,
|
|
14
13
|
Tenant,
|
|
15
14
|
MemoriSession,
|
|
16
15
|
User,
|
|
@@ -76,7 +75,6 @@ import {
|
|
|
76
75
|
} from '../../helpers/utils';
|
|
77
76
|
import { anonTag } from '../../helpers/constants';
|
|
78
77
|
import { getErrori18nKey } from '../../helpers/error';
|
|
79
|
-
import { getGamificationLevel } from '../../helpers/statistics';
|
|
80
78
|
import { getCredits } from '../../helpers/credits';
|
|
81
79
|
|
|
82
80
|
// Widget utilities and helpers
|
|
@@ -366,6 +364,7 @@ export interface Props {
|
|
|
366
364
|
};
|
|
367
365
|
authToken?: string;
|
|
368
366
|
AZURE_COGNITIVE_SERVICES_TTS_KEY?: string;
|
|
367
|
+
enableAudio?: boolean;
|
|
369
368
|
defaultSpeakerActive?: boolean;
|
|
370
369
|
disableTextEnteredEvents?: boolean;
|
|
371
370
|
onStateChange?: (state?: DialogState) => void;
|
|
@@ -412,6 +411,7 @@ const MemoriWidget = ({
|
|
|
412
411
|
personification,
|
|
413
412
|
authToken,
|
|
414
413
|
AZURE_COGNITIVE_SERVICES_TTS_KEY,
|
|
414
|
+
enableAudio,
|
|
415
415
|
defaultSpeakerActive = true,
|
|
416
416
|
disableTextEnteredEvents = false,
|
|
417
417
|
onStateChange,
|
|
@@ -475,6 +475,7 @@ const MemoriWidget = ({
|
|
|
475
475
|
const integrationConfig = integration?.customData
|
|
476
476
|
? JSON.parse(integration.customData)
|
|
477
477
|
: null;
|
|
478
|
+
|
|
478
479
|
const isMultilanguageEnabled =
|
|
479
480
|
multilingual !== undefined
|
|
480
481
|
? multilingual
|
|
@@ -502,7 +503,10 @@ const MemoriWidget = ({
|
|
|
502
503
|
const [showSettingsDrawer, setShowSettingsDrawer] = useState(false);
|
|
503
504
|
const [showKnownFactsDrawer, setShowKnownFactsDrawer] = useState(false);
|
|
504
505
|
const [showExpertsDrawer, setShowExpertsDrawer] = useState(false);
|
|
505
|
-
const [muteSpeaker, setMuteSpeaker] = useState(
|
|
506
|
+
const [muteSpeaker, setMuteSpeaker] = useState(
|
|
507
|
+
!(enableAudio ?? integrationConfig?.enableAudio ?? true) ||
|
|
508
|
+
!defaultSpeakerActive
|
|
509
|
+
);
|
|
506
510
|
const [continuousSpeech, setContinuousSpeech] = useState(false);
|
|
507
511
|
const [continuousSpeechTimeout, setContinuousSpeechTimeout] = useState(2);
|
|
508
512
|
const [isPlayingAudio, setIsPlayingAudio] = useState(false);
|
|
@@ -2324,48 +2328,6 @@ const MemoriWidget = ({
|
|
|
2324
2328
|
}
|
|
2325
2329
|
}, []);
|
|
2326
2330
|
|
|
2327
|
-
const [gamificationLevel, setGamificationLevel] =
|
|
2328
|
-
useState<GamificationLevel>();
|
|
2329
|
-
const getGamificationPoints = async (
|
|
2330
|
-
memoriID: string
|
|
2331
|
-
): Promise<{
|
|
2332
|
-
points: number;
|
|
2333
|
-
unansweredQuestions: number;
|
|
2334
|
-
}> => {
|
|
2335
|
-
let gamificationPoints: number | undefined;
|
|
2336
|
-
let unansQuestions: number | undefined;
|
|
2337
|
-
try {
|
|
2338
|
-
const {
|
|
2339
|
-
contentQualityIndex,
|
|
2340
|
-
answerQualityIndex,
|
|
2341
|
-
unansweredQuestions,
|
|
2342
|
-
...cqResp
|
|
2343
|
-
} = await getContentQualityIndexes(memoriID);
|
|
2344
|
-
if (cqResp.resultCode === 0) {
|
|
2345
|
-
gamificationPoints = contentQualityIndex;
|
|
2346
|
-
unansQuestions = unansweredQuestions;
|
|
2347
|
-
}
|
|
2348
|
-
} catch (_e) {
|
|
2349
|
-
let err = _e as Error;
|
|
2350
|
-
console.debug('[APPCONTEXT/QUERYGAMIFICATIONPOINTS]', err);
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
return {
|
|
2354
|
-
points: gamificationPoints ?? 0,
|
|
2355
|
-
unansweredQuestions: unansQuestions ?? 0,
|
|
2356
|
-
};
|
|
2357
|
-
};
|
|
2358
|
-
useEffect(() => {
|
|
2359
|
-
if (memori.engineMemoriID) {
|
|
2360
|
-
getGamificationPoints(memori.engineMemoriID)
|
|
2361
|
-
.then(value => {
|
|
2362
|
-
setGamificationLevel(getGamificationLevel(value.points));
|
|
2363
|
-
})
|
|
2364
|
-
.catch(console.debug);
|
|
2365
|
-
}
|
|
2366
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2367
|
-
}, [memori.engineMemoriID]);
|
|
2368
|
-
|
|
2369
2331
|
// Put SEO tags in head
|
|
2370
2332
|
useEffect(() => {
|
|
2371
2333
|
if (integrationConfig?.seoTitle) {
|
|
@@ -2973,6 +2935,7 @@ const MemoriWidget = ({
|
|
|
2973
2935
|
setShowSettingsDrawer,
|
|
2974
2936
|
setShowKnownFactsDrawer,
|
|
2975
2937
|
setShowExpertsDrawer,
|
|
2938
|
+
enableAudio: enableAudio ?? integrationConfig?.enableAudio ?? true,
|
|
2976
2939
|
showSpeaker: !!AZURE_COGNITIVE_SERVICES_TTS_KEY,
|
|
2977
2940
|
speakerMuted: muteSpeaker || speakerMuted,
|
|
2978
2941
|
setSpeakerMuted: mute => {
|
|
@@ -3019,7 +2982,6 @@ const MemoriWidget = ({
|
|
|
3019
2982
|
const startPanelProps: StartPanelProps = {
|
|
3020
2983
|
memori,
|
|
3021
2984
|
tenant: tenant,
|
|
3022
|
-
gamificationLevel: gamificationLevel,
|
|
3023
2985
|
language: language,
|
|
3024
2986
|
userLang: userLang,
|
|
3025
2987
|
setUserLang: setUserLang,
|
|
@@ -3031,6 +2993,7 @@ const MemoriWidget = ({
|
|
|
3031
2993
|
instruct: instruct,
|
|
3032
2994
|
sessionId: sessionId,
|
|
3033
2995
|
clickedStart: clickedStart,
|
|
2996
|
+
isMultilanguageEnabled: isMultilanguageEnabled,
|
|
3034
2997
|
onClickStart: onClickStart,
|
|
3035
2998
|
initializeTTS: initializeTTS,
|
|
3036
2999
|
isUserLoggedIn: !!loginToken && !!user?.userID,
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
.memori--board-of-experts,
|
|
137
137
|
.memori--nsfw {
|
|
138
138
|
position: absolute;
|
|
139
|
-
right:
|
|
139
|
+
right: 0.25rem;
|
|
140
140
|
bottom: -1.25rem;
|
|
141
141
|
display: flex;
|
|
142
142
|
width: 2rem;
|
|
@@ -160,12 +160,9 @@
|
|
|
160
160
|
height: 1rem;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
.memori--
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
.memori--board-of-experts {
|
|
168
|
-
right: 0.25rem;
|
|
163
|
+
.memori--board-of-experts + .memori--nsfw,
|
|
164
|
+
.memori--completions-enabled + .memori--nsfw {
|
|
165
|
+
right: 2.5rem;
|
|
169
166
|
}
|
|
170
167
|
|
|
171
168
|
.memori--board-of-experts svg {
|
|
@@ -220,4 +217,4 @@
|
|
|
220
217
|
.memori--deep-thought-disclaimer a {
|
|
221
218
|
color: inherit;
|
|
222
219
|
text-decoration: underline;
|
|
223
|
-
}
|
|
220
|
+
}
|
|
@@ -110,28 +110,6 @@ Default.args = {
|
|
|
110
110
|
onClickStart: () => {},
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
export const WithGamificationLevel = Template.bind({});
|
|
114
|
-
WithGamificationLevel.args = {
|
|
115
|
-
memori: {
|
|
116
|
-
...memori,
|
|
117
|
-
enableCompletions: false,
|
|
118
|
-
},
|
|
119
|
-
tenant,
|
|
120
|
-
gamificationLevel: {
|
|
121
|
-
points: 61,
|
|
122
|
-
pointsForCurrentBadge: 60,
|
|
123
|
-
badge: '🌍',
|
|
124
|
-
},
|
|
125
|
-
language: 'it',
|
|
126
|
-
userLang: 'en',
|
|
127
|
-
setUserLang: () => {},
|
|
128
|
-
openPositionDrawer: () => {},
|
|
129
|
-
instruct: false,
|
|
130
|
-
sessionId: sessionID,
|
|
131
|
-
clickedStart: false,
|
|
132
|
-
onClickStart: () => {},
|
|
133
|
-
};
|
|
134
|
-
|
|
135
113
|
export const WithCompletionsEnabled = Template.bind({});
|
|
136
114
|
WithCompletionsEnabled.args = {
|
|
137
115
|
memori: {
|
|
@@ -167,18 +145,13 @@ WithNSFWFlag.args = {
|
|
|
167
145
|
onClickStart: () => {},
|
|
168
146
|
};
|
|
169
147
|
|
|
170
|
-
export const
|
|
171
|
-
|
|
148
|
+
export const WithCompletionsAndNSFW = Template.bind({});
|
|
149
|
+
WithCompletionsAndNSFW.args = {
|
|
172
150
|
memori: {
|
|
173
151
|
...memori,
|
|
174
152
|
enableCompletions: true,
|
|
175
153
|
nsfw: true,
|
|
176
154
|
},
|
|
177
|
-
gamificationLevel: {
|
|
178
|
-
points: 61,
|
|
179
|
-
pointsForCurrentBadge: 60,
|
|
180
|
-
badge: '🌍',
|
|
181
|
-
},
|
|
182
155
|
tenant,
|
|
183
156
|
language: 'it',
|
|
184
157
|
userLang: 'en',
|
|
@@ -261,10 +234,24 @@ BoardOfExpert.args = {
|
|
|
261
234
|
enableBoardOfExperts: true,
|
|
262
235
|
enableCompletions: true,
|
|
263
236
|
},
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
237
|
+
tenant,
|
|
238
|
+
language: 'it',
|
|
239
|
+
userLang: 'en',
|
|
240
|
+
setUserLang: () => {},
|
|
241
|
+
openPositionDrawer: () => {},
|
|
242
|
+
instruct: false,
|
|
243
|
+
sessionId: sessionID,
|
|
244
|
+
clickedStart: false,
|
|
245
|
+
onClickStart: () => {},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const BoardOfExpertNSFW = Template.bind({});
|
|
249
|
+
BoardOfExpertNSFW.args = {
|
|
250
|
+
memori: {
|
|
251
|
+
...memori,
|
|
252
|
+
enableBoardOfExperts: true,
|
|
253
|
+
enableCompletions: true,
|
|
254
|
+
nsfw: true,
|
|
268
255
|
},
|
|
269
256
|
tenant,
|
|
270
257
|
language: 'it',
|
|
@@ -281,11 +268,6 @@ export const Instruct = Template.bind({});
|
|
|
281
268
|
Instruct.args = {
|
|
282
269
|
memori,
|
|
283
270
|
tenant,
|
|
284
|
-
gamificationLevel: {
|
|
285
|
-
points: 61,
|
|
286
|
-
pointsForCurrentBadge: 60,
|
|
287
|
-
badge: '🌍',
|
|
288
|
-
},
|
|
289
271
|
language: 'it',
|
|
290
272
|
userLang: 'en',
|
|
291
273
|
setUserLang: () => {},
|
|
@@ -22,30 +22,6 @@ it('renders StartPanel unchanged', () => {
|
|
|
22
22
|
expect(container).toMatchSnapshot();
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
it('renders StartPanel with gamification level unchanged', () => {
|
|
26
|
-
const { container } = render(
|
|
27
|
-
<StartPanel
|
|
28
|
-
memori={memori}
|
|
29
|
-
tenant={tenant}
|
|
30
|
-
gamificationLevel={{
|
|
31
|
-
points: 61,
|
|
32
|
-
pointsForCurrentBadge: 60,
|
|
33
|
-
badge: '🌍',
|
|
34
|
-
}}
|
|
35
|
-
language="it"
|
|
36
|
-
userLang="en"
|
|
37
|
-
setUserLang={() => {}}
|
|
38
|
-
openPositionDrawer={() => {}}
|
|
39
|
-
instruct={false}
|
|
40
|
-
sessionId={sessionID}
|
|
41
|
-
clickedStart={false}
|
|
42
|
-
onClickStart={() => {}}
|
|
43
|
-
setShowLoginDrawer={jest.fn()}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
expect(container).toMatchSnapshot();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
25
|
it('renders StartPanel with completions enabled unchanged', () => {
|
|
50
26
|
const { container } = render(
|
|
51
27
|
<StartPanel
|
|
@@ -172,11 +148,6 @@ it('renders StartPanel on instruct unchanged', () => {
|
|
|
172
148
|
<StartPanel
|
|
173
149
|
memori={memori}
|
|
174
150
|
tenant={tenant}
|
|
175
|
-
gamificationLevel={{
|
|
176
|
-
points: 61,
|
|
177
|
-
pointsForCurrentBadge: 60,
|
|
178
|
-
badge: '🌍',
|
|
179
|
-
}}
|
|
180
151
|
language="it"
|
|
181
152
|
userLang="en"
|
|
182
153
|
setUserLang={() => {}}
|
|
@@ -199,11 +170,6 @@ it('renders StartPanel with position required unchanged', () => {
|
|
|
199
170
|
needsPosition: true,
|
|
200
171
|
}}
|
|
201
172
|
tenant={tenant}
|
|
202
|
-
gamificationLevel={{
|
|
203
|
-
points: 61,
|
|
204
|
-
pointsForCurrentBadge: 60,
|
|
205
|
-
badge: '🌍',
|
|
206
|
-
}}
|
|
207
173
|
language="it"
|
|
208
174
|
userLang="en"
|
|
209
175
|
setUserLang={() => {}}
|
|
@@ -238,6 +204,26 @@ it('renders StartPanel with integrationConfig unchanged', () => {
|
|
|
238
204
|
expect(container).toMatchSnapshot();
|
|
239
205
|
});
|
|
240
206
|
|
|
207
|
+
it('renders StartPanel with multilangual unchanged', () => {
|
|
208
|
+
const { container } = render(
|
|
209
|
+
<StartPanel
|
|
210
|
+
memori={memori}
|
|
211
|
+
tenant={tenant}
|
|
212
|
+
isMultilanguageEnabled
|
|
213
|
+
language="it"
|
|
214
|
+
userLang="en"
|
|
215
|
+
setUserLang={() => {}}
|
|
216
|
+
openPositionDrawer={() => {}}
|
|
217
|
+
instruct={false}
|
|
218
|
+
sessionId={sessionID}
|
|
219
|
+
clickedStart={false}
|
|
220
|
+
onClickStart={() => {}}
|
|
221
|
+
setShowLoginDrawer={jest.fn()}
|
|
222
|
+
/>
|
|
223
|
+
);
|
|
224
|
+
expect(container).toMatchSnapshot();
|
|
225
|
+
});
|
|
226
|
+
|
|
241
227
|
it('renders StartPanel with completion provider down unchanged', () => {
|
|
242
228
|
const { container } = render(
|
|
243
229
|
<StartPanel
|