@memori.ai/memori-react 7.16.1 → 7.17.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +0 -1
  3. package/dist/components/Avatar/AvatarView/AvatarComponent/lights/Lights.d.ts +27 -0
  4. package/dist/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js +52 -0
  5. package/dist/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js.map +1 -0
  6. package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +19 -7
  7. package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js +7 -7
  8. package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js.map +1 -1
  9. package/dist/components/Avatar/AvatarView/index.js +2 -3
  10. package/dist/components/Avatar/AvatarView/index.js.map +1 -1
  11. package/dist/components/ChatTextArea/ChatTextArea.css +55 -60
  12. package/dist/components/MemoriWidget/MemoriWidget.js +247 -149
  13. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  14. package/dist/components/SettingsDrawer/SettingsDrawer.css +5 -0
  15. package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +2 -1
  16. package/dist/components/SettingsDrawer/SettingsDrawer.js +6 -3
  17. package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
  18. package/dist/components/UploadButton/UploadButton.d.ts +5 -0
  19. package/dist/components/UploadButton/UploadButton.js +49 -48
  20. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  21. package/dist/components/ui/Slider.css +59 -44
  22. package/dist/context/visemeContext.d.ts +1 -1
  23. package/dist/context/visemeContext.js +2 -2
  24. package/dist/context/visemeContext.js.map +1 -1
  25. package/dist/index.d.ts +0 -1
  26. package/dist/index.js +17 -12
  27. package/dist/index.js.map +1 -1
  28. package/dist/locales/de.json +1 -0
  29. package/dist/locales/en.json +1 -0
  30. package/dist/locales/es.json +1 -0
  31. package/dist/locales/fr.json +1 -0
  32. package/dist/locales/it.json +1 -0
  33. package/esm/components/Avatar/AvatarView/AvatarComponent/lights/Lights.d.ts +27 -0
  34. package/esm/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js +48 -0
  35. package/esm/components/Avatar/AvatarView/AvatarComponent/lights/Lights.js.map +1 -0
  36. package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +19 -7
  37. package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js +7 -7
  38. package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.js.map +1 -1
  39. package/esm/components/Avatar/AvatarView/index.js +3 -4
  40. package/esm/components/Avatar/AvatarView/index.js.map +1 -1
  41. package/esm/components/ChatTextArea/ChatTextArea.css +55 -60
  42. package/esm/components/MemoriWidget/MemoriWidget.js +248 -150
  43. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  44. package/esm/components/SettingsDrawer/SettingsDrawer.css +5 -0
  45. package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +2 -1
  46. package/esm/components/SettingsDrawer/SettingsDrawer.js +6 -3
  47. package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
  48. package/esm/components/UploadButton/UploadButton.d.ts +5 -0
  49. package/esm/components/UploadButton/UploadButton.js +50 -49
  50. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  51. package/esm/components/ui/Slider.css +59 -44
  52. package/esm/context/visemeContext.d.ts +1 -1
  53. package/esm/context/visemeContext.js +2 -2
  54. package/esm/context/visemeContext.js.map +1 -1
  55. package/esm/index.d.ts +0 -1
  56. package/esm/index.js +17 -12
  57. package/esm/index.js.map +1 -1
  58. package/esm/locales/de.json +1 -0
  59. package/esm/locales/en.json +1 -0
  60. package/esm/locales/es.json +1 -0
  61. package/esm/locales/fr.json +1 -0
  62. package/esm/locales/it.json +1 -0
  63. package/package.json +2 -3
  64. package/src/components/Avatar/AvatarView/AvatarComponent/lights/Lights.tsx +145 -0
  65. package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +19 -7
  66. package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.tsx +6 -14
  67. package/src/components/Avatar/AvatarView/index.tsx +5 -14
  68. package/src/components/ChatTextArea/ChatTextArea.css +55 -60
  69. package/src/components/MemoriWidget/MemoriWidget.tsx +385 -203
  70. package/src/components/SettingsDrawer/SettingsDrawer.css +5 -0
  71. package/src/components/SettingsDrawer/SettingsDrawer.tsx +29 -11
  72. package/src/components/UploadButton/UploadButton.tsx +139 -118
  73. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +3 -52
  74. package/src/components/ui/Slider.css +59 -44
  75. package/src/context/visemeContext.tsx +2 -2
  76. package/src/index.tsx +15 -18
  77. package/src/locales/de.json +1 -0
  78. package/src/locales/en.json +1 -0
  79. package/src/locales/es.json +1 -0
  80. package/src/locales/fr.json +1 -0
  81. package/src/locales/it.json +1 -0
@@ -2,10 +2,11 @@
2
2
  position: relative;
3
3
  width: 100%;
4
4
  max-width: 100%;
5
- padding: 16px 12px; /* Increased padding for better touch area */
5
+ padding: 12px 12px;
6
6
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
7
7
  touch-action: none;
8
8
  user-select: none;
9
+
9
10
  }
10
11
 
11
12
  .memori--slider-disabled {
@@ -14,27 +15,26 @@
14
15
  }
15
16
 
16
17
  .memori--slider-header {
17
- position: absolute; /* Changed from absolute for better layout */
18
- top: 0;
18
+ position: absolute;
19
19
  display: flex;
20
20
  width: 100%;
21
21
  align-items: center;
22
22
  justify-content: space-between;
23
- margin-bottom: 8px;
23
+ margin-bottom: 16px;
24
+ /* max-height: 10px; */
24
25
  }
25
26
 
26
27
  .memori--slider-label {
27
- max-width: 100%;
28
- color: #333;
29
- font-size: 1.4rem; /* Larger font for kiosk display */
28
+ max-width: 70%;
29
+ font-size: 1.2rem;
30
30
  font-weight: 500;
31
+ line-height: 1.2;
31
32
  }
32
33
 
33
34
  .memori--slider-value {
34
- min-width: 50px; /* Increased for larger numbers */
35
- max-width: 100%;
36
- color: #666;
37
- font-size: 1.2rem; /* Larger font */
35
+ min-width: 40px;
36
+ max-width: 30%;
37
+ font-size: 1rem;
38
38
  font-weight: 500;
39
39
  text-align: right;
40
40
  }
@@ -42,9 +42,10 @@
42
42
  .memori--slider-track-container {
43
43
  position: relative;
44
44
  display: flex;
45
- height: 64px; /* Increased height for better touch area */
46
- max-height: 64px;
45
+ height: 96px;
46
+ max-height: 96px;
47
47
  align-items: center;
48
+ margin-top: 8px;
48
49
  cursor: pointer;
49
50
  touch-action: none;
50
51
  }
@@ -53,9 +54,9 @@
53
54
  position: absolute;
54
55
  overflow: hidden;
55
56
  width: 100%;
56
- height: 12px; /* Thicker track */
57
- max-height: 12px;
58
- border-radius: 6px;
57
+ height: 16px;
58
+ max-height: 16px;
59
+ border-radius: 8px;
59
60
  background-color: #e5e5e5;
60
61
  }
61
62
 
@@ -63,7 +64,7 @@
63
64
  position: absolute;
64
65
  width: var(--percentage);
65
66
  height: 100%;
66
- border-radius: 6px;
67
+ border-radius: 8px;
67
68
  background-color: var(--memori-primary, #2563eb);
68
69
  transition: width 0.15s ease;
69
70
  }
@@ -73,40 +74,42 @@
73
74
  display: flex;
74
75
  width: 100%;
75
76
  justify-content: space-between;
76
- padding: 0 4px;
77
- padding-top: 20px; /* Increased spacing */
77
+ padding: 0 8px;
78
+ padding-top: 24px;
78
79
  pointer-events: none;
79
80
  }
80
81
 
81
82
  .memori--slider-mark {
82
83
  display: flex;
84
+ min-width: 40px;
83
85
  flex-direction: column;
84
86
  align-items: center;
85
87
  }
86
88
 
87
89
  .memori--slider-mark-line {
88
- width: 3px; /* Thicker marks */
89
- height: 6px;
90
- max-height: 6px;
91
- margin-bottom: 6px;
90
+ width: 3px;
91
+ height: 8px;
92
+ max-height: 8px;
93
+ margin-bottom: 8px;
92
94
  background-color: #9ca3af;
93
95
  }
94
96
 
95
97
  .memori--slider-mark-value {
96
98
  color: #666;
97
- font-size: 1rem; /* Larger font */
99
+ font-size: 1rem;
98
100
  font-weight: 500;
101
+ white-space: nowrap;
99
102
  }
100
103
 
101
104
  .memori--slider-thumb {
102
105
  position: absolute;
103
106
  z-index: 1;
104
107
  left: var(--percentage);
105
- width: 36px; /* Larger thumb */
106
- max-width: 36px;
107
- height: 36px;
108
- max-height: 36px;
109
- border: 3px solid var(--memori-primary, #2563eb);
108
+ width: 40px;
109
+ max-width: 40px;
110
+ height: 40px;
111
+ max-height: 40px;
112
+ border: 4px solid var(--memori-primary, #2563eb);
110
113
  border-radius: 50%;
111
114
  background-color: white;
112
115
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
@@ -118,40 +121,46 @@
118
121
  .memori--slider-thumb:hover,
119
122
  .memori--slider-thumb:active {
120
123
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
121
- transform: translateX(-50%) scale(1.15);
124
+ transform: translateX(-50%) scale(1.1);
122
125
  }
123
126
 
124
127
  /* Portrait/Totem specific styles */
125
128
  @media screen and (max-aspect-ratio: 3/4) {
126
129
  .memori--slider-container {
127
- padding: 28px 16px;
130
+ padding: 16px;
131
+ }
132
+
133
+ .memori--slider-header {
134
+ margin-bottom: 16px;
128
135
  }
129
136
 
130
137
  .memori--slider-label {
131
- font-size: 1.5rem;
138
+ font-size: 1.3rem;
132
139
  }
133
140
 
134
141
  .memori--slider-value {
135
- min-width: 60px;
136
- font-size: 1.3rem;
142
+ min-width: 50px;
143
+ font-size: 1.1rem;
137
144
  }
138
145
 
139
146
  .memori--slider-track-container {
140
- height: 72px;
147
+ height: 80px;
148
+ margin-top: 8px;
141
149
  }
142
150
 
143
151
  .memori--slider-track {
144
- height: 14px;
145
- border-radius: 7px;
152
+ height: 16px;
153
+ border-radius: 10px;
146
154
  }
147
155
 
148
156
  .memori--slider-thumb {
149
- width: 44px;
150
- height: 44px;
157
+ width: 48px;
158
+ height: 48px;
151
159
  border-width: 4px;
152
160
  }
153
161
 
154
162
  .memori--slider-mark-value {
163
+ margin-top: 4px;
155
164
  font-size: 1.1rem;
156
165
  }
157
166
  }
@@ -159,19 +168,25 @@
159
168
  /* Very tall displays */
160
169
  @media screen and (min-height: 1200px) {
161
170
  .memori--slider-container {
162
- padding: 32px 20px;
171
+ padding: 24px 20px;
172
+ }
173
+
174
+ .memori--slider-header {
175
+ margin-bottom: 24px;
163
176
  }
164
177
 
165
178
  .memori--slider-label {
166
- font-size: 1.6rem;
179
+ font-size: 1.4rem;
167
180
  }
168
181
 
169
182
  .memori--slider-track-container {
170
- height: 80px;
183
+ height: 96px;
184
+ margin-top: 12px;
171
185
  }
172
186
 
173
187
  .memori--slider-thumb {
174
- width: 48px;
175
- height: 48px;
188
+ width: 56px;
189
+ height: 56px;
190
+ border-width: 5px;
176
191
  }
177
192
  }
@@ -59,7 +59,7 @@ const CONSTANTS = {
59
59
  // Slightly longer to ensure smoother transitions
60
60
  // Average syllable duration in natural speech is ~0.2s
61
61
  // We want shorter duration for more precise lip movements
62
- DEFAULT_VISEME_DURATION: 0.1, // 100ms per viseme
62
+ DEFAULT_VISEME_DURATION: 0.12, // 120ms per viseme
63
63
 
64
64
  // Overlap between consecutive visemes
65
65
  // Increased for smoother blending between mouth shapes
@@ -80,7 +80,7 @@ const CONSTANTS = {
80
80
  // Time to preload/buffer visemes (in seconds)
81
81
  // Reduced from 1s to 0.5s as we don't need such a large buffer
82
82
  // Half a second is enough to prepare upcoming visemes
83
- PRELOAD: 0.5,
83
+ PRELOAD: 0.2,
84
84
 
85
85
  // Weight multiplication factor for emphasis
86
86
  // Can be adjusted to make lip movements more or less pronounced
package/src/index.tsx CHANGED
@@ -61,7 +61,6 @@ export interface Props {
61
61
  enableAudio?: boolean;
62
62
  defaultSpeakerActive?: boolean;
63
63
  disableTextEnteredEvents?: boolean;
64
- AZURE_COGNITIVE_SERVICES_TTS_KEY?: string;
65
64
  onStateChange?: (state?: DialogState) => void;
66
65
  additionalInfo?: WidgetProps['additionalInfo'];
67
66
  customMediaRenderer?: WidgetProps['customMediaRenderer'];
@@ -134,7 +133,6 @@ const Memori: React.FC<Props> = ({
134
133
  spokenLang,
135
134
  multilingual,
136
135
  authToken,
137
- AZURE_COGNITIVE_SERVICES_TTS_KEY,
138
136
  enableAudio,
139
137
  defaultSpeakerActive = true,
140
138
  disableTextEnteredEvents = false,
@@ -149,9 +147,7 @@ const Memori: React.FC<Props> = ({
149
147
  }) => {
150
148
  const [memori, setMemori] = useState<IMemori>();
151
149
  const [tenant, setTenant] = useState<Tenant>();
152
- const [speechKey, setSpeechKey] = useState<string | undefined>(
153
- AZURE_COGNITIVE_SERVICES_TTS_KEY
154
- );
150
+ const [speechKey, setSpeechKey] = useState<string | undefined>();
155
151
  const { t } = useTranslation();
156
152
 
157
153
  if (!((memoriID && ownerUserID) || (memoriName && ownerUserName))) {
@@ -166,18 +162,22 @@ const Memori: React.FC<Props> = ({
166
162
  const url =
167
163
  baseURL ||
168
164
  (tenantID.startsWith('https://') ? tenantID : `https://${tenantID}`);
169
- const result = await fetch(`${url}/api/speechkey`);
170
- const data = await result.json();
165
+ try {
166
+ const result = await fetch(`${url}/api/speechkey`);
167
+ const data = await result.json();
171
168
 
172
- if (data.AZURE_COGNITIVE_SERVICES_TTS_KEY) {
173
- setSpeechKey(data.AZURE_COGNITIVE_SERVICES_TTS_KEY);
169
+ if (data.AZURE_COGNITIVE_SERVICES_TTS_KEY) {
170
+ setSpeechKey(data.AZURE_COGNITIVE_SERVICES_TTS_KEY);
171
+ } else {
172
+ console.log('AZURE_COGNITIVE_SERVICES_TTS_KEY not found');
173
+ }
174
+ } catch (error) {
175
+ console.error('Error fetching speech key', error);
174
176
  }
175
177
  }, []);
176
178
  useEffect(() => {
177
- if (!AZURE_COGNITIVE_SERVICES_TTS_KEY) {
178
- fetchSpeechKey();
179
- }
180
- }, [AZURE_COGNITIVE_SERVICES_TTS_KEY]);
179
+ fetchSpeechKey();
180
+ }, []);
181
181
 
182
182
  /**
183
183
  * Fetches the Memori data from the backend
@@ -302,11 +302,9 @@ const Memori: React.FC<Props> = ({
302
302
  initialContextVars={initialContextVars}
303
303
  initialQuestion={initialQuestionLayout}
304
304
  authToken={authToken}
305
- AZURE_COGNITIVE_SERVICES_TTS_KEY={
306
- speechKey || AZURE_COGNITIVE_SERVICES_TTS_KEY
307
- }
305
+ AZURE_COGNITIVE_SERVICES_TTS_KEY={speechKey}
308
306
  autoStart={autoStart}
309
- enableAudio={enableAudio}
307
+ enableAudio={enableAudio && !!speechKey}
310
308
  defaultSpeakerActive={defaultSpeakerActive}
311
309
  disableTextEnteredEvents={disableTextEnteredEvents}
312
310
  onStateChange={onStateChange}
@@ -400,7 +398,6 @@ Memori.propTypes = {
400
398
  enableAudio: PropTypes.bool,
401
399
  defaultSpeakerActive: PropTypes.bool,
402
400
  disableTextEnteredEvents: PropTypes.bool,
403
- AZURE_COGNITIVE_SERVICES_TTS_KEY: PropTypes.string,
404
401
  onStateChange: PropTypes.func,
405
402
  additionalInfo: PropTypes.objectOf(PropTypes.any),
406
403
  customMediaRenderer: PropTypes.func,
@@ -118,6 +118,7 @@
118
118
  "conversationStartedLabel": "Das Gespräch begann am",
119
119
  "settingsHeaderLabel": "Richten Sie hier ein, wenn Sie die Agent als Dauerrede einstellen möchten, und ändern Sie die Stillesekunden, wenn Sie sie anpassen möchten.",
120
120
  "continuousSpeechLabel": "Kontinuierliche Rede",
121
+ "continuousSpeechDisabled": "Kontinuierliche Rede deaktiviert, da der Agent im Stummschaltmodus ist",
121
122
  "holdToSpeak": "Halten Sie gedrückt, um zu sprechen",
122
123
  "releaseToEndListening": "Lassen Sie los, um das Hören zu beenden",
123
124
  "pressAndHoldToSpeak": "Zum Sprechen gedrückt halten",
@@ -119,6 +119,7 @@
119
119
  "conversationStartedLabel": "Conversation started on",
120
120
  "settingsHeaderLabel": "Setup here if you want to set the continuous speech, and change the silence seconds if you want to customize them.",
121
121
  "continuousSpeechLabel": "Continuous speech",
122
+ "continuousSpeechDisabled": "Continuous speech disabled because the agent is in mute mode",
122
123
  "holdToSpeak": "Hold to speak",
123
124
  "releaseToEndListening": "Release to end listening",
124
125
  "pressAndHoldToSpeak": "Press and hold to speak",
@@ -118,6 +118,7 @@
118
118
  "conversationStartedLabel": "La conversación comenzó el",
119
119
  "settingsHeaderLabel": "Configure aquí si desea configurar la memoria como voz continua y cambie los segundos de silencio si desea personalizarlos.",
120
120
  "continuousSpeechLabel": "discurso continuo",
121
+ "continuousSpeechDisabled": "Discurso continuo deshabilitado porque el agente está en modo silencioso",
121
122
  "holdToSpeak": "Mantenga para hablar",
122
123
  "releaseToEndListening": "Suelte para finalizar la escucha",
123
124
  "pressAndHoldToSpeak": "Mantenga presionado para hablar",
@@ -118,6 +118,7 @@
118
118
  "conversationStartedLabel": "La conversation a commencé le",
119
119
  "settingsHeaderLabel": "Configurez ici si vous souhaitez définir la mémoire comme parole continue et modifiez les secondes de silence si vous souhaitez les personnaliser.",
120
120
  "continuousSpeechLabel": "Discours continu",
121
+ "continuousSpeechDisabled": "Discours continu désactivé car l'agente est en mode muté",
121
122
  "holdToSpeak": "Attends pour parler",
122
123
  "releaseToEndListening": "Relâcher pour terminer l'écoute",
123
124
  "pressAndHoldToSpeak": "Appuyez et maintenez pour parler",
@@ -119,6 +119,7 @@
119
119
  "conversationStartedLabel": "Conversazione avvenuta il",
120
120
  "settingsHeaderLabel": "Configura qui se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell'invio.",
121
121
  "continuousSpeechLabel": "Conversazione continua",
122
+ "continuousSpeechDisabled": "Conversazione continua disabilitata poichè l'agente è in modalità muta",
122
123
  "holdToSpeak": "Tieni premuto per parlare",
123
124
  "releaseToEndListening": "Rilascia per smettere di parlare",
124
125
  "pressAndHoldToSpeak": "Premi e tieni premuto per parlare",