diff --git a/src/app/(pages)/(main)/list/contact/page.tsx b/src/app/(pages)/(main)/list/contact/page.tsx index 7d60b53..7187f95 100644 --- a/src/app/(pages)/(main)/list/contact/page.tsx +++ b/src/app/(pages)/(main)/list/contact/page.tsx @@ -244,6 +244,8 @@ const ListContactPageContent = () => { useFF={projectInfoQuery.data?.ff ?? false} useContactSenario={projectInfoQuery.data?.useContactSenario ?? false} contactSenario={projectInfoQuery.data?.contactSenario} + listHeaders={listHeaders} + detail={listDetailQuery.data} /> diff --git a/src/app/api/external/[[...slug]]/route.ts b/src/app/api/external/[[...slug]]/route.ts index c822948..577d5b8 100644 --- a/src/app/api/external/[[...slug]]/route.ts +++ b/src/app/api/external/[[...slug]]/route.ts @@ -33,11 +33,14 @@ const toRequiredNumber = (value: string): number | null => { return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null; }; +const toRequiredSid = (value: string): string | null => + value.length > 0 ? value : null; + const buildExternalEventBody = ( req: NextRequest, action: ExternalAction, prjctSurveyIdx: number, - sid: number, + sid: string, ): ExternalEventBody => { const pathname = req.nextUrl.pathname; const h = req.headers; @@ -51,7 +54,7 @@ const buildExternalEventBody = ( entryType: getEntryTypeCode(h), action: actionCode, psidx: String(prjctSurveyIdx), - sid: String(sid), + sid, remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req), uri: getHeader(h, "x-orig-uri") || pathname, url: getHeader(h, "x-orig-url") || req.url, @@ -75,7 +78,7 @@ const handleExternalEvent = async (req: NextRequest, context: RouteContext) => { } const prjctSurveyIdx = toRequiredNumber((searchParams.get("psidx") ?? "").trim()); - const sid = toRequiredNumber((searchParams.get("sid") ?? "").trim()); + const sid = toRequiredSid((searchParams.get("sid") ?? "").trim()); if (!prjctSurveyIdx || !sid) { return NextResponse.json({ message: "psidx, sid는 필수입니다." }, { status: 400 }); diff --git a/src/app/api/list-call-hist/[[...slug]]/route.ts b/src/app/api/list-call-hist/[[...slug]]/route.ts index b096cab..d082c86 100644 --- a/src/app/api/list-call-hist/[[...slug]]/route.ts +++ b/src/app/api/list-call-hist/[[...slug]]/route.ts @@ -37,7 +37,7 @@ export const PUT = async (req: NextRequest, context: RouteContext) => { const contactApi = await createContactApi(); const result = await contactApi.put( - `/list-call-hist/${prjctIdx}/${sid}/${action}`, + `/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/${action}`, body, ); return NextResponse.json(result, { status: 200 }); diff --git a/src/app/api/list-hist/[[...slug]]/route.ts b/src/app/api/list-hist/[[...slug]]/route.ts index 7ecd047..5292002 100644 --- a/src/app/api/list-hist/[[...slug]]/route.ts +++ b/src/app/api/list-hist/[[...slug]]/route.ts @@ -11,12 +11,16 @@ export const GET = async (req: NextRequest, context: RouteContext) => { const contactApi = await createContactApi(); if (action === "event" && slug.length === 3) { - const result = await contactApi.get(`/list-hist/event/${slug[1]}/${slug[2]}`); + const result = await contactApi.get( + `/list-hist/event/${slug[1]}/${encodeURIComponent(slug[2])}`, + ); return NextResponse.json(result, { status: 200 }); } if (action === "update" && slug.length === 3) { - const result = await contactApi.get(`/list-hist/update/${slug[1]}/${slug[2]}`); + const result = await contactApi.get( + `/list-hist/update/${slug[1]}/${encodeURIComponent(slug[2])}`, + ); return NextResponse.json(result, { status: 200 }); } diff --git a/src/app/api/list/[[...slug]]/route.ts b/src/app/api/list/[[...slug]]/route.ts index 76445d9..48f9009 100644 --- a/src/app/api/list/[[...slug]]/route.ts +++ b/src/app/api/list/[[...slug]]/route.ts @@ -28,13 +28,15 @@ export const GET = async (req: NextRequest, context: RouteContext) => { } if (action === "search-sid" && slug.length === 3) { - const result = await contactApi.get(`/list/search-sid/${slug[1]}/${slug[2]}`); + const result = await contactApi.get( + `/list/search-sid/${slug[1]}/${encodeURIComponent(slug[2])}`, + ); return NextResponse.json(result, { status: 200 }); } if (action === "item-file-download" && slug.length === 4) { const result = await contactApi.get( - `/list/item-file/download/${slug[1]}/${slug[2]}/${slug[3]}`, + `/list/item-file/download/${slug[1]}/${encodeURIComponent(slug[2])}/${slug[3]}`, { expectBinary: true }, ); return new NextResponse(result, { @@ -94,7 +96,7 @@ export const POST = async (req: NextRequest, context: RouteContext) => { if (action === "item-file-upload" && slug.length === 3) { const form = await req.formData(); - await contactApi.postForm(`/list/item-file/upload/${slug[1]}/${slug[2]}`, form); + await contactApi.postForm(`/list/item-file/upload/${slug[1]}/${encodeURIComponent(slug[2])}`, form); return new NextResponse(null, { status: 204 }); } diff --git a/src/app/api/message-report/[[...slug]]/route.ts b/src/app/api/message-report/[[...slug]]/route.ts index 48d156a..15f2d80 100644 --- a/src/app/api/message-report/[[...slug]]/route.ts +++ b/src/app/api/message-report/[[...slug]]/route.ts @@ -24,7 +24,7 @@ export const GET = async (req: NextRequest, context: RouteContext) => { const channelTy = req.nextUrl.searchParams.get("channelTy"); const query = channelTy ? `?channelTy=${channelTy}` : ""; const result = await notihubApi.get( - `/report/send-result/${sid}/${prjctCdParam}/${reqstSvcParam}${query}`, + `/report/send-result/${encodeURIComponent(sid)}/${prjctCdParam}/${reqstSvcParam}${query}`, ); return NextResponse.json(result, {status: 200}); } diff --git a/src/app/api/reserve/[[...slug]]/route.ts b/src/app/api/reserve/[[...slug]]/route.ts index 70f2f98..7f15f83 100644 --- a/src/app/api/reserve/[[...slug]]/route.ts +++ b/src/app/api/reserve/[[...slug]]/route.ts @@ -11,7 +11,9 @@ export const GET = async (req: NextRequest, context: RouteContext) => { const contactApi = await createContactApi(); if (action === "sid" && slug.length === 3) { - const result = await contactApi.get(`/reserve/${slug[1]}/sid/${slug[2]}`); + const result = await contactApi.get( + `/reserve/${slug[1]}/sid/${encodeURIComponent(slug[2])}`, + ); return NextResponse.json(result, { status: 200 }); } diff --git a/src/components/data-table/hooks/usePagination.ts b/src/components/data-table/hooks/usePagination.ts index e64920d..67b34d7 100644 --- a/src/components/data-table/hooks/usePagination.ts +++ b/src/components/data-table/hooks/usePagination.ts @@ -15,7 +15,7 @@ export function usePagination({ currentPage, totalPages, paginationItemsToDispla const visibleCount = Math.max(1, paginationItemsToDisplay) const half = Math.floor(visibleCount / 2) let startPage = Math.max(1, currentPage - half) - let endPage = Math.min(totalPages, startPage + visibleCount - 1) + const endPage = Math.min(totalPages, startPage + visibleCount - 1) if (endPage - startPage + 1 < visibleCount) { startPage = Math.max(1, endPage - visibleCount + 1) diff --git a/src/components/dialog/ListUploadDialog.tsx b/src/components/dialog/ListUploadDialog.tsx index 5466f00..eec4094 100644 --- a/src/components/dialog/ListUploadDialog.tsx +++ b/src/components/dialog/ListUploadDialog.tsx @@ -406,10 +406,15 @@ const ListUploadDialog = ({ {item.listCount.toLocaleString()} {item.uploadAtLabel} - + { + item.schedulingDelDt ? +

보관 기간 만료

+ : + + } ))} diff --git a/src/components/dialog/ReservationListDialog.tsx b/src/components/dialog/ReservationListDialog.tsx index abdb0bc..e33b21f 100644 --- a/src/components/dialog/ReservationListDialog.tsx +++ b/src/components/dialog/ReservationListDialog.tsx @@ -15,7 +15,7 @@ export type ReservationListDialogProps = { } // 오늘과 가장 가까운(과거/미래 무관) 예약의 sid를 찾는다. -export const findClosestReservationSid = (reservations: ListReserve[], now: Date = new Date()): number | null => { +export const findClosestReservationSid = (reservations: ListReserve[], now: Date = new Date()): string | null => { if (reservations.length === 0) return null return reservations.reduce((closest, current) => { @@ -45,8 +45,8 @@ const ReservationListDialog = ({ hideDialog(dialogId) } - const handleSelect = (sid: number) => { - onSelectReservation(String(sid)) + const handleSelect = (sid: string) => { + onSelectReservation(sid) handleOpenChange(false) } diff --git a/src/components/dialog/SingleMessageSendDialog.tsx b/src/components/dialog/SingleMessageSendDialog.tsx index 962254b..e9c6543 100644 --- a/src/components/dialog/SingleMessageSendDialog.tsx +++ b/src/components/dialog/SingleMessageSendDialog.tsx @@ -123,7 +123,7 @@ const SingleMessageSendDialog = ({ tmplatIdx: templateIdx, resve: scheduleType === 'reserve', sendDt: scheduleType === 'reserve' ? new Date(reserveAt).toISOString() : undefined, - sid: Number(sid), + sid, destHeaderIds: [destHeaderId], }) diff --git a/src/components/kri-editor/KriEditorWysiwyg.tsx b/src/components/kri-editor/KriEditorWysiwyg.tsx index 4149555..40c3d90 100644 --- a/src/components/kri-editor/KriEditorWysiwyg.tsx +++ b/src/components/kri-editor/KriEditorWysiwyg.tsx @@ -103,7 +103,6 @@ export function KriEditorWysiwyg(props: KriEditorProps) { const htmlTi = useTextareaInsert(htmlTextareaRef); const [view, setView] = useState("wysiwyg"); - const [wysiwygKey, setWysiwygKey] = useState(0); const [previewSource, setPreviewSource] = useState(value ?? ""); const viewRef = useRef("wysiwyg"); @@ -252,7 +251,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) { }, }, }, - },[wysiwygKey]); + }, []); const restoreSelection = useCallback(() => { if (!editor) return; @@ -482,21 +481,20 @@ export function KriEditorWysiwyg(props: KriEditorProps) { const current = editor.getHTML(); if (normalizedValue !== current && normalizedValue !== optimisticHtmlRef.current) { - // 이미지가 포함된 HTML 업데이트면, 아예 editor를 새로 생성 + // 외부에서 본문이 변경된 경우에만 기존 editor 문서를 갱신한다. editor.commands.setContent(normalizedValue, { emitUpdate: false, parseOptions: {preserveWhitespace: "full"}, }); + + // resize가 활성화된 TipTap 이미지 NodeView는 노드의 src 변경을 기존 DOM에 반영하지 않는다. + // editor 전체 대신 NodeView만 다시 생성해 이미지를 갱신하고 편집 포커스는 유지한다. + if (normalizedValue.includes(" { - if (value.includes(" k + 1); - return; - } - }, [value]); - useEffect(() => { if (!editor) return; diff --git a/src/components/list-contact/ListContactEventPanel.tsx b/src/components/list-contact/ListContactEventPanel.tsx index 1cb7921..3d18bb3 100644 --- a/src/components/list-contact/ListContactEventPanel.tsx +++ b/src/components/list-contact/ListContactEventPanel.tsx @@ -20,6 +20,23 @@ import { cn } from '@/lib/utils' import { getNearestFutureDateTime } from '@/lib/datetime' import { useCtiLastCallHistId } from '@/hooks/useCtiLastCallHistId' import { getCurrentPositionMeta } from '@kri/common/browser' +import type { listHeader, ListSearchWithFullResult } from '@/types/list' +import { buildListContactVariableValues } from '@/components/list-contact/listContactVariables' +import { substituteVariables } from '@/lib/surveyUrl' +import { sanitizeHtml } from '@/components/kri-editor/utils/sanitizeHtml' + +const escapeHtml = (value: string) => + value.replace( + /[&<>"']/g, + (character) => + ({ + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + })[character] ?? character, + ) const RefreshIconButton = ({ onRefresh, isFetching }: { onRefresh: () => void; isFetching: boolean }) => (