@peopl-health/nexus 5.76.7 → 5.76.8
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.
|
@@ -3,6 +3,7 @@ const { escapeRegExp } = require('../../utils/textMatchUtils');
|
|
|
3
3
|
|
|
4
4
|
const MAX_CARRIER_TEXT_LENGTH = 600;
|
|
5
5
|
const MAX_HYDRATED_BODY_LENGTH = 1024;
|
|
6
|
+
const GRAPHEME_SEGMENTER = new Intl.Segmenter('es', { granularity: 'grapheme' });
|
|
6
7
|
const FOLLOW_UP_TYPES = new Set(['seguimiento']);
|
|
7
8
|
const CONTINGENCY_TYPES = new Set(['contingencia']);
|
|
8
9
|
const REMINDER_TYPES = new Set(['cita', 'examen', 'medicamento', 'otros']);
|
|
@@ -50,7 +51,7 @@ function validateAgentText(messageText, firstName) {
|
|
|
50
51
|
throw new Error('OUTREACH_CARRIER_TEXT_REPEATS_NAME');
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
const emojiCount = [...text.
|
|
54
|
+
const emojiCount = [...GRAPHEME_SEGMENTER.segment(text)].filter(({ segment }) => /\p{Extended_Pictographic}/u.test(segment)).length;
|
|
54
55
|
if (emojiCount > 1) throw new Error('OUTREACH_CARRIER_TEXT_TOO_MANY_EMOJI');
|
|
55
56
|
return { text, name };
|
|
56
57
|
}
|