@memori.ai/memori-react 2.0.8 → 2.0.10
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/dist/components/Avatar/Avatar.css +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +20 -6
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +5 -3
- package/dist/components/SettingsDrawer/SettingsDrawer.js +9 -10
- package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/dist/components/SettingsDrawer/SettingsDrawer.test.js +19 -3
- package/dist/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -1
- package/dist/components/layouts/FullPage.test.js +13 -0
- package/dist/components/layouts/FullPage.test.js.map +1 -1
- package/dist/components/layouts/Totem.test.js +13 -0
- package/dist/components/layouts/Totem.test.js.map +1 -1
- package/dist/components/layouts/totem.css +2 -3
- package/dist/helpers/configuration.js +1 -0
- package/dist/helpers/configuration.js.map +1 -1
- package/dist/locales/en.json +1 -0
- package/dist/locales/it.json +1 -0
- package/esm/components/Avatar/Avatar.css +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.js +20 -6
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +5 -3
- package/esm/components/SettingsDrawer/SettingsDrawer.js +10 -11
- package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.test.js +19 -3
- package/esm/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -1
- package/esm/components/layouts/FullPage.test.js +13 -0
- package/esm/components/layouts/FullPage.test.js.map +1 -1
- package/esm/components/layouts/Totem.test.js +13 -0
- package/esm/components/layouts/Totem.test.js.map +1 -1
- package/esm/components/layouts/totem.css +2 -3
- package/esm/helpers/configuration.js +1 -0
- package/esm/helpers/configuration.js.map +1 -1
- package/esm/locales/en.json +1 -0
- package/esm/locales/it.json +1 -0
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.css +1 -0
- package/src/components/MemoriWidget/MemoriWidget.tsx +46 -13
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +80 -0
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +48 -43
- package/src/components/SettingsDrawer/__snapshots__/SettingsDrawer.test.tsx.snap +32 -0
- package/src/components/layouts/FullPage.test.tsx +14 -0
- package/src/components/layouts/Totem.test.tsx +14 -0
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +1 -1
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +1 -1
- package/src/components/layouts/totem.css +2 -3
- package/src/helpers/configuration.ts +1 -0
- package/src/locales/en.json +1 -0
- package/src/locales/it.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/helpers/configuration.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAA8B;IAC7C,WAAW,EAAE,qBAAqB;IAClC,gBAAgB,EAAE,0BAA0B;IAC5C,uBAAuB,EAAE,iCAAiC;IAC1D,WAAW,EAAE,qBAAqB;IAClC,SAAS,EAAE,mBAAmB;IAC9B,gBAAgB,EAAE,0BAA0B;
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/helpers/configuration.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAA8B;IAC7C,WAAW,EAAE,qBAAqB;IAClC,gBAAgB,EAAE,0BAA0B;IAC5C,uBAAuB,EAAE,iCAAiC;IAC1D,WAAW,EAAE,qBAAqB;IAClC,SAAS,EAAE,mBAAmB;IAC9B,gBAAgB,EAAE,0BAA0B;IAC5C,aAAa,EAAE,uBAAuB;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAO,GAAW,EAAE,YAAkB,EAAQ,EAAE;;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,MAAA,IAAI,CAAC,GAAG,CAAC,mCAAI,GAAG,CAAC,CAAC;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,YAAY,CAAC;IAEhC,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAoB,CAAC;KAC7C;IAAC,WAAM;QACN,OAAO,KAAwB,CAAC;KACjC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,KAAU,EAAQ,EAAE;;IAC9D,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,MAAA,IAAI,CAAC,GAAG,CAAC,mCAAI,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC"}
|
package/esm/locales/en.json
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"conversationStartedLabel": "Conversation started on",
|
|
71
71
|
"settingsHeaderLabel": "Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.",
|
|
72
72
|
"continuousSpeechLabel": "Continuous speech",
|
|
73
|
+
"hideEmissionsLabel": "Hide text emitted by the Twin",
|
|
73
74
|
"secondsLabel": "Set seconds",
|
|
74
75
|
"controlsPosition": "Controls position",
|
|
75
76
|
"tryMeHeaderLabel": "TRY",
|
package/esm/locales/it.json
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"conversationStartedLabel": "Conversazione avvenuta il",
|
|
71
71
|
"settingsHeaderLabel": "Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell'invio.",
|
|
72
72
|
"continuousSpeechLabel": "Conversazione continua",
|
|
73
|
+
"hideEmissionsLabel": "Nascondi testo emesso dal Twin",
|
|
73
74
|
"secondsLabel": "Secondi",
|
|
74
75
|
"controlsPosition": "Posizione dei controlli",
|
|
75
76
|
"tryMeHeaderLabel": "PROVA",
|
package/package.json
CHANGED
|
@@ -261,19 +261,38 @@ const MemoriWidget = ({
|
|
|
261
261
|
const [continuousSpeech, setContinuousSpeech] = useState(true);
|
|
262
262
|
const [continuousSpeechTimeout, setContinuousSpeechTimeout] = useState(2);
|
|
263
263
|
const [isPlayingAudio, setIsPlayingAudio] = useState(false);
|
|
264
|
-
const [controlsPosition, setControlsPosition] = useState<
|
|
265
|
-
'center'
|
|
266
|
-
|
|
264
|
+
const [controlsPosition, setControlsPosition] = useState<'center' | 'bottom'>(
|
|
265
|
+
'center'
|
|
266
|
+
);
|
|
267
|
+
const [hideEmissions, setHideEmissions] = useState(false);
|
|
267
268
|
useEffect(() => {
|
|
268
269
|
setIsPlayingAudio(!!speechSynthesizer);
|
|
269
270
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
270
271
|
}, [speechSynthesizer]);
|
|
271
272
|
|
|
272
273
|
useEffect(() => {
|
|
274
|
+
let defaultControlsPosition: 'center' | 'bottom' = 'bottom';
|
|
275
|
+
if (window.innerWidth < 768) {
|
|
276
|
+
// on mobile, default position is bottom
|
|
277
|
+
defaultControlsPosition = 'bottom';
|
|
278
|
+
} else if (
|
|
279
|
+
window.matchMedia('(orientation: portrait)').matches ||
|
|
280
|
+
window.innerHeight > window.innerWidth
|
|
281
|
+
) {
|
|
282
|
+
// on portrait, default position is center
|
|
283
|
+
defaultControlsPosition = 'center';
|
|
284
|
+
} else {
|
|
285
|
+
// on landscape, default position is bottom
|
|
286
|
+
defaultControlsPosition = 'bottom';
|
|
287
|
+
}
|
|
288
|
+
|
|
273
289
|
setMuteSpeaker(getLocalConfig('muteSpeaker', false));
|
|
274
290
|
setContinuousSpeech(getLocalConfig('continuousSpeech', true));
|
|
275
291
|
setContinuousSpeechTimeout(getLocalConfig('continuousSpeechTimeout', 2));
|
|
276
|
-
setControlsPosition(
|
|
292
|
+
setControlsPosition(
|
|
293
|
+
getLocalConfig('controlsPosition', defaultControlsPosition)
|
|
294
|
+
);
|
|
295
|
+
setHideEmissions(getLocalConfig('hideEmissions', false));
|
|
277
296
|
}, []);
|
|
278
297
|
|
|
279
298
|
/**
|
|
@@ -1086,7 +1105,13 @@ const MemoriWidget = ({
|
|
|
1086
1105
|
|
|
1087
1106
|
const [phonemesMap, setPhonemesMap] = useState<{
|
|
1088
1107
|
[ns: 'common' | string]: {
|
|
1089
|
-
[word: string]: {
|
|
1108
|
+
[word: string]: {
|
|
1109
|
+
caseSensitive: boolean;
|
|
1110
|
+
default: string;
|
|
1111
|
+
it?: string;
|
|
1112
|
+
en?: string;
|
|
1113
|
+
fr?: string;
|
|
1114
|
+
};
|
|
1090
1115
|
};
|
|
1091
1116
|
}>();
|
|
1092
1117
|
const fetchLexiconJSON = async () => {
|
|
@@ -1121,15 +1146,20 @@ const MemoriWidget = ({
|
|
|
1121
1146
|
...(tenant?.id && phonemesMap[tenant.id] ? phonemesMap[tenant.id] : {}),
|
|
1122
1147
|
};
|
|
1123
1148
|
const phonemesPairs = Object.keys(phonemes).map(word => {
|
|
1124
|
-
const phoneme =
|
|
1125
|
-
|
|
1149
|
+
const phoneme =
|
|
1150
|
+
phonemes[word][lang.toLowerCase() as 'it' | 'en' | 'fr'] ??
|
|
1151
|
+
phonemes[word].default;
|
|
1152
|
+
return { word, phoneme, caseSensitive: phonemes[word].caseSensitive };
|
|
1126
1153
|
});
|
|
1127
|
-
const ssmlText = phonemesPairs.reduce(
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1154
|
+
const ssmlText = phonemesPairs.reduce(
|
|
1155
|
+
(acc, { word, phoneme, caseSensitive }) => {
|
|
1156
|
+
return acc.replace(
|
|
1157
|
+
new RegExp(`\\b${word}\\b`, caseSensitive ? 'g' : 'gi'),
|
|
1158
|
+
`<phoneme alphabet="ipa" ph="${phoneme}">${word}</phoneme>`
|
|
1159
|
+
);
|
|
1160
|
+
},
|
|
1161
|
+
text
|
|
1162
|
+
);
|
|
1133
1163
|
|
|
1134
1164
|
return ssmlText;
|
|
1135
1165
|
|
|
@@ -2241,6 +2271,7 @@ const MemoriWidget = ({
|
|
|
2241
2271
|
'memori--with-integration': integration,
|
|
2242
2272
|
'memori--with-speechkey': !!AZURE_COGNITIVE_SERVICES_TTS_KEY,
|
|
2243
2273
|
'memori--active': hasUserActivatedSpeak,
|
|
2274
|
+
'memori--hide-emissions': hideEmissions,
|
|
2244
2275
|
}
|
|
2245
2276
|
)}
|
|
2246
2277
|
data-memori-name={memori?.name}
|
|
@@ -2358,6 +2389,8 @@ const MemoriWidget = ({
|
|
|
2358
2389
|
setContinuousSpeechTimeout={setContinuousSpeechTimeout}
|
|
2359
2390
|
controlsPosition={controlsPosition}
|
|
2360
2391
|
setControlsPosition={setControlsPosition}
|
|
2392
|
+
hideEmissions={hideEmissions}
|
|
2393
|
+
setHideEmissions={setHideEmissions}
|
|
2361
2394
|
/>
|
|
2362
2395
|
)}
|
|
2363
2396
|
|
|
@@ -22,6 +22,8 @@ it('renders SettingsDrawer unchanged', () => {
|
|
|
22
22
|
setContinuousSpeechTimeout={jest.fn()}
|
|
23
23
|
controlsPosition="bottom"
|
|
24
24
|
setControlsPosition={jest.fn()}
|
|
25
|
+
hideEmissions={false}
|
|
26
|
+
setHideEmissions={jest.fn()}
|
|
25
27
|
/>
|
|
26
28
|
);
|
|
27
29
|
expect(container).toMatchSnapshot();
|
|
@@ -38,6 +40,44 @@ it('renders SettingsDrawer open unchanged', () => {
|
|
|
38
40
|
setContinuousSpeechTimeout={jest.fn()}
|
|
39
41
|
controlsPosition="bottom"
|
|
40
42
|
setControlsPosition={jest.fn()}
|
|
43
|
+
hideEmissions={false}
|
|
44
|
+
setHideEmissions={jest.fn()}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
expect(container).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('renders SettingsDrawer open with continuous speech enabled unchanged', () => {
|
|
51
|
+
const { container } = render(
|
|
52
|
+
<SettingsDrawer
|
|
53
|
+
open={true}
|
|
54
|
+
onClose={jest.fn()}
|
|
55
|
+
continuousSpeech={true}
|
|
56
|
+
continuousSpeechTimeout={2}
|
|
57
|
+
setContinuousSpeech={jest.fn()}
|
|
58
|
+
setContinuousSpeechTimeout={jest.fn()}
|
|
59
|
+
controlsPosition="bottom"
|
|
60
|
+
setControlsPosition={jest.fn()}
|
|
61
|
+
hideEmissions={false}
|
|
62
|
+
setHideEmissions={jest.fn()}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
expect(container).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('renders SettingsDrawer open with non-default continuous speech timeout unchanged', () => {
|
|
69
|
+
const { container } = render(
|
|
70
|
+
<SettingsDrawer
|
|
71
|
+
open={true}
|
|
72
|
+
onClose={jest.fn()}
|
|
73
|
+
continuousSpeech={false}
|
|
74
|
+
continuousSpeechTimeout={10}
|
|
75
|
+
setContinuousSpeech={jest.fn()}
|
|
76
|
+
setContinuousSpeechTimeout={jest.fn()}
|
|
77
|
+
controlsPosition="bottom"
|
|
78
|
+
setControlsPosition={jest.fn()}
|
|
79
|
+
hideEmissions={false}
|
|
80
|
+
setHideEmissions={jest.fn()}
|
|
41
81
|
/>
|
|
42
82
|
);
|
|
43
83
|
expect(container).toMatchSnapshot();
|
|
@@ -55,6 +95,46 @@ it('renders SettingsDrawer for totem layout open unchanged', () => {
|
|
|
55
95
|
setContinuousSpeechTimeout={jest.fn()}
|
|
56
96
|
controlsPosition="bottom"
|
|
57
97
|
setControlsPosition={jest.fn()}
|
|
98
|
+
hideEmissions={false}
|
|
99
|
+
setHideEmissions={jest.fn()}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
expect(container).toMatchSnapshot();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('renders SettingsDrawer for totem layout open with controls at center unchanged', () => {
|
|
106
|
+
const { container } = render(
|
|
107
|
+
<SettingsDrawer
|
|
108
|
+
layout="TOTEM"
|
|
109
|
+
open={true}
|
|
110
|
+
onClose={jest.fn()}
|
|
111
|
+
continuousSpeech={false}
|
|
112
|
+
continuousSpeechTimeout={2}
|
|
113
|
+
setContinuousSpeech={jest.fn()}
|
|
114
|
+
setContinuousSpeechTimeout={jest.fn()}
|
|
115
|
+
controlsPosition="center"
|
|
116
|
+
setControlsPosition={jest.fn()}
|
|
117
|
+
hideEmissions={false}
|
|
118
|
+
setHideEmissions={jest.fn()}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
expect(container).toMatchSnapshot();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('renders SettingsDrawer for totem layout with continuous speech and hide emissions unchanged', () => {
|
|
125
|
+
const { container } = render(
|
|
126
|
+
<SettingsDrawer
|
|
127
|
+
layout="TOTEM"
|
|
128
|
+
open={true}
|
|
129
|
+
onClose={jest.fn()}
|
|
130
|
+
continuousSpeech={true}
|
|
131
|
+
continuousSpeechTimeout={2}
|
|
132
|
+
setContinuousSpeech={jest.fn()}
|
|
133
|
+
setContinuousSpeechTimeout={jest.fn()}
|
|
134
|
+
controlsPosition="bottom"
|
|
135
|
+
setControlsPosition={jest.fn()}
|
|
136
|
+
hideEmissions={true}
|
|
137
|
+
setHideEmissions={jest.fn()}
|
|
58
138
|
/>
|
|
59
139
|
);
|
|
60
140
|
expect(container).toMatchSnapshot();
|
|
@@ -15,8 +15,10 @@ export interface Props {
|
|
|
15
15
|
continuousSpeechTimeout?: number;
|
|
16
16
|
setContinuousSpeech: (value: boolean) => void;
|
|
17
17
|
setContinuousSpeechTimeout: (value: number) => void;
|
|
18
|
-
controlsPosition?: 'center' | 'bottom'
|
|
19
|
-
setControlsPosition: (value: 'center' | 'bottom'
|
|
18
|
+
controlsPosition?: 'center' | 'bottom';
|
|
19
|
+
setControlsPosition: (value: 'center' | 'bottom') => void;
|
|
20
|
+
hideEmissions?: boolean;
|
|
21
|
+
setHideEmissions: (value: boolean) => void;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const silenceSeconds = [2, 3, 5, 10, 15, 20, 30, 60];
|
|
@@ -31,6 +33,8 @@ const SettingsDrawer = ({
|
|
|
31
33
|
setContinuousSpeechTimeout,
|
|
32
34
|
controlsPosition,
|
|
33
35
|
setControlsPosition,
|
|
36
|
+
hideEmissions,
|
|
37
|
+
setHideEmissions,
|
|
34
38
|
}: Props) => {
|
|
35
39
|
const { t } = useTranslation();
|
|
36
40
|
|
|
@@ -45,15 +49,11 @@ const SettingsDrawer = ({
|
|
|
45
49
|
<div className="memori-settings-drawer--field">
|
|
46
50
|
<Checkbox
|
|
47
51
|
label={t('write_and_speak.continuousSpeechLabel')}
|
|
52
|
+
name="continuousSpeech"
|
|
48
53
|
checked={continuousSpeech}
|
|
49
54
|
onChange={e => {
|
|
50
55
|
setContinuousSpeech(e.target.checked);
|
|
51
56
|
setLocalConfig('continuousSpeech', e.target.checked);
|
|
52
|
-
|
|
53
|
-
if (!e.target.checked && controlsPosition === 'hidden') {
|
|
54
|
-
setControlsPosition('bottom');
|
|
55
|
-
setLocalConfig('controlsPosition', 'bottom');
|
|
56
|
-
}
|
|
57
57
|
}}
|
|
58
58
|
/>
|
|
59
59
|
</div>
|
|
@@ -72,49 +72,54 @@ const SettingsDrawer = ({
|
|
|
72
72
|
</div>
|
|
73
73
|
|
|
74
74
|
{layout === 'TOTEM' && (
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<RadioGroup.Option
|
|
91
|
-
value="center"
|
|
92
|
-
className="memori-settings-drawer--controlsposition-radio-button"
|
|
93
|
-
>
|
|
94
|
-
{({ checked }) => (
|
|
95
|
-
<Button primary={checked}>{t('center') || 'Center'}</Button>
|
|
96
|
-
)}
|
|
97
|
-
</RadioGroup.Option>
|
|
98
|
-
<RadioGroup.Option
|
|
99
|
-
value="bottom"
|
|
100
|
-
className="memori-settings-drawer--controlsposition-radio-button"
|
|
75
|
+
<>
|
|
76
|
+
<div className="memori-settings-drawer--field controls">
|
|
77
|
+
<label htmlFor="#controlsPosition">
|
|
78
|
+
{t('write_and_speak.controlsPosition') || 'Controls'}:
|
|
79
|
+
</label>
|
|
80
|
+
<RadioGroup
|
|
81
|
+
id="controlsPosition"
|
|
82
|
+
name="controlsPosition"
|
|
83
|
+
value={controlsPosition}
|
|
84
|
+
defaultValue={controlsPosition}
|
|
85
|
+
className="memori-settings-drawer--controlsposition-radio"
|
|
86
|
+
onChange={value => {
|
|
87
|
+
setControlsPosition(value);
|
|
88
|
+
setLocalConfig('controlsPosition', value);
|
|
89
|
+
}}
|
|
101
90
|
>
|
|
102
|
-
{({ checked }) => (
|
|
103
|
-
<Button primary={checked}>{t('bottom') || 'Bottom'}</Button>
|
|
104
|
-
)}
|
|
105
|
-
</RadioGroup.Option>
|
|
106
|
-
{!!continuousSpeech && (
|
|
107
91
|
<RadioGroup.Option
|
|
108
|
-
value="
|
|
92
|
+
value="center"
|
|
93
|
+
className="memori-settings-drawer--controlsposition-radio-button"
|
|
94
|
+
>
|
|
95
|
+
{({ checked }) => (
|
|
96
|
+
<Button primary={checked}>{t('center') || 'Center'}</Button>
|
|
97
|
+
)}
|
|
98
|
+
</RadioGroup.Option>
|
|
99
|
+
<RadioGroup.Option
|
|
100
|
+
value="bottom"
|
|
109
101
|
className="memori-settings-drawer--controlsposition-radio-button"
|
|
110
102
|
>
|
|
111
103
|
{({ checked }) => (
|
|
112
|
-
<Button primary={checked}>{t('
|
|
104
|
+
<Button primary={checked}>{t('bottom') || 'Bottom'}</Button>
|
|
113
105
|
)}
|
|
114
106
|
</RadioGroup.Option>
|
|
115
|
-
|
|
116
|
-
</
|
|
117
|
-
|
|
107
|
+
</RadioGroup>
|
|
108
|
+
</div>
|
|
109
|
+
{!!continuousSpeech && (
|
|
110
|
+
<div className="memori-settings-drawer--field">
|
|
111
|
+
<Checkbox
|
|
112
|
+
label={t('write_and_speak.hideEmissionsLabel')}
|
|
113
|
+
name="hideControls"
|
|
114
|
+
checked={hideEmissions}
|
|
115
|
+
onChange={e => {
|
|
116
|
+
setHideEmissions(e.target.checked);
|
|
117
|
+
setLocalConfig('hideEmissions', e.target.checked);
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
</>
|
|
118
123
|
)}
|
|
119
124
|
</Drawer>
|
|
120
125
|
);
|
|
@@ -8,6 +8,22 @@ exports[`renders SettingsDrawer for totem layout open unchanged 1`] = `
|
|
|
8
8
|
</div>
|
|
9
9
|
`;
|
|
10
10
|
|
|
11
|
+
exports[`renders SettingsDrawer for totem layout open with controls at center unchanged 1`] = `
|
|
12
|
+
<div>
|
|
13
|
+
<div
|
|
14
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`renders SettingsDrawer for totem layout with continuous speech and hide emissions unchanged 1`] = `
|
|
20
|
+
<div>
|
|
21
|
+
<div
|
|
22
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
|
|
11
27
|
exports[`renders SettingsDrawer open unchanged 1`] = `
|
|
12
28
|
<div>
|
|
13
29
|
<div
|
|
@@ -16,4 +32,20 @@ exports[`renders SettingsDrawer open unchanged 1`] = `
|
|
|
16
32
|
</div>
|
|
17
33
|
`;
|
|
18
34
|
|
|
35
|
+
exports[`renders SettingsDrawer open with continuous speech enabled unchanged 1`] = `
|
|
36
|
+
<div>
|
|
37
|
+
<div
|
|
38
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
exports[`renders SettingsDrawer open with non-default continuous speech timeout unchanged 1`] = `
|
|
44
|
+
<div>
|
|
45
|
+
<div
|
|
46
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
|
|
19
51
|
exports[`renders SettingsDrawer unchanged 1`] = `<div />`;
|
|
@@ -2,6 +2,20 @@ import { render } from '@testing-library/react';
|
|
|
2
2
|
import Memori from '../MemoriWidget/MemoriWidget';
|
|
3
3
|
import { integration, memori, tenant } from '../../mocks/data';
|
|
4
4
|
|
|
5
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
6
|
+
writable: true,
|
|
7
|
+
value: jest.fn().mockImplementation(query => ({
|
|
8
|
+
matches: false,
|
|
9
|
+
media: query,
|
|
10
|
+
onchange: null,
|
|
11
|
+
addListener: jest.fn(), // Deprecated
|
|
12
|
+
removeListener: jest.fn(), // Deprecated
|
|
13
|
+
addEventListener: jest.fn(),
|
|
14
|
+
removeEventListener: jest.fn(),
|
|
15
|
+
dispatchEvent: jest.fn(),
|
|
16
|
+
})),
|
|
17
|
+
});
|
|
18
|
+
|
|
5
19
|
it('renders FullPage layout unchanged', () => {
|
|
6
20
|
const { container } = render(
|
|
7
21
|
<Memori
|
|
@@ -2,6 +2,20 @@ import { render } from '@testing-library/react';
|
|
|
2
2
|
import Memori from '../MemoriWidget/MemoriWidget';
|
|
3
3
|
import { integration, memori, tenant } from '../../mocks/data';
|
|
4
4
|
|
|
5
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
6
|
+
writable: true,
|
|
7
|
+
value: jest.fn().mockImplementation(query => ({
|
|
8
|
+
matches: false,
|
|
9
|
+
media: query,
|
|
10
|
+
onchange: null,
|
|
11
|
+
addListener: jest.fn(), // Deprecated
|
|
12
|
+
removeListener: jest.fn(), // Deprecated
|
|
13
|
+
addEventListener: jest.fn(),
|
|
14
|
+
removeEventListener: jest.fn(),
|
|
15
|
+
dispatchEvent: jest.fn(),
|
|
16
|
+
})),
|
|
17
|
+
});
|
|
18
|
+
|
|
5
19
|
it('renders Totem layout unchanged', () => {
|
|
6
20
|
const { container } = render(
|
|
7
21
|
<Memori
|
|
@@ -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-
|
|
6
|
+
class="memori memori-widget memori-layout-fullpage memori-controls-bottom 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 Totem layout unchanged 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="memori memori-widget memori-layout-totem memori-controls-
|
|
6
|
+
class="memori memori-widget memori-layout-totem memori-controls-bottom 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"
|
|
@@ -113,15 +113,14 @@
|
|
|
113
113
|
background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(200, 200, 200, 0.8));
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.memori-widget.memori-controls-hidden .memori-totem-layout--controls,
|
|
117
116
|
.memori-widget.memori-controls-center .memori-totem-layout--controls {
|
|
118
117
|
position: absolute;
|
|
119
118
|
top: 40%;
|
|
120
119
|
width: 100%;
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
.memori-widget.memori-layout-totem.memori-
|
|
124
|
-
.memori-widget.memori-layout-totem.memori-
|
|
122
|
+
.memori-widget.memori-layout-totem.memori--hide-emissions .memori-totem-layout--controls .memori-chat--bubble-container:not(.memori-chat--bubble-from-user),
|
|
123
|
+
.memori-widget.memori-layout-totem.memori--hide-emissions.memori--with-speechkey .memori-totem-layout--controls .memori-chat--bubble-container:not(.memori-chat--bubble-from-user) {
|
|
125
124
|
display: none;
|
|
126
125
|
}
|
|
127
126
|
|
|
@@ -5,6 +5,7 @@ export const keys: { [key: string]: string } = {
|
|
|
5
5
|
sendOnEnter: '@memori:sendOnEnter',
|
|
6
6
|
birthDate: '@memori:birthDate',
|
|
7
7
|
controlsPosition: '@memori:controlsPosition',
|
|
8
|
+
hideEmissions: '@memori:hideEmissions',
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export const getLocalConfig = <Type>(key: string, defaultValue: Type): Type => {
|
package/src/locales/en.json
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"conversationStartedLabel": "Conversation started on",
|
|
71
71
|
"settingsHeaderLabel": "Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.",
|
|
72
72
|
"continuousSpeechLabel": "Continuous speech",
|
|
73
|
+
"hideEmissionsLabel": "Hide text emitted by the Twin",
|
|
73
74
|
"secondsLabel": "Set seconds",
|
|
74
75
|
"controlsPosition": "Controls position",
|
|
75
76
|
"tryMeHeaderLabel": "TRY",
|
package/src/locales/it.json
CHANGED
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"conversationStartedLabel": "Conversazione avvenuta il",
|
|
71
71
|
"settingsHeaderLabel": "Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell'invio.",
|
|
72
72
|
"continuousSpeechLabel": "Conversazione continua",
|
|
73
|
+
"hideEmissionsLabel": "Nascondi testo emesso dal Twin",
|
|
73
74
|
"secondsLabel": "Secondi",
|
|
74
75
|
"controlsPosition": "Posizione dei controlli",
|
|
75
76
|
"tryMeHeaderLabel": "PROVA",
|