[] = [
@@ -70,9 +70,11 @@ const MessageHistoryDialog = ({
const emailListQuery = useBulkSendListQuery(MessageType.EMAIL, clientEnv.REQUEST_SVC, prjctCd, enabled && tab === 'email')
const smsListQuery = useBulkSendListQuery(MessageType.SMS, clientEnv.REQUEST_SVC, prjctCd, enabled && tab === 'sms')
const lmsListQuery = useBulkSendListQuery(MessageType.LMS_MMS, clientEnv.REQUEST_SVC, prjctCd, enabled && tab === 'sms')
+ const kkoListQuery = useBulkSendListQuery(MessageType.KKO, clientEnv.REQUEST_SVC, prjctCd, enabled && tab === 'kko')
const visibleRows = useMemo(() => {
if (tab === 'email') return emailListQuery.data ?? []
+ if (tab === 'kko') return kkoListQuery.data ?? []
// 문자 길이에 따라 SMS로 발송된 건도 자동으로 LMS/MMS로 전환될 수 있는데, 이 경우 두 목록 API가
// 같은 bulkSendKey를 각각 반환해 합치면 행이 중복된다. bulkSendKey 기준으로 한 번만 남긴다.
@@ -81,7 +83,7 @@ const MessageHistoryDialog = ({
merged.set(row.bulkSendKey, row)
}
return Array.from(merged.values()).sort((a, b) => (b.regDt ?? '').localeCompare(a.regDt ?? ''))
- }, [tab, emailListQuery.data, smsListQuery.data, lmsListQuery.data])
+ }, [tab, emailListQuery.data, smsListQuery.data, lmsListQuery.data, kkoListQuery.data])
const detailQuery = useBulkSendDetailQuery(
selectedKey ?? '',
@@ -141,6 +143,9 @@ const MessageHistoryDialog = ({
+
diff --git a/src/components/dialog/MessageSendDialog.tsx b/src/components/dialog/MessageSendDialog.tsx
index bcbaa98..9617e9d 100644
--- a/src/components/dialog/MessageSendDialog.tsx
+++ b/src/components/dialog/MessageSendDialog.tsx
@@ -15,18 +15,17 @@ import {
useTemplateListQuery,
useTemplateQuery,
} from '@/query/message'
-import { ChannelType } from '@kri/common/noti-hub'
-import { getNearestFutureDateTime } from '@/lib/datetime'
+import { getNearestFutureDateTime, toReserveSendDt } from '@/lib/datetime'
import type { DialogId } from '@/store/jotai/dialog'
import { createEmptyListFilter, type ListFilter, type ListFilterTarget, type listHeader } from '@/types/list'
import { ListHeaderConst } from '@/const/listConst'
import type { ListTableRow } from '@/components/table-column/ListTableColumn'
import ApplyFilterOption, { validateApplyFilterTarget } from './ListDialogOption/ApplyFilterOption'
import MessageSendPreview from '@/components/message-template/MessageSendPreview'
-import type { TemplateSummaryWithPurpose } from '@/types/message'
-import { TEMPLATE_PURPOSE } from '@/const/messageTemplateConst'
+import type { MessageSendChannel, TemplateSummaryWithPurpose } from '@/types/message'
+import { MESSAGE_CHANNEL_TYPE, TEMPLATE_PURPOSE } from '@/const/messageTemplateConst'
-export type MessageSendMode = 'email' | 'sms'
+export type MessageSendMode = MessageSendChannel
export type MessageSendDialogProps = {
dialogId?: DialogId
@@ -43,6 +42,7 @@ export type MessageSendDialogProps = {
const titleMap: Record
= {
email: '메일 발송',
sms: '문자 발송',
+ kko: '알림톡 발송',
}
const MessageSendDialog = ({
@@ -59,7 +59,7 @@ const MessageSendDialog = ({
const { isDialogOpen, showDialog, hideDialog } = useDialog()
const { selectedProject } = useSelectedProject()
- const chnnlTy = mode === 'email' ? ChannelType.EMAIL : ChannelType.SMS
+ const chnnlTy = MESSAGE_CHANNEL_TYPE[mode]
const [templateIdx, setTemplateIdx] = useState(null)
const [scheduleType, setScheduleType] = useState<'instant' | 'reserve'>('instant')
@@ -171,7 +171,7 @@ const MessageSendDialog = ({
alert('선택한 템플릿에 발송자 메일이 등록되어 있지 않습니다. 템플릿 설정을 확인해 주세요.')
return
}
- if (mode === 'sms' && !templateSenderTel) {
+ if (mode !== 'email' && !templateSenderTel) {
alert('선택한 템플릿에 발송 번호가 등록되어 있지 않습니다. 템플릿 설정을 확인해 주세요.')
return
}
@@ -190,7 +190,7 @@ const MessageSendDialog = ({
const res = await sendBulkMessageMutation.mutateAsync({
tmplatIdx: templateIdx,
resve: scheduleType === 'reserve',
- sendDt: scheduleType === 'reserve' ? new Date(reserveAt).toISOString() : undefined,
+ sendDt: scheduleType === 'reserve' ? toReserveSendDt(reserveAt) : undefined,
listFilter,
destHeaderIds: [targetHeaderId],
})
diff --git a/src/components/dialog/SingleMessageSendDialog.tsx b/src/components/dialog/SingleMessageSendDialog.tsx
index 306da7f..49faf45 100644
--- a/src/components/dialog/SingleMessageSendDialog.tsx
+++ b/src/components/dialog/SingleMessageSendDialog.tsx
@@ -14,16 +14,17 @@ import {
useTemplateListQuery,
useTemplateQuery,
} from '@/query/message'
-import { ChannelType, type TemplateSummary } from '@kri/common/noti-hub'
-import { getNearestFutureDateTime } from '@/lib/datetime'
+import type { TemplateSummary } from '@kri/common/noti-hub'
+import { getNearestFutureDateTime, toReserveSendDt } from '@/lib/datetime'
import type { DialogId } from '@/store/jotai/dialog'
import type { MessageSendChannel, PhoneVerificationSendData } from '@/types/message'
import MessageSendPreview from '@/components/message-template/MessageSendPreview'
-import { TEMPLATE_PURPOSE } from '@/const/messageTemplateConst'
+import { TEMPLATE_PURPOSE, MESSAGE_CHANNEL_TYPE } from '@/const/messageTemplateConst'
const titleMap: Record = {
email: '메일 발송',
sms: '문자 발송',
+ kko: '알림톡 발송',
}
export type SingleMessageSendDialogProps = {
@@ -54,7 +55,7 @@ const SingleMessageSendDialog = ({
const { isDialogOpen, showDialog, hideDialog } = useDialog()
const resolvedOpen = open ?? isDialogOpen(dialogId)
- const chnnlTy = channel === 'email' ? ChannelType.EMAIL : ChannelType.SMS
+ const chnnlTy = MESSAGE_CHANNEL_TYPE[channel]
const [templateIdx, setTemplateIdx] = useState(null)
const [scheduleType, setScheduleType] = useState<'instant' | 'reserve'>('instant')
@@ -132,7 +133,7 @@ const SingleMessageSendDialog = ({
const res = await sendSingleMutation.mutateAsync({
tmplatIdx: templateIdx,
resve: scheduleType === 'reserve',
- sendDt: scheduleType === 'reserve' ? new Date(reserveAt).toISOString() : undefined,
+ sendDt: scheduleType === 'reserve' ? toReserveSendDt(reserveAt) : undefined,
sid,
destHeaderIds: [destHeaderId],
})
diff --git a/src/components/kri-editor/KriEditor.tsx b/src/components/kri-editor/KriEditor.tsx
index df47653..056434f 100644
--- a/src/components/kri-editor/KriEditor.tsx
+++ b/src/components/kri-editor/KriEditor.tsx
@@ -4,6 +4,7 @@ import type { KriEditorProps, KriEditorMode } from "./types";
import { KriEditorHtmlOnly } from "./KriEditorHtmlOnly";
import { KriEditorWysiwyg } from "./KriEditorWysiwyg";
import {KriEditorSms} from "./KriEditorSms";
+import { KriEditorKko } from "./KriEditorKko";
function resolveMode(mode?: KriEditorMode, editorMode?: KriEditorMode): KriEditorMode {
return mode ?? editorMode ?? "wysiwyg";
@@ -20,5 +21,9 @@ export function KriEditor(props: KriEditorProps) {
return
}
+ if (mode === "kko") {
+ return ;
+ }
+
return ;
}
diff --git a/src/components/kri-editor/KriEditorKko.tsx b/src/components/kri-editor/KriEditorKko.tsx
new file mode 100644
index 0000000..07706c3
--- /dev/null
+++ b/src/components/kri-editor/KriEditorKko.tsx
@@ -0,0 +1,59 @@
+'use client'
+
+import { User } from 'lucide-react'
+import { cn } from '@/lib/utils'
+import type { KriEditorProps } from './types'
+
+type KkoEditorProps = Omit & { mode: 'kko' }
+
+export function KriEditorKko({
+ label,
+ value,
+ placeholder = '미리볼 내용이 없습니다.',
+ className,
+ kkoTitle = '',
+ kkoSenderName = '',
+ kkoHeaderLabel = '알림톡 도착',
+}: KkoEditorProps) {
+ const body = value ?? ''
+
+ return (
+
+ {label ?
{label}
: null}
+
+
+
+ {kkoSenderName ? (
+
{kkoSenderName}
+ ) : null}
+
+ {kkoSenderName ? (
+
+
+
+
+ {kkoSenderName}
+
+ ) : null}
+
+
+ kakao
+
+
{kkoHeaderLabel}
+ {kkoTitle ?
{kkoTitle}
: null}
+ {body.trim() ? (
+
{body}
+ ) : (
+
{placeholder}
+ )}
+
+
+
+
+
+
+ )
+}
diff --git a/src/components/kri-editor/index.ts b/src/components/kri-editor/index.ts
index efce1bb..99b77c9 100644
--- a/src/components/kri-editor/index.ts
+++ b/src/components/kri-editor/index.ts
@@ -1,5 +1,6 @@
export { KriEditor } from './KriEditor'
export { KriEditorHtmlOnly } from './KriEditorHtmlOnly'
+export { KriEditorKko } from './KriEditorKko'
export { KriEditorSms } from './KriEditorSms'
export { KriEditorWysiwyg } from './KriEditorWysiwyg'
export { ToolbarButton as KriEditorToolbarButton } from './toolbar/ToolbarButton'
diff --git a/src/components/kri-editor/types.ts b/src/components/kri-editor/types.ts
index 02607c8..23e75eb 100644
--- a/src/components/kri-editor/types.ts
+++ b/src/components/kri-editor/types.ts
@@ -2,7 +2,7 @@ import type { Extensions } from '@tiptap/core'
import type { Editor } from '@tiptap/react'
import type { ReactNode } from 'react'
-export type KriEditorMode = 'wysiwyg' | 'both' | 'html' | 'sms'
+export type KriEditorMode = 'wysiwyg' | 'both' | 'html' | 'sms' | 'kko'
export type KriEditorUploadResult = string | { url: string }
export type KriEditorToolbarFeature =
@@ -91,6 +91,12 @@ export type KriEditorProps = {
smsImages?: KriEditorSmsImage[]
/** 휴대폰 프레임 class (기본 높이 h-[600px] 조정 등) */
smsFrameClassName?: string
+ /** 알림톡 미리보기의 강조 제목. 없으면 표시하지 않는다. */
+ kkoTitle?: string
+ /** 알림톡 미리보기의 채널명·발신 프로필 이름. 없으면 표시하지 않는다. */
+ kkoSenderName?: string
+ /** 알림톡 말풍선 상단 문구. 기본값 "알림톡 도착" */
+ kkoHeaderLabel?: string
toolbar?: KriEditorToolbarConfig | false
fontFamilyOptions?: KriEditorFontFamilyOption[]
renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode
diff --git a/src/components/list-contact/ListContactEventPanel.tsx b/src/components/list-contact/ListContactEventPanel.tsx
index c6c17b0..7699919 100644
--- a/src/components/list-contact/ListContactEventPanel.tsx
+++ b/src/components/list-contact/ListContactEventPanel.tsx
@@ -11,7 +11,7 @@ import { useSendResultBySidQuery } from '@/query/message'
import { useInternalInfoQuery } from '@/query/internal'
import { clientEnv } from '@/lib/env.client'
import { ChannelType } from '@kri/common/noti-hub'
-import type { SendResultInfo } from '@/types/message'
+import type { SendResultInfo } from '@kri/common/noti-hub'
import { formatKst } from '@kri/common'
import { type ResultCode, ResultCodeType } from '@/types/project'
import { CONTACT_INTERVIEWER_ROLE, FIELD_INTERVIEWER_ROLE } from '@/const/userConst'
@@ -272,13 +272,14 @@ const SendResultTable = ({ isLoading, results }: { isLoading: boolean; results:
}
const SendResultHistory = ({ sid, prjctCd }: { sid: string; prjctCd: string }) => {
- const [tab, setTab] = useState<'email' | 'sms'>('email')
+ const [tab, setTab] = useState<'email' | 'sms' | 'kko'>('email')
const emailQuery = useSendResultBySidQuery(sid, prjctCd, clientEnv.REQUEST_SVC, ChannelType.EMAIL, tab === 'email')
const smsQuery = useSendResultBySidQuery(sid, prjctCd, clientEnv.REQUEST_SVC, ChannelType.SMS, tab === 'sms')
- const activeQuery = tab === 'email' ? emailQuery : smsQuery
+ const kkoQuery = useSendResultBySidQuery(sid, prjctCd, clientEnv.REQUEST_SVC, ChannelType.KKO, tab === 'kko')
+ const activeQuery = tab === 'email' ? emailQuery : tab === 'sms' ? smsQuery : kkoQuery
- const handleTabClick = (e: React.MouseEvent, next: 'email' | 'sms') => {
+ const handleTabClick = (e: React.MouseEvent, next: 'email' | 'sms' | 'kko') => {
e.stopPropagation()
setTab(next)
}
@@ -307,6 +308,14 @@ const SendResultHistory = ({ sid, prjctCd }: { sid: string; prjctCd: string }) =
>
문자
+
activeQuery.refetch()} isFetching={activeQuery.isFetching} />
}
diff --git a/src/components/list-contact/ListContactInfoPanel.tsx b/src/components/list-contact/ListContactInfoPanel.tsx
index 981b5ab..53b05a0 100644
--- a/src/components/list-contact/ListContactInfoPanel.tsx
+++ b/src/components/list-contact/ListContactInfoPanel.tsx
@@ -1,7 +1,7 @@
'use client'
import { useEffect, useRef, useState, type ReactNode } from 'react'
-import { Mail, MessageSquare, Paperclip, Phone, QrCode } from 'lucide-react'
+import { Mail, MessageCircle, MessageSquare, Paperclip, Phone, QrCode } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
@@ -24,6 +24,7 @@ import { useCtiCallPhase } from '@/hooks/useCtiCallPhase'
import { cn } from '@/lib/utils'
import { downloadFile } from '@kri/common/browser'
import {
+ buildKkoVariableValues,
buildListContactVariableValues,
resolveListHeaderValue,
} from '@/components/list-contact/listContactVariables'
@@ -126,6 +127,8 @@ const ListContactInfoPanel = ({
const surveyResultByIdx = new Map((detail?.surveyResults ?? []).map((result) => [result.prjctSurveyIdx, result]))
const surveyUrlValues = buildListContactVariableValues(listHeaders, detail, sid)
+ // 알림톡은 #{설문명}도 설문 URL로 치환한다. 문자·메일은 기존처럼 헤더 값만 쓴다.
+ const kkoVariableValues = buildKkoVariableValues(surveyUrlValues, surveys)
const handleStartSurvey = (survey: ProjectSurvey) => {
if (!survey.surveyUrl) return
@@ -240,6 +243,16 @@ const ListContactInfoPanel = ({
발송
+
{(isDialing || isOnCall) &&
@@ -383,7 +396,7 @@ const ListContactInfoPanel = ({
itrntPrjctCd={itrntPrjctCd}
sid={sid}
destHeaderId={sendTarget?.headerId ?? 0}
- variableValues={surveyUrlValues}
+ variableValues={sendTarget?.channel === 'kko' ? kkoVariableValues : surveyUrlValues}
/>
)
diff --git a/src/components/list-contact/listContactVariables.ts b/src/components/list-contact/listContactVariables.ts
index ad33843..af6a499 100644
--- a/src/components/list-contact/listContactVariables.ts
+++ b/src/components/list-contact/listContactVariables.ts
@@ -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,
+ surveys: ProjectSurvey[],
+): Record => {
+ const values: Record = { ...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
+}
diff --git a/src/components/list/ListManageActions.tsx b/src/components/list/ListManageActions.tsx
index ee6ac31..189d67b 100644
--- a/src/components/list/ListManageActions.tsx
+++ b/src/components/list/ListManageActions.tsx
@@ -4,6 +4,7 @@ import {
Download,
FileClock,
Mail,
+ MessageCircle,
MessageSquareMore,
RotateCcw,
Upload,
@@ -75,6 +76,10 @@ export function ListManageActions({
문자 발송
+