@memori.ai/memori-react 2.0.8 → 2.0.9

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/MemoriWidget/MemoriWidget.js +4 -1
  3. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  4. package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +5 -3
  5. package/dist/components/SettingsDrawer/SettingsDrawer.js +9 -10
  6. package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
  7. package/dist/components/SettingsDrawer/SettingsDrawer.test.js +19 -3
  8. package/dist/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -1
  9. package/dist/components/layouts/totem.css +2 -3
  10. package/dist/helpers/configuration.js +1 -0
  11. package/dist/helpers/configuration.js.map +1 -1
  12. package/dist/locales/en.json +1 -0
  13. package/dist/locales/it.json +1 -0
  14. package/esm/components/MemoriWidget/MemoriWidget.js +4 -1
  15. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  16. package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +5 -3
  17. package/esm/components/SettingsDrawer/SettingsDrawer.js +10 -11
  18. package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
  19. package/esm/components/SettingsDrawer/SettingsDrawer.test.js +19 -3
  20. package/esm/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -1
  21. package/esm/components/layouts/totem.css +2 -3
  22. package/esm/helpers/configuration.js +1 -0
  23. package/esm/helpers/configuration.js.map +1 -1
  24. package/esm/locales/en.json +1 -0
  25. package/esm/locales/it.json +1 -0
  26. package/package.json +1 -1
  27. package/src/components/MemoriWidget/MemoriWidget.tsx +8 -3
  28. package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +80 -0
  29. package/src/components/SettingsDrawer/SettingsDrawer.tsx +48 -43
  30. package/src/components/SettingsDrawer/__snapshots__/SettingsDrawer.test.tsx.snap +32 -0
  31. package/src/components/layouts/totem.css +2 -3
  32. package/src/helpers/configuration.ts +1 -0
  33. package/src/locales/en.json +1 -0
  34. package/src/locales/it.json +1 -0
@@ -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' | 'hidden';
19
- setControlsPosition: (value: 'center' | 'bottom' | 'hidden') => void;
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
- <div className="memori-settings-drawer--field controls">
76
- <label htmlFor="#controlsPosition">
77
- {t('write_and_speak.controlsPosition') || 'Controls'}:
78
- </label>
79
- <RadioGroup
80
- id="controlsPosition"
81
- name="controlsPosition"
82
- value={controlsPosition}
83
- defaultValue={controlsPosition}
84
- className="memori-settings-drawer--controlsposition-radio"
85
- onChange={value => {
86
- setControlsPosition(value);
87
- setLocalConfig('controlsPosition', value);
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="hidden"
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('hidden') || 'Hidden'}</Button>
104
+ <Button primary={checked}>{t('bottom') || 'Bottom'}</Button>
113
105
  )}
114
106
  </RadioGroup.Option>
115
- )}
116
- </RadioGroup>
117
- </div>
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 />`;
@@ -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-controls-hidden .memori-totem-layout--controls .memori-chat--bubble-container:not(.memori-chat--bubble-from-user),
124
- .memori-widget.memori-layout-totem.memori-controls-hidden.memori--with-speechkey .memori-totem-layout--controls .memori-chat--bubble-container:not(.memori-chat--bubble-from-user) {
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 => {
@@ -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",
@@ -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",