261008_01_ENH: 알림톡 템플릿 관련내용 구현 및 발송 구현

This commit is contained in:
2026-10-08 11:20:42 +09:00
parent f12c374a84
commit 264707ac56
33 changed files with 803 additions and 143 deletions

View File

@@ -13,12 +13,11 @@ import { downloadBase64File, XLSX_MIME_TYPE } from '@kri/common/browser'
import { formatKst } from '@kri/common'
import type { PaginationState } from '@tanstack/react-table'
import type { DialogId } from '@/store/jotai/dialog'
import type { BulkSendInfo } from '@kri/common/noti-hub'
import type { SendResultInfo } from '@/types/message'
import type { BulkSendInfo, SendResultInfo } from '@kri/common/noti-hub'
import {clientEnv} from "@/lib/env.client";
import { formatKoreanPhoneNumber } from "@/utils/phone";
export type MessageHistoryType = 'sms' | 'email'
export type MessageHistoryType = 'sms' | 'email' | 'kko'
export type MessageHistoryDialogProps = {
dialogId?: DialogId
@@ -29,6 +28,7 @@ export type MessageHistoryDialogProps = {
const tabLabelMap: Record<MessageHistoryType, string> = {
sms: '문자',
email: '이메일',
kko: '알림톡',
}
const historyColumns: DataTableColumn<BulkSendInfo>[] = [
@@ -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 = ({
<Button type="button" variant={tab === 'email' ? 'default' : 'outline'} onClick={() => handleSelectTab('email')}>
{tabLabelMap.email}
</Button>
<Button type="button" variant={tab === 'kko' ? 'default' : 'outline'} onClick={() => handleSelectTab('kko')}>
{tabLabelMap.kko}
</Button>
</div>
<div className="rounded-md border overflow-hidden">