@memori.ai/memori-react 6.7.2 → 6.8.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/dist/I18nWrapper.js +21 -3
  4. package/dist/I18nWrapper.js.map +1 -1
  5. package/dist/components/ChatBubble/ChatBubble.js +17 -12
  6. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  7. package/dist/components/MemoriWidget/MemoriWidget.js +19 -6
  8. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  9. package/dist/helpers/constants.js +3 -0
  10. package/dist/helpers/constants.js.map +1 -1
  11. package/dist/helpers/utils.d.ts +2 -0
  12. package/dist/helpers/utils.js +28 -1
  13. package/dist/helpers/utils.js.map +1 -1
  14. package/dist/index.js +51 -29
  15. package/dist/index.js.map +1 -1
  16. package/dist/styles.css +2 -2
  17. package/esm/I18nWrapper.js +21 -3
  18. package/esm/I18nWrapper.js.map +1 -1
  19. package/esm/components/ChatBubble/ChatBubble.js +17 -12
  20. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  21. package/esm/components/MemoriWidget/MemoriWidget.js +20 -7
  22. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  23. package/esm/helpers/constants.js +3 -0
  24. package/esm/helpers/constants.js.map +1 -1
  25. package/esm/helpers/utils.d.ts +2 -0
  26. package/esm/helpers/utils.js +25 -0
  27. package/esm/helpers/utils.js.map +1 -1
  28. package/esm/index.js +51 -29
  29. package/esm/index.js.map +1 -1
  30. package/esm/styles.css +2 -2
  31. package/package.json +1 -1
  32. package/src/I18nWrapper.tsx +21 -3
  33. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +110 -99
  34. package/src/components/ChatBubble/ChatBubble.stories.tsx +39 -0
  35. package/src/components/ChatBubble/ChatBubble.tsx +32 -20
  36. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +33 -33
  37. package/src/components/MemoriWidget/MemoriWidget.tsx +27 -7
  38. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +18 -0
  39. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +18 -0
  40. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +18 -0
  41. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +18 -0
  42. package/src/helpers/constants.ts +3 -0
  43. package/src/helpers/utils.test.ts +78 -1
  44. package/src/helpers/utils.ts +40 -0
  45. package/src/index.tsx +53 -37
  46. package/src/styles.css +2 -2
package/src/index.tsx CHANGED
@@ -207,6 +207,59 @@ const Memori: React.FC<Props> = ({
207
207
  }
208
208
  }, [uiLang]);
209
209
 
210
+ useEffect(() => {
211
+ // @ts-ignore
212
+ window.MathJax = {
213
+ startup: {
214
+ elements: ['.memori-chat--bubble-content'],
215
+ },
216
+ options: {
217
+ processHtmlClass: 'memori-chat--bubble-content',
218
+ },
219
+ tex: {
220
+ inlineMath: [
221
+ ['$', '$'],
222
+ ['\\$', '\\$'],
223
+ ['(', '\\)'],
224
+ ['\\(', ')'],
225
+ ['(', ')'],
226
+ ['[', '\\]'],
227
+ ['[', ']'],
228
+ ['\\(', '\\)'],
229
+ ['\\[', '\\]'],
230
+ ['\\\\[', '\\\\]'],
231
+ ['\\\\\\[', '\\\\\\]'],
232
+ ['((', '))'],
233
+ ],
234
+ displayMath: [
235
+ ['$$', '$$'],
236
+ ['\\[[', '\\]]'],
237
+ ['\\\\[[', '\\\\]]'],
238
+ ['\\\\\\[[', '\\\\\\]]'],
239
+ ],
240
+ processEscapes: false,
241
+ },
242
+ asciimath: {
243
+ fixphi: true,
244
+ displaystyle: true,
245
+ decimalsign: '.',
246
+ },
247
+ skipStartupTypeset: true,
248
+ chtml: {
249
+ displayAlign: 'left',
250
+ },
251
+ svg: {
252
+ fontCache: 'global',
253
+ },
254
+ };
255
+
256
+ const script = document.createElement('script');
257
+ script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
258
+ script.async = true;
259
+ script.id = 'mathjax-script';
260
+ document.head.appendChild(script);
261
+ }, []);
262
+
210
263
  const renderer = memori ? (
211
264
  <MemoriWidget
212
265
  layout={layout}
@@ -282,43 +335,6 @@ const Memori: React.FC<Props> = ({
282
335
  <I18nextProvider i18n={i18n}>
283
336
  <Toaster position="top-center" reverseOrder={true} />
284
337
  {renderer}
285
-
286
- <script
287
- dangerouslySetInnerHTML={{
288
- __html: `
289
- MathJax = {
290
- startup: {
291
- elements: ['.memori-chat--bubble-content'],
292
- },
293
- options: {
294
- processHtmlClass: 'memori-chat--bubble-content',
295
- },
296
- tex: {
297
- inlineMath: [['$', '$'], ['\\$', '\\$'], ['(',')'], ['\(','\)'], ['\[', '\]'], ['[', ']'], ['\\(', '\\)'], ['\\[', '\\]'], ['((','))']],
298
- displayMath: [['$$', '$$'], ['\\[[', '\\]]']],
299
- processEscapes: true,
300
- },
301
- asciimath: {
302
- fixphi: true,
303
- displaystyle: true,
304
- decimalsign: '.'
305
- },
306
- skipStartupTypeset: true,
307
- chtml: {
308
- displayAlign: 'left',
309
- },
310
- svg: {
311
- fontCache: 'global'
312
- }
313
- };
314
- `,
315
- }}
316
- />
317
- <script
318
- id="MathJax-script"
319
- async
320
- src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
321
- ></script>
322
338
  </I18nextProvider>
323
339
  );
324
340
  };
package/src/styles.css CHANGED
@@ -52,7 +52,7 @@
52
52
  @import url('./components/layouts/website-assistant.css');
53
53
  @import url('./components/layouts/chat.css');
54
54
 
55
- @import url('../node_modules/katex/dist/katex.min.css');
55
+ @import url('https://cdn.jsdelivr.net/npm/katex@0.16.10/dist/katex.min.css');
56
56
 
57
57
  .sr-only {
58
58
  position: absolute;
@@ -106,4 +106,4 @@ body.sb-show-main #root,
106
106
  .mobile-hidden {
107
107
  display: none;
108
108
  }
109
- }
109
+ }