260810_04_ENH: 컨택 화면 ui 변경 및 개별 발송시 미리보기에 치환 문자열 치환 돼서 보여지도록 수정

This commit is contained in:
2026-08-10 11:57:44 +09:00
parent ef748142f8
commit 9b93d45ed0
7 changed files with 64 additions and 30 deletions

View File

@@ -0,0 +1,17 @@
// 문자열에 들어있는 [$SID], [$헤더명] 치환 토큰을 values에 있는 값으로 바꾼다.
// 값이 없는 토큰은 빈 문자열로 치환한다.
export const substituteVariables = (contents: string, values: Record<string, string>) =>
contents.replace(/\[\$([^\]]+)\]/g, (_, key: string) => values[key] ?? "");
export const escapeHtml = (value: string) =>
value.replace(
/[&<>"']/g,
(character) =>
({
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
})[character] ?? character,
);