@memori.ai/memori-react 4.4.0 → 4.4.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.
@@ -61,11 +61,13 @@
61
61
 
62
62
  .memori-chat--bubble-typing {
63
63
  display: flex;
64
+ align-items: center;
64
65
  }
65
66
 
66
67
  .memori-chat--bubble p {
67
68
  margin-top: 0;
68
69
  margin-bottom: 0;
70
+ font-size: 0.75em;
69
71
  }
70
72
 
71
73
  .memori-chat--bubble ul,
@@ -87,8 +89,8 @@
87
89
 
88
90
  @media (max-width: 600px) {
89
91
  .memori-chat--bubble p {
90
- font-size: 14px;
91
- line-height: 1.4;
92
+ font-size: 11px;
93
+ line-height: 1.2;
92
94
  }
93
95
  }
94
96
 
@@ -1354,88 +1354,83 @@ const MemoriWidget = ({
1354
1354
  i18n.language ??
1355
1355
  'IT'
1356
1356
  ).toUpperCase();
1357
+
1358
+ let voiceType = memori.voiceType;
1359
+ if (memori.enableBoardOfExperts && currentDialogState?.emitter) {
1360
+ let expert = experts?.find(e => e.name === currentDialogState?.emitter);
1361
+
1362
+ // TODO: once got info from backend, select voice from expert
1363
+ // if (expert?.voiceType) {
1364
+ // voiceType = expert.voiceType;
1365
+ // }
1366
+ }
1367
+
1357
1368
  switch (voiceLang) {
1358
1369
  case 'IT':
1359
1370
  voice = `${
1360
- memori.voiceType === 'MALE'
1361
- ? 'it-IT-DiegoNeural'
1362
- : 'it-IT-ElsaNeural'
1371
+ voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-ElsaNeural'
1363
1372
  }`;
1364
1373
  break;
1365
1374
  case 'DE':
1366
1375
  voice = `${
1367
- memori.voiceType === 'MALE'
1368
- ? 'de-DE-ConradNeural'
1369
- : 'de-DE-KatjaNeural'
1376
+ voiceType === 'MALE' ? 'de-DE-ConradNeural' : 'de-DE-KatjaNeural'
1370
1377
  }`;
1371
1378
  break;
1372
1379
  case 'EN':
1373
1380
  voice = `${
1374
- memori.voiceType === 'MALE'
1375
- ? 'en-GB-RyanNeural'
1376
- : 'en-GB-SoniaNeural'
1381
+ voiceType === 'MALE' ? 'en-GB-RyanNeural' : 'en-GB-SoniaNeural'
1377
1382
  }`;
1378
1383
  break;
1379
1384
  case 'ES':
1380
1385
  voice = `${
1381
- memori.voiceType === 'MALE'
1382
- ? 'es-ES-AlvaroNeural'
1383
- : 'es-ES-ElviraNeural'
1386
+ voiceType === 'MALE' ? 'es-ES-AlvaroNeural' : 'es-ES-ElviraNeural'
1384
1387
  }`;
1385
1388
  break;
1386
1389
  case 'FR':
1387
1390
  voice = `${
1388
- memori.voiceType === 'MALE'
1389
- ? 'fr-FR-HenriNeural'
1390
- : 'fr-FR-DeniseNeural'
1391
+ voiceType === 'MALE' ? 'fr-FR-HenriNeural' : 'fr-FR-DeniseNeural'
1391
1392
  }`;
1392
1393
  break;
1393
1394
  case 'PT':
1394
1395
  voice = `${
1395
- memori.voiceType === 'MALE'
1396
- ? 'pt-PT-DuarteNeural'
1397
- : 'pt-PT-RaquelNeural'
1396
+ voiceType === 'MALE' ? 'pt-PT-DuarteNeural' : 'pt-PT-RaquelNeural'
1398
1397
  }`;
1399
1398
  break;
1400
1399
  case 'UK':
1401
1400
  voice = `${
1402
- memori.voiceType === 'MALE'
1403
- ? 'uk-UA-OstapNeural'
1404
- : 'uk-UA-PolinaNeural'
1401
+ voiceType === 'MALE' ? 'uk-UA-OstapNeural' : 'uk-UA-PolinaNeural'
1405
1402
  }`;
1406
1403
  break;
1407
1404
  case 'RU':
1408
1405
  voice = `${
1409
- memori.voiceType === 'MALE'
1410
- ? 'ru-RU-DmitryNeural'
1411
- : 'ru-RU-SvetlanaNeural'
1406
+ voiceType === 'MALE' ? 'ru-RU-DmitryNeural' : 'ru-RU-SvetlanaNeural'
1412
1407
  }`;
1413
1408
  break;
1414
1409
  case 'PL':
1415
1410
  voice = `${
1416
- memori.voiceType === 'MALE'
1417
- ? 'pl-PL-MarekNeural'
1418
- : 'pl-PL-AgnieszkaNeural'
1411
+ voiceType === 'MALE' ? 'pl-PL-MarekNeural' : 'pl-PL-AgnieszkaNeural'
1419
1412
  }`;
1420
1413
  break;
1421
1414
  case 'FI':
1422
1415
  voice = `${
1423
- memori.voiceType === 'MALE'
1424
- ? 'fi-FI-HarriNeural'
1425
- : 'fi-FI-SelmaNeural'
1416
+ voiceType === 'MALE' ? 'fi-FI-HarriNeural' : 'fi-FI-SelmaNeural'
1426
1417
  }`;
1427
1418
  break;
1428
1419
  default:
1429
1420
  voice = `${
1430
- memori.voiceType === 'MALE'
1431
- ? 'it-IT-DiegoNeural'
1432
- : 'it-IT-IsabellaNeural'
1421
+ voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-IsabellaNeural'
1433
1422
  }`;
1434
1423
  break;
1435
1424
  }
1436
1425
  return voice;
1437
1426
  },
1438
- [memori.voiceType, i18n.language, memori.culture]
1427
+ [
1428
+ memori.voiceType,
1429
+ memori.enableBoardOfExperts,
1430
+ currentDialogState?.emitter,
1431
+ i18n.language,
1432
+ memori.culture,
1433
+ ]
1439
1434
  );
1440
1435
 
1441
1436
  const getCultureCodeByLanguage = (lang?: string): string => {
@@ -199,6 +199,7 @@
199
199
  .memori--deep-thought-disclaimer h2 {
200
200
  margin-top: 0;
201
201
  margin-bottom: 0.5em;
202
+ color: var(--memori-text-color, rgba(0, 0, 0, 0.85));
202
203
  }
203
204
 
204
205
  .memori--deep-thought-disclaimer .memori-tooltip {
@@ -86,3 +86,45 @@ WithCustomLoadingTextList.args = {
86
86
  ],
87
87
  },
88
88
  };
89
+
90
+ export const WithCustomLoadingTextListAndInitialDelay = Template.bind({});
91
+ WithCustomLoadingTextListAndInitialDelay.args = {
92
+ sentences: {
93
+ en: [
94
+ {
95
+ text: '',
96
+ delayAfter: 10,
97
+ },
98
+ {
99
+ text: 'I am asking the unicorns what they think about it',
100
+ delayAfter: 5,
101
+ },
102
+ {
103
+ text: 'I am trying to understand what my cat is saying about it',
104
+ delayAfter: 10,
105
+ },
106
+ {
107
+ text: 'I am collecting the opinions of the people I know',
108
+ delayAfter: 2,
109
+ },
110
+ ],
111
+ it: [
112
+ {
113
+ text: '',
114
+ delayAfter: 10,
115
+ },
116
+ {
117
+ text: 'Chiedo agli unicorni cosa ne pensano',
118
+ delayAfter: 5,
119
+ },
120
+ {
121
+ text: 'Sto cercando di capire cosa ne pensa il mio gatto',
122
+ delayAfter: 10,
123
+ },
124
+ {
125
+ text: 'Sto raccogliendo le opinioni delle persone che conosco',
126
+ delayAfter: 2,
127
+ },
128
+ ],
129
+ },
130
+ };
@@ -84,13 +84,16 @@ const Typing = ({
84
84
  const [text, setText] = useState(
85
85
  sentences?.[lang]?.length
86
86
  ? `${
87
- sentences[lang][0].text.endsWith('...')
87
+ sentences[lang][0].text.endsWith('...') ||
88
+ !sentences[lang][0].text.length
88
89
  ? sentences[lang][0].text
89
90
  : `${sentences[lang][0].text}...`
90
91
  }${getSeparatorString(sentences[lang][0].delayAfter)}`
91
92
  : sentence
92
93
  ? `${
93
- sentence.endsWith('...') ? sentence : `${sentence}...`
94
+ sentence.endsWith('...') || !sentence.length
95
+ ? sentence
96
+ : `${sentence}...`
94
97
  }${getSeparatorString()}`
95
98
  : ''
96
99
  );
@@ -109,7 +112,7 @@ const Typing = ({
109
112
  const sentence = sentences[lang][nextIndex];
110
113
  setText(
111
114
  `${
112
- sentence.text.endsWith('...')
115
+ sentence.text.endsWith('...') || !sentence.text.length
113
116
  ? sentence.text
114
117
  : `${sentence.text}...`
115
118
  }${getSeparatorString(sentence.delayAfter)}`
@@ -125,6 +125,10 @@ export const boardOfExpertsLoadingSentences: {
125
125
  }[];
126
126
  } = {
127
127
  it: [
128
+ {
129
+ text: '',
130
+ delayAfter: 10,
131
+ },
128
132
  {
129
133
  text: "Cerco l'esperto più adatto",
130
134
  delayAfter: 5,
@@ -147,6 +151,10 @@ export const boardOfExpertsLoadingSentences: {
147
151
  },
148
152
  ],
149
153
  en: [
154
+ {
155
+ text: '',
156
+ delayAfter: 10,
157
+ },
150
158
  {
151
159
  text: "I'm looking for the most suitable expert",
152
160
  delayAfter: 5,
package/src/index.tsx CHANGED
@@ -42,7 +42,7 @@ export interface Props {
42
42
  pin?: string;
43
43
  context?: { [key: string]: string };
44
44
  initialQuestion?: string;
45
- uiLang?: 'en' | 'it';
45
+ uiLang?: 'en' | 'it' | 'IT' | 'EN';
46
46
  spokenLang?: string;
47
47
  multilingual?: boolean;
48
48
  authToken?: string;
@@ -310,7 +310,7 @@ Memori.propTypes = {
310
310
  pin: PropTypes.string,
311
311
  context: PropTypes.objectOf(PropTypes.any),
312
312
  initialQuestion: PropTypes.string,
313
- uiLang: PropTypes.oneOf(['en', 'it']),
313
+ uiLang: PropTypes.oneOf(['en', 'it', 'EN', 'IT']),
314
314
  spokenLang: PropTypes.string,
315
315
  multilingual: PropTypes.bool,
316
316
  authToken: PropTypes.string,