2021-06-29 21:43:18 +00:00
|
|
|
import { VideoCallData } from "../videoClient";
|
2021-06-16 22:56:02 +00:00
|
|
|
|
|
|
|
export function getIntegrationName(videoCallData: VideoCallData): string {
|
|
|
|
//TODO: When there are more complex integration type strings, we should consider using an extra field in the DB for that.
|
|
|
|
const nameProto = videoCallData.type.split("_")[0];
|
|
|
|
return nameProto.charAt(0).toUpperCase() + nameProto.slice(1);
|
|
|
|
}
|
|
|
|
|
2021-06-29 21:43:18 +00:00
|
|
|
function extractZoom(videoCallData: VideoCallData): string {
|
|
|
|
const strId = videoCallData.id.toString();
|
|
|
|
const part1 = strId.slice(0, 3);
|
|
|
|
const part2 = strId.slice(3, 7);
|
|
|
|
const part3 = strId.slice(7, 11);
|
|
|
|
|
|
|
|
return part1 + " " + part2 + " " + part3;
|
|
|
|
}
|
|
|
|
|
2021-06-16 22:56:02 +00:00
|
|
|
export function getFormattedMeetingId(videoCallData: VideoCallData): string {
|
2021-06-29 21:43:18 +00:00
|
|
|
switch (videoCallData.type) {
|
|
|
|
case "zoom_video":
|
|
|
|
return extractZoom(videoCallData);
|
2021-06-16 22:56:02 +00:00
|
|
|
default:
|
|
|
|
return videoCallData.id.toString();
|
|
|
|
}
|
2021-06-29 21:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function stripHtml(html: string): string {
|
2021-07-24 19:23:15 +00:00
|
|
|
const aMailToRegExp = /<a[\s\w="_:#;]*href="mailto:([^<>"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g;
|
2021-07-21 12:25:28 +00:00
|
|
|
const aLinkRegExp = /<a[\s\w="_:#;]*href="([^<>"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g;
|
|
|
|
return html
|
2021-07-21 16:20:08 +00:00
|
|
|
.replace(/<br\s?\/>/g, "\n")
|
2021-07-24 19:23:15 +00:00
|
|
|
.replace(aMailToRegExp, "$1")
|
2021-07-21 12:25:28 +00:00
|
|
|
.replace(aLinkRegExp, "$2: $1")
|
|
|
|
.replace(/<[^>]+>/g, "");
|
2021-06-29 21:43:18 +00:00
|
|
|
}
|