The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { SUPPORTED_MEETING_PLATFORM_URL_PATTERNS } from 'src/logic-functions/constants/SUPPORTED_MEETING_PLATFORM_URL_PATTERNS';
import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
// Outlook HTML bodies encode ampersands; plain-text links can end mid-sentence.
const cleanExtractedConferenceLinkUrl = (url: string): string =>
url.replace(/&/gi, '&').replace(/[.,;:!?)\]]+$/, '');
export const extractConferenceLinkUrlFromText = (
text: string | null | undefined,
): string | undefined => {
if (!isNonEmptyString(text)) {
return undefined;
}
for (const pattern of SUPPORTED_MEETING_PLATFORM_URL_PATTERNS) {
const match = text.match(pattern);
if (match !== null) {
return cleanExtractedConferenceLinkUrl(match[0]);
}
}
return undefined;
};