261008_01_ENH: 알림톡 템플릿 관련내용 구현 및 발송 구현
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { LIST_IS_USE_LABEL } from '@/components/table-column/ListTableColumn'
|
||||
import { ListHeaderConst } from '@/const/listConst'
|
||||
import type { listHeader, ListSearchWithFullResult } from '@/types/list'
|
||||
import type { ProjectSurvey } from '@/types/project'
|
||||
import { isAssignHeaderType } from '@/utils/listAccess'
|
||||
import { substituteVariables } from '@/lib/variableSubstitution'
|
||||
|
||||
export const resolveListHeaderValue = (
|
||||
header: listHeader,
|
||||
@@ -34,3 +36,21 @@ export const buildListContactVariableValues = (
|
||||
values.SID = sid
|
||||
return values
|
||||
}
|
||||
|
||||
// 알림톡 변수 값: 헤더 값에 더해 설문명(#{설문명})을 대상자 값으로 채운 설문 URL로 치환한다.
|
||||
// 같은 이름의 헤더가 있으면 헤더 값을 우선한다.
|
||||
export const buildKkoVariableValues = (
|
||||
headerValues: Record<string, string>,
|
||||
surveys: ProjectSurvey[],
|
||||
): Record<string, string> => {
|
||||
const values: Record<string, string> = { ...headerValues }
|
||||
|
||||
for (const survey of surveys) {
|
||||
const surveyName = survey.surveyName?.trim()
|
||||
const surveyUrl = survey.surveyUrl?.trim()
|
||||
if (!surveyName || !surveyUrl || surveyName in values) continue
|
||||
values[surveyName] = substituteVariables(surveyUrl, headerValues)
|
||||
}
|
||||
|
||||
return values
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user