@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.
- package/CHANGELOG.md +26 -0
- package/dist/components/ChatBubble/ChatBubble.js +31 -31
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +16 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +242 -226
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.js +6 -1
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/helpers/utils.js +5 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/helpers/utils.test.js +12 -0
- package/dist/helpers/utils.test.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +31 -31
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +16 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +243 -227
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.js +6 -1
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/helpers/utils.d.ts +1 -0
- package/esm/helpers/utils.js +3 -0
- package/esm/helpers/utils.js.map +1 -1
- package/esm/helpers/utils.test.js +13 -1
- package/esm/helpers/utils.test.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChatBubble/ChatBubble.tsx +1 -1
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +0 -3
- package/src/components/MemoriWidget/MemoriWidget.tsx +353 -292
- package/src/components/StartPanel/StartPanel.tsx +8 -3
- package/src/helpers/utils.test.ts +15 -1
- 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
|
-
|
|
241
|
-
|
|
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
|
+
});
|
package/src/helpers/utils.ts
CHANGED
|
@@ -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
|