@memori.ai/memori-react 8.45.5 → 8.45.6

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 (49) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/MemoriWidget/MemoriWidget.js +34 -3
  3. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  4. package/dist/helpers/speech/speechRequest.d.ts +15 -0
  5. package/dist/helpers/speech/speechRequest.js +76 -0
  6. package/dist/helpers/speech/speechRequest.js.map +1 -0
  7. package/dist/helpers/stt/useSTT.d.ts +4 -0
  8. package/dist/helpers/stt/useSTT.js +20 -13
  9. package/dist/helpers/stt/useSTT.js.map +1 -1
  10. package/dist/helpers/tts/useTTS.d.ts +5 -0
  11. package/dist/helpers/tts/useTTS.js +12 -4
  12. package/dist/helpers/tts/useTTS.js.map +1 -1
  13. package/dist/locales/de.json +4 -0
  14. package/dist/locales/en.json +4 -0
  15. package/dist/locales/es.json +4 -0
  16. package/dist/locales/fr.json +4 -0
  17. package/dist/locales/it.json +4 -0
  18. package/dist/version.d.ts +1 -1
  19. package/dist/version.js +1 -1
  20. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +78 -0
  21. package/esm/components/DrawerFooter/DrawerFooter.css +62 -0
  22. package/esm/components/IconButton/IconButton.css +135 -0
  23. package/esm/components/LoginModal/LoginModal.css +270 -0
  24. package/esm/components/MemoriWidget/MemoriWidget.js +34 -3
  25. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  26. package/esm/components/MobileSessionPanel/MobileSessionPanel.css +540 -0
  27. package/esm/components/PositionPopover/PositionPopover.css +218 -0
  28. package/esm/components/ReasoningBlock/ReasoningBlock.css +156 -0
  29. package/esm/components/SideDrawer/SideDrawer.css +112 -0
  30. package/esm/components/layouts/WebsiteAssistant/website-assistant.css +889 -0
  31. package/esm/components/layouts/fullpage.css +628 -0
  32. package/esm/helpers/speech/speechRequest.d.ts +15 -0
  33. package/esm/helpers/speech/speechRequest.js +68 -0
  34. package/esm/helpers/speech/speechRequest.js.map +1 -0
  35. package/esm/helpers/stt/useSTT.d.ts +4 -0
  36. package/esm/helpers/stt/useSTT.js +20 -13
  37. package/esm/helpers/stt/useSTT.js.map +1 -1
  38. package/esm/helpers/tts/useTTS.d.ts +5 -0
  39. package/esm/helpers/tts/useTTS.js +12 -4
  40. package/esm/helpers/tts/useTTS.js.map +1 -1
  41. package/esm/locales/de.json +4 -0
  42. package/esm/locales/en.json +4 -0
  43. package/esm/locales/es.json +4 -0
  44. package/esm/locales/fr.json +4 -0
  45. package/esm/locales/it.json +4 -0
  46. package/esm/styles/motion.css +25 -0
  47. package/esm/version.d.ts +1 -1
  48. package/esm/version.js +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,270 @@
1
+ /* Login gate modal — content-sized, radii: control 12 / box 20 / modal 28 */
2
+
3
+ .memori--login-modal.memori-modal,
4
+ .memori--login-modal {
5
+ --memori-login-modal-radius: var(--memori-radius-overlay, 1.75rem);
6
+ --memori-login-control-radius: var(--memori-radius-control, 0.75rem);
7
+ --memori-login-box-radius: var(--memori-radius-surface, 1.25rem);
8
+ }
9
+
10
+ .memori--login-modal--content,
11
+ .memori--login-modal .memori-modal__popup {
12
+ max-width: min(420px, calc(100vw - 2rem));
13
+ padding: 1.5rem 1.5rem 1.25rem;
14
+ border-radius: var(--memori-login-modal-radius) !important;
15
+ }
16
+
17
+ .memori--login-modal .memori-modal__content {
18
+ overflow: visible;
19
+ }
20
+
21
+ .memori--login-modal--missing.memori--login-modal .memori-modal__popup {
22
+ display: flex;
23
+ max-width: min(480px, calc(100vw - 2rem));
24
+ max-height: min(90vh, 40rem);
25
+ flex-direction: column;
26
+ }
27
+
28
+ .memori--login-modal--missing .memori-modal__content {
29
+ display: flex;
30
+ overflow: hidden;
31
+ min-height: 0;
32
+ max-height: none;
33
+ flex: 1 1 auto;
34
+ flex-direction: column;
35
+ }
36
+
37
+ .memori--login-modal--title,
38
+ .memori--login-modal .memori-modal__title {
39
+ margin: 0;
40
+ color: var(--memori-text-color, #1a1a2e);
41
+ font-size: 1.625rem;
42
+ font-weight: var(--memori-text-weight-bold, 700);
43
+ line-height: 1.25;
44
+ text-align: left;
45
+ }
46
+
47
+ .memori--login-modal--step {
48
+ display: flex;
49
+ flex-direction: column;
50
+ margin-top: 0.25rem;
51
+ gap: 1rem;
52
+ }
53
+
54
+ .memori--login-modal--benefit,
55
+ .memori--login-modal--sent-copy,
56
+ .memori--login-modal--footnote,
57
+ .memori--login-modal--resend {
58
+ margin: 0;
59
+ color: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 35%);
60
+ font-size: 0.9375rem;
61
+ line-height: 1.45;
62
+ }
63
+
64
+ .memori--login-modal--footnote,
65
+ .memori--login-modal--resend {
66
+ font-size: 0.8125rem;
67
+ text-align: center;
68
+ }
69
+
70
+ .memori--login-modal--email-row {
71
+ margin: -0.35rem 0 0;
72
+ color: var(--memori-text-color, #1a1a2e);
73
+ font-size: 0.9375rem;
74
+ line-height: 1.4;
75
+ }
76
+
77
+ .memori--login-modal--email-value {
78
+ font-weight: var(--memori-text-weight-bold, 700);
79
+ overflow-wrap: anywhere;
80
+ }
81
+
82
+ .memori--login-modal--edit-link {
83
+ padding: 0;
84
+ border: none;
85
+ margin: 0;
86
+ background: none;
87
+ color: var(--memori-primary, #6b2d5c);
88
+ cursor: pointer;
89
+ font: inherit;
90
+ font-weight: var(--memori-text-weight-semibold, 600);
91
+ text-decoration: underline;
92
+ text-underline-offset: 2px;
93
+ }
94
+
95
+ .memori--login-modal--edit-link:disabled {
96
+ cursor: not-allowed;
97
+ opacity: 0.55;
98
+ }
99
+
100
+ .memori--login-modal .memori-field.memori--login-modal--field {
101
+ display: flex;
102
+ width: calc(100% - 0.75rem);
103
+ max-width: calc(100% - 0.75rem);
104
+ box-sizing: border-box;
105
+ flex-direction: column;
106
+ margin-right: auto;
107
+ margin-left: auto;
108
+ gap: 0.375rem;
109
+ }
110
+
111
+ .memori--login-modal--email-input,
112
+ .memori--login-modal--form input {
113
+ width: 100%;
114
+ box-sizing: border-box;
115
+ border-radius: var(--memori-login-control-radius) !important;
116
+ }
117
+
118
+ .memori--login-modal--email-input.error,
119
+ .memori--login-modal--otp-digit.error {
120
+ border-color: var(--memori-error, #ef4444) !important;
121
+ }
122
+
123
+ .memori--login-modal .memori-button.memori--login-modal--primary {
124
+ width: calc(100% - 0.75rem);
125
+ max-width: calc(100% - 0.75rem);
126
+ min-height: 2.75rem;
127
+ box-sizing: border-box;
128
+ border-radius: var(--memori-login-control-radius) !important;
129
+ margin-right: auto;
130
+ margin-left: auto;
131
+ }
132
+
133
+ .memori--login-modal--otp-fieldset {
134
+ display: flex;
135
+ flex-direction: column;
136
+ padding: 0;
137
+ border: none;
138
+ margin: 0;
139
+ gap: 0.5rem;
140
+ }
141
+
142
+ .memori--login-modal--otp-label {
143
+ padding: 0;
144
+ color: var(--memori-text-color, #1a1a2e);
145
+ font-size: 0.875rem;
146
+ font-weight: var(--memori-text-weight-semibold, 600);
147
+ }
148
+
149
+ .memori--login-modal--otp-digits {
150
+ display: grid;
151
+ width: 100%;
152
+ max-width: 16rem;
153
+ gap: 0.625rem;
154
+ grid-template-columns: repeat(4, minmax(0, 1fr));
155
+ }
156
+
157
+ .memori--login-modal--otp-digit {
158
+ width: 100%;
159
+ height: 3.25rem;
160
+ border-radius: var(--memori-login-box-radius) !important;
161
+ font-size: 1.375rem;
162
+ font-weight: var(--memori-text-weight-bold, 700);
163
+ text-align: center;
164
+ }
165
+
166
+ .memori--login-modal--otp-digit.active,
167
+ .memori--login-modal--otp-digit:focus {
168
+ border-color: var(--memori-primary, #6b2d5c) !important;
169
+ box-shadow: 0 0 0 3px color-mix(in oklch, var(--memori-primary, #6b2d5c), transparent 84%);
170
+ outline: none;
171
+ }
172
+
173
+ .memori--login-modal--inline-error {
174
+ margin: 0;
175
+ color: var(--memori-error, #b91c1c);
176
+ font-size: 0.875rem;
177
+ line-height: 1.35;
178
+ }
179
+
180
+ .memori--login-modal--missing-data {
181
+ display: flex;
182
+ min-height: 0;
183
+ flex: 1 1 auto;
184
+ flex-direction: column;
185
+ gap: 0.75rem;
186
+ }
187
+
188
+ .memori--login-modal--missing-helper {
189
+ margin: 0;
190
+ color: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 30%);
191
+ font-size: 0.9375rem;
192
+ line-height: 1.45;
193
+ }
194
+
195
+ form.memori--login-modal--form {
196
+ display: flex;
197
+ flex-direction: column;
198
+ gap: 0.75rem;
199
+ }
200
+
201
+ form.memori--login-modal--form--missing {
202
+ min-height: 0;
203
+ flex: 1 1 auto;
204
+ gap: 0;
205
+ }
206
+
207
+ .memori--login-modal--form-body {
208
+ display: flex;
209
+ min-height: 0;
210
+ flex: 1 1 auto;
211
+ flex-direction: column;
212
+ padding: 0.25rem 0.375rem 0.75rem;
213
+ gap: 0.875rem;
214
+ -webkit-overflow-scrolling: touch;
215
+ overflow-x: hidden;
216
+ overflow-y: auto;
217
+ }
218
+
219
+ .memori--login-modal--form-footer {
220
+ flex-shrink: 0;
221
+ padding: 0.75rem 0.375rem 0.125rem;
222
+ }
223
+
224
+ .memori--login-modal--consent-block {
225
+ display: flex;
226
+ flex-direction: column;
227
+ gap: 0.75rem;
228
+ }
229
+
230
+ .memori-login-modal--consent {
231
+ width: 100%;
232
+ margin: 0;
233
+ }
234
+
235
+ .memori--login-modal--consent-note {
236
+ margin: 0;
237
+ color: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 35%);
238
+ font-size: 0.8125rem;
239
+ line-height: 1.45;
240
+ }
241
+
242
+ .memori--login-modal--deep-thought {
243
+ padding: 0.625rem 0.75rem;
244
+ border-radius: var(--memori-login-box-radius);
245
+ background: color-mix(in oklch, var(--memori-text-color, #1a1a2e), transparent 96%);
246
+ }
247
+
248
+ @media (max-width: 480px) {
249
+ .memori--login-modal--content,
250
+ .memori--login-modal .memori-modal__popup {
251
+ padding: 1.25rem 1rem 1rem;
252
+ }
253
+
254
+ .memori--login-modal--title,
255
+ .memori--login-modal .memori-modal__title {
256
+ font-size: 1.5rem;
257
+ }
258
+
259
+ .memori--login-modal--otp-digits {
260
+ max-width: 100%;
261
+ }
262
+ }
263
+
264
+ @media (prefers-reduced-motion: reduce) {
265
+ .memori--login-modal * {
266
+ animation-duration: 0.01ms !important;
267
+ animation-iteration-count: 1 !important;
268
+ transition-duration: 0.01ms !important;
269
+ }
270
+ }
@@ -36,6 +36,7 @@ import { getErrori18nKey } from '../../helpers/error';
36
36
  import { getCredits } from '../../helpers/credits';
37
37
  import { sanitizeText } from '../../helpers/sanitizer';
38
38
  import { useTTS } from '../../helpers/tts/useTTS';
39
+ import { SpeechRequestError, speechErrorI18nKey, } from '../../helpers/speech/speechRequest';
39
40
  import ChatHistoryDrawer from '../ChatHistoryDrawer/ChatHistory';
40
41
  import { useSTT } from '../../helpers/stt/useSTT';
41
42
  import { useNats } from '../../helpers/nats/useNats';
@@ -716,7 +717,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
716
717
  }
717
718
  return voice;
718
719
  };
719
- const [sessionId, setSessionId] = useState(initialSessionID);
720
+ const [sessionId, setSessionIdState] = useState(initialSessionID);
721
+ const sessionIdRef = useRef(initialSessionID);
722
+ const setSessionId = (id) => {
723
+ sessionIdRef.current = id;
724
+ setSessionIdState(id);
725
+ };
720
726
  const [currentDialogState, _setCurrentDialogState] = useState();
721
727
  const setCurrentDialogState = (state) => {
722
728
  var _a, _b;
@@ -1121,20 +1127,44 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1121
1127
  provider: ttsProvider,
1122
1128
  voice: getTTSVoice(userLang || ((_b = (_a = memori.culture) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) || 'EN', ttsProvider, memori.voiceType),
1123
1129
  tenant: tenantID,
1130
+ sessionId,
1131
+ sessionIdRef,
1124
1132
  region: 'westeurope',
1125
1133
  voiceType: memori.voiceType,
1126
1134
  layout: selectedLayout,
1127
1135
  });
1128
- }, [ttsProvider, userLang, memori.culture, memori.voiceType, selectedLayout]);
1136
+ }, [
1137
+ ttsProvider,
1138
+ userLang,
1139
+ memori.culture,
1140
+ memori.voiceType,
1141
+ selectedLayout,
1142
+ tenantID,
1143
+ sessionId,
1144
+ sessionIdRef,
1145
+ ]);
1129
1146
  const sttConfig = useMemo(() => ({
1130
1147
  provider: ttsProvider,
1131
1148
  language: getCultureCodeByLanguage(userLang),
1132
1149
  tenant: tenantID,
1133
- }), [ttsProvider, userLang]);
1150
+ sessionId,
1151
+ sessionIdRef,
1152
+ }), [ttsProvider, userLang, tenantID, sessionId, sessionIdRef]);
1153
+ const reportSpeechError = useCallback((error) => {
1154
+ const key = speechErrorI18nKey(error);
1155
+ const message = key ? String(t(key)) : error.message;
1156
+ if (error instanceof SpeechRequestError &&
1157
+ error.code === 'rate_limited') {
1158
+ toast(message);
1159
+ return;
1160
+ }
1161
+ toast.error(message);
1162
+ }, [t]);
1134
1163
  const { speak: ttsSpeak, stop: ttsStop, isPlaying: isPlayingAudio, speakerMuted, toggleMute, hasUserActivatedSpeak, setHasUserActivatedSpeak, } = useTTS(ttsConfig, {
1135
1164
  apiUrl: `${baseUrl}/api/tts`,
1136
1165
  continuousSpeech: continuousSpeech,
1137
1166
  preview: preview,
1167
+ onError: reportSpeechError,
1138
1168
  }, autoStart, defaultEnableAudio, (_w = defaultSpeakerActive !== null && defaultSpeakerActive !== void 0 ? defaultSpeakerActive : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.defaultSpeakerActive) !== null && _w !== void 0 ? _w : true);
1139
1169
  const shouldPlayAudio = (text) => {
1140
1170
  const currentSpeakerMuted = getLocalConfig('muteSpeaker', !defaultEnableAudio);
@@ -1160,6 +1190,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1160
1190
  };
1161
1191
  const { isListening, startRecording, stopRecording, } = useSTT(sttConfig, processSpeechAndSendMessage, {
1162
1192
  apiUrl: `${baseUrl}/api/stt`,
1193
+ onError: reportSpeechError,
1163
1194
  }, defaultEnableAudio);
1164
1195
  const handleSpeak = async (text) => {
1165
1196
  if (!shouldPlayAudio(text)) {