@memori.ai/memori-react 2.9.2 → 2.10.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 (32) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/ChatBubble/ChatBubble.js +31 -31
  3. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  4. package/dist/components/MemoriWidget/MemoriWidget.d.ts +16 -1
  5. package/dist/components/MemoriWidget/MemoriWidget.js +242 -226
  6. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  7. package/dist/components/StartPanel/StartPanel.js +6 -1
  8. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  9. package/dist/helpers/utils.d.ts +1 -0
  10. package/dist/helpers/utils.js +5 -1
  11. package/dist/helpers/utils.js.map +1 -1
  12. package/dist/helpers/utils.test.js +12 -0
  13. package/dist/helpers/utils.test.js.map +1 -1
  14. package/esm/components/ChatBubble/ChatBubble.js +31 -31
  15. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  16. package/esm/components/MemoriWidget/MemoriWidget.d.ts +16 -1
  17. package/esm/components/MemoriWidget/MemoriWidget.js +243 -227
  18. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  19. package/esm/components/StartPanel/StartPanel.js +6 -1
  20. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  21. package/esm/helpers/utils.d.ts +1 -0
  22. package/esm/helpers/utils.js +3 -0
  23. package/esm/helpers/utils.js.map +1 -1
  24. package/esm/helpers/utils.test.js +13 -1
  25. package/esm/helpers/utils.test.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/components/ChatBubble/ChatBubble.tsx +1 -1
  28. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +0 -3
  29. package/src/components/MemoriWidget/MemoriWidget.tsx +353 -292
  30. package/src/components/StartPanel/StartPanel.tsx +8 -3
  31. package/src/helpers/utils.test.ts +15 -1
  32. package/src/helpers/utils.ts +4 -0
@@ -237,9 +237,14 @@ const StartPanel: React.FC<Props> = ({
237
237
  disabled={!!memori.blockedUntil && !memori.isGiver}
238
238
  loading={clickedStart}
239
239
  onClick={_e => {
240
- speechSynthesis.speak(
241
- new SpeechSynthesisUtterance('') // This is needed to enable the speech synthesis on iOS
242
- );
240
+ try {
241
+ window.speechSynthesis.speak(
242
+ new SpeechSynthesisUtterance('') // This is needed to enable the speech synthesis on iOS
243
+ );
244
+ } catch (e) {
245
+ console.error(e);
246
+ }
247
+
243
248
  if (initializeTTS) initializeTTS();
244
249
  if (onClickStart) onClickStart();
245
250
  }}
@@ -1,4 +1,4 @@
1
- import { difference } from './utils';
1
+ import { difference, stripEmojis } from './utils';
2
2
 
3
3
  describe('Utils/difference', () => {
4
4
  it('should return the difference between two objects with numeric values', () => {
@@ -29,3 +29,17 @@ describe('Utils/difference', () => {
29
29
  expect(result).toEqual({ a: ['alpha', 'beta', 'gamma'] });
30
30
  });
31
31
  });
32
+
33
+ describe('utils/stripEmojis', () => {
34
+ it('should strip emojis from a string', () => {
35
+ const text = 'Hello 👋ðŸŧ';
36
+ const result = stripEmojis(text);
37
+ expect(result).toEqual('Hello');
38
+ });
39
+
40
+ it('should strip emojis from a string with multiple emojis', () => {
41
+ const text = '😊 Hello 😉ðŸĪŠâ™Ĩïļ';
42
+ const result = stripEmojis(text);
43
+ expect(result).toEqual('Hello');
44
+ });
45
+ });
@@ -106,6 +106,10 @@ export const stripDuplicates = (text: string) => {
106
106
  return text;
107
107
  };
108
108
 
109
+ export const stripEmojis = (text: string) => {
110
+ return text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu, '').trim();
111
+ };
112
+
109
113
  export const getFieldFromCustomData = (
110
114
  fieldName: string,
111
115
  data: string | undefined