Merge pull request 'develop' (#15) from develop into master
Reviewed-on: #15
This commit is contained in:
@@ -244,6 +244,8 @@ const ListContactPageContent = () => {
|
|||||||
useFF={projectInfoQuery.data?.ff ?? false}
|
useFF={projectInfoQuery.data?.ff ?? false}
|
||||||
useContactSenario={projectInfoQuery.data?.useContactSenario ?? false}
|
useContactSenario={projectInfoQuery.data?.useContactSenario ?? false}
|
||||||
contactSenario={projectInfoQuery.data?.contactSenario}
|
contactSenario={projectInfoQuery.data?.contactSenario}
|
||||||
|
listHeaders={listHeaders}
|
||||||
|
detail={listDetailQuery.data}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
9
src/app/api/external/[[...slug]]/route.ts
vendored
9
src/app/api/external/[[...slug]]/route.ts
vendored
@@ -33,11 +33,14 @@ const toRequiredNumber = (value: string): number | null => {
|
|||||||
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
|
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toRequiredSid = (value: string): string | null =>
|
||||||
|
value.length > 0 ? value : null;
|
||||||
|
|
||||||
const buildExternalEventBody = (
|
const buildExternalEventBody = (
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
action: ExternalAction,
|
action: ExternalAction,
|
||||||
prjctSurveyIdx: number,
|
prjctSurveyIdx: number,
|
||||||
sid: number,
|
sid: string,
|
||||||
): ExternalEventBody => {
|
): ExternalEventBody => {
|
||||||
const pathname = req.nextUrl.pathname;
|
const pathname = req.nextUrl.pathname;
|
||||||
const h = req.headers;
|
const h = req.headers;
|
||||||
@@ -51,7 +54,7 @@ const buildExternalEventBody = (
|
|||||||
entryType: getEntryTypeCode(h),
|
entryType: getEntryTypeCode(h),
|
||||||
action: actionCode,
|
action: actionCode,
|
||||||
psidx: String(prjctSurveyIdx),
|
psidx: String(prjctSurveyIdx),
|
||||||
sid: String(sid),
|
sid,
|
||||||
remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req),
|
remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req),
|
||||||
uri: getHeader(h, "x-orig-uri") || pathname,
|
uri: getHeader(h, "x-orig-uri") || pathname,
|
||||||
url: getHeader(h, "x-orig-url") || req.url,
|
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 prjctSurveyIdx = toRequiredNumber((searchParams.get("psidx") ?? "").trim());
|
||||||
const sid = toRequiredNumber((searchParams.get("sid") ?? "").trim());
|
const sid = toRequiredSid((searchParams.get("sid") ?? "").trim());
|
||||||
|
|
||||||
if (!prjctSurveyIdx || !sid) {
|
if (!prjctSurveyIdx || !sid) {
|
||||||
return NextResponse.json({ message: "psidx, sid는 필수입니다." }, { status: 400 });
|
return NextResponse.json({ message: "psidx, sid는 필수입니다." }, { status: 400 });
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const PUT = async (req: NextRequest, context: RouteContext) => {
|
|||||||
|
|
||||||
const contactApi = await createContactApi();
|
const contactApi = await createContactApi();
|
||||||
const result = await contactApi.put<ListCallHist>(
|
const result = await contactApi.put<ListCallHist>(
|
||||||
`/list-call-hist/${prjctIdx}/${sid}/${action}`,
|
`/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/${action}`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
|
|||||||
@@ -11,12 +11,16 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
|||||||
const contactApi = await createContactApi();
|
const contactApi = await createContactApi();
|
||||||
|
|
||||||
if (action === "event" && slug.length === 3) {
|
if (action === "event" && slug.length === 3) {
|
||||||
const result = await contactApi.get<ListEventHistory[]>(`/list-hist/event/${slug[1]}/${slug[2]}`);
|
const result = await contactApi.get<ListEventHistory[]>(
|
||||||
|
`/list-hist/event/${slug[1]}/${encodeURIComponent(slug[2])}`,
|
||||||
|
);
|
||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === "update" && slug.length === 3) {
|
if (action === "update" && slug.length === 3) {
|
||||||
const result = await contactApi.get<ListUpdateHistory[]>(`/list-hist/update/${slug[1]}/${slug[2]}`);
|
const result = await contactApi.get<ListUpdateHistory[]>(
|
||||||
|
`/list-hist/update/${slug[1]}/${encodeURIComponent(slug[2])}`,
|
||||||
|
);
|
||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,15 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action === "search-sid" && slug.length === 3) {
|
if (action === "search-sid" && slug.length === 3) {
|
||||||
const result = await contactApi.get<ListSearchWithFullResult>(`/list/search-sid/${slug[1]}/${slug[2]}`);
|
const result = await contactApi.get<ListSearchWithFullResult>(
|
||||||
|
`/list/search-sid/${slug[1]}/${encodeURIComponent(slug[2])}`,
|
||||||
|
);
|
||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === "item-file-download" && slug.length === 4) {
|
if (action === "item-file-download" && slug.length === 4) {
|
||||||
const result = await contactApi.get<ArrayBuffer>(
|
const result = await contactApi.get<ArrayBuffer>(
|
||||||
`/list/item-file/download/${slug[1]}/${slug[2]}/${slug[3]}`,
|
`/list/item-file/download/${slug[1]}/${encodeURIComponent(slug[2])}/${slug[3]}`,
|
||||||
{ expectBinary: true },
|
{ expectBinary: true },
|
||||||
);
|
);
|
||||||
return new NextResponse(result, {
|
return new NextResponse(result, {
|
||||||
@@ -94,7 +96,7 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
|
|||||||
|
|
||||||
if (action === "item-file-upload" && slug.length === 3) {
|
if (action === "item-file-upload" && slug.length === 3) {
|
||||||
const form = await req.formData();
|
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 });
|
return new NextResponse(null, { status: 204 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
|||||||
const channelTy = req.nextUrl.searchParams.get("channelTy");
|
const channelTy = req.nextUrl.searchParams.get("channelTy");
|
||||||
const query = channelTy ? `?channelTy=${channelTy}` : "";
|
const query = channelTy ? `?channelTy=${channelTy}` : "";
|
||||||
const result = await notihubApi.get<SendResultInfo[]>(
|
const result = await notihubApi.get<SendResultInfo[]>(
|
||||||
`/report/send-result/${sid}/${prjctCdParam}/${reqstSvcParam}${query}`,
|
`/report/send-result/${encodeURIComponent(sid)}/${prjctCdParam}/${reqstSvcParam}${query}`,
|
||||||
);
|
);
|
||||||
return NextResponse.json(result, {status: 200});
|
return NextResponse.json(result, {status: 200});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
|||||||
const contactApi = await createContactApi();
|
const contactApi = await createContactApi();
|
||||||
|
|
||||||
if (action === "sid" && slug.length === 3) {
|
if (action === "sid" && slug.length === 3) {
|
||||||
const result = await contactApi.get<ListReserve[]>(`/reserve/${slug[1]}/sid/${slug[2]}`);
|
const result = await contactApi.get<ListReserve[]>(
|
||||||
|
`/reserve/${slug[1]}/sid/${encodeURIComponent(slug[2])}`,
|
||||||
|
);
|
||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function usePagination({ currentPage, totalPages, paginationItemsToDispla
|
|||||||
const visibleCount = Math.max(1, paginationItemsToDisplay)
|
const visibleCount = Math.max(1, paginationItemsToDisplay)
|
||||||
const half = Math.floor(visibleCount / 2)
|
const half = Math.floor(visibleCount / 2)
|
||||||
let startPage = Math.max(1, currentPage - half)
|
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) {
|
if (endPage - startPage + 1 < visibleCount) {
|
||||||
startPage = Math.max(1, endPage - visibleCount + 1)
|
startPage = Math.max(1, endPage - visibleCount + 1)
|
||||||
|
|||||||
@@ -406,10 +406,15 @@ const ListUploadDialog = ({
|
|||||||
<td className="h-10 px-3 text-center">{item.listCount.toLocaleString()}</td>
|
<td className="h-10 px-3 text-center">{item.listCount.toLocaleString()}</td>
|
||||||
<td className="h-10 px-3 text-center">{item.uploadAtLabel}</td>
|
<td className="h-10 px-3 text-center">{item.uploadAtLabel}</td>
|
||||||
<td className="h-10 px-3 text-center">
|
<td className="h-10 px-3 text-center">
|
||||||
|
{
|
||||||
|
item.schedulingDelDt ?
|
||||||
|
<p className="text-sm text-red-600 font-medium">보관 기간 만료</p>
|
||||||
|
:
|
||||||
<Button type="button" size="sm" className="bg-excel" onClick={() => onDownloadHistory?.(item)}>
|
<Button type="button" size="sm" className="bg-excel" onClick={() => onDownloadHistory?.(item)}>
|
||||||
<Download className="h-4 w-4" />
|
<Download className="h-4 w-4" />
|
||||||
다운로드
|
다운로드
|
||||||
</Button>
|
</Button>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export type ReservationListDialogProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 오늘과 가장 가까운(과거/미래 무관) 예약의 sid를 찾는다.
|
// 오늘과 가장 가까운(과거/미래 무관) 예약의 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
|
if (reservations.length === 0) return null
|
||||||
|
|
||||||
return reservations.reduce((closest, current) => {
|
return reservations.reduce((closest, current) => {
|
||||||
@@ -45,8 +45,8 @@ const ReservationListDialog = ({
|
|||||||
hideDialog(dialogId)
|
hideDialog(dialogId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSelect = (sid: number) => {
|
const handleSelect = (sid: string) => {
|
||||||
onSelectReservation(String(sid))
|
onSelectReservation(sid)
|
||||||
handleOpenChange(false)
|
handleOpenChange(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ const SingleMessageSendDialog = ({
|
|||||||
tmplatIdx: templateIdx,
|
tmplatIdx: templateIdx,
|
||||||
resve: scheduleType === 'reserve',
|
resve: scheduleType === 'reserve',
|
||||||
sendDt: scheduleType === 'reserve' ? new Date(reserveAt).toISOString() : undefined,
|
sendDt: scheduleType === 'reserve' ? new Date(reserveAt).toISOString() : undefined,
|
||||||
sid: Number(sid),
|
sid,
|
||||||
destHeaderIds: [destHeaderId],
|
destHeaderIds: [destHeaderId],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
|||||||
const htmlTi = useTextareaInsert(htmlTextareaRef);
|
const htmlTi = useTextareaInsert(htmlTextareaRef);
|
||||||
|
|
||||||
const [view, setView] = useState<ViewMode>("wysiwyg");
|
const [view, setView] = useState<ViewMode>("wysiwyg");
|
||||||
const [wysiwygKey, setWysiwygKey] = useState<number>(0);
|
|
||||||
const [previewSource, setPreviewSource] = useState(value ?? "");
|
const [previewSource, setPreviewSource] = useState(value ?? "");
|
||||||
const viewRef = useRef<ViewMode>("wysiwyg");
|
const viewRef = useRef<ViewMode>("wysiwyg");
|
||||||
|
|
||||||
@@ -252,7 +251,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},[wysiwygKey]);
|
}, []);
|
||||||
|
|
||||||
const restoreSelection = useCallback(() => {
|
const restoreSelection = useCallback(() => {
|
||||||
if (!editor) return;
|
if (!editor) return;
|
||||||
@@ -482,21 +481,20 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
|||||||
const current = editor.getHTML();
|
const current = editor.getHTML();
|
||||||
|
|
||||||
if (normalizedValue !== current && normalizedValue !== optimisticHtmlRef.current) {
|
if (normalizedValue !== current && normalizedValue !== optimisticHtmlRef.current) {
|
||||||
// 이미지가 포함된 HTML 업데이트면, 아예 editor를 새로 생성
|
// 외부에서 본문이 변경된 경우에만 기존 editor 문서를 갱신한다.
|
||||||
editor.commands.setContent(normalizedValue, {
|
editor.commands.setContent(normalizedValue, {
|
||||||
emitUpdate: false,
|
emitUpdate: false,
|
||||||
parseOptions: {preserveWhitespace: "full"},
|
parseOptions: {preserveWhitespace: "full"},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// resize가 활성화된 TipTap 이미지 NodeView는 노드의 src 변경을 기존 DOM에 반영하지 않는다.
|
||||||
|
// editor 전체 대신 NodeView만 다시 생성해 이미지를 갱신하고 편집 포커스는 유지한다.
|
||||||
|
if (normalizedValue.includes("<img")) {
|
||||||
|
editor.createNodeViews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [value, editor, view]);
|
}, [value, editor, view]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (value.includes("<img")) {
|
|
||||||
setWysiwygKey((k) => k + 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, [value]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editor) return;
|
if (!editor) return;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,23 @@ import { cn } from '@/lib/utils'
|
|||||||
import { getNearestFutureDateTime } from '@/lib/datetime'
|
import { getNearestFutureDateTime } from '@/lib/datetime'
|
||||||
import { useCtiLastCallHistId } from '@/hooks/useCtiLastCallHistId'
|
import { useCtiLastCallHistId } from '@/hooks/useCtiLastCallHistId'
|
||||||
import { getCurrentPositionMeta } from '@kri/common/browser'
|
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 }) => (
|
const RefreshIconButton = ({ onRefresh, isFetching }: { onRefresh: () => void; isFetching: boolean }) => (
|
||||||
<Button
|
<Button
|
||||||
@@ -124,7 +141,7 @@ const ContactEventSection = ({
|
|||||||
const isContactType = resultCodeType === ResultCodeType.CONTACT
|
const isContactType = resultCodeType === ResultCodeType.CONTACT
|
||||||
|
|
||||||
const historyQuery = useListEventHistoryQuery(prjctIdx, sid, true)
|
const historyQuery = useListEventHistoryQuery(prjctIdx, sid, true)
|
||||||
const ctiLastCallHistId = useCtiLastCallHistId(prjctIdx, Number(sid))
|
const ctiLastCallHistId = useCtiLastCallHistId(prjctIdx, sid)
|
||||||
const listCallHistIdx = isContactType ? ctiLastCallHistId : null
|
const listCallHistIdx = isContactType ? ctiLastCallHistId : null
|
||||||
|
|
||||||
const handleResultCdChange = (next: string) => {
|
const handleResultCdChange = (next: string) => {
|
||||||
@@ -283,6 +300,8 @@ export type ListContactEventPanelProps = {
|
|||||||
useFF: boolean
|
useFF: boolean
|
||||||
useContactSenario: boolean
|
useContactSenario: boolean
|
||||||
contactSenario?: string
|
contactSenario?: string
|
||||||
|
listHeaders: listHeader[]
|
||||||
|
detail?: ListSearchWithFullResult
|
||||||
}
|
}
|
||||||
|
|
||||||
const ListContactEventPanel = ({
|
const ListContactEventPanel = ({
|
||||||
@@ -295,12 +314,23 @@ const ListContactEventPanel = ({
|
|||||||
useFF,
|
useFF,
|
||||||
useContactSenario,
|
useContactSenario,
|
||||||
contactSenario,
|
contactSenario,
|
||||||
|
listHeaders,
|
||||||
|
detail,
|
||||||
}: ListContactEventPanelProps) => {
|
}: ListContactEventPanelProps) => {
|
||||||
const addListEventMutation = useAddListEventMutation(prjctIdx, sid)
|
const addListEventMutation = useAddListEventMutation(prjctIdx, sid)
|
||||||
const reserveMutation = useReserveMutation(prjctIdx, sid)
|
const reserveMutation = useReserveMutation(prjctIdx, sid)
|
||||||
const internalInfoQuery = useInternalInfoQuery()
|
const internalInfoQuery = useInternalInfoQuery()
|
||||||
const showContactInput = userRole !== FIELD_INTERVIEWER_ROLE
|
const showContactInput = userRole !== FIELD_INTERVIEWER_ROLE
|
||||||
const showInterviewInput = userRole !== CONTACT_INTERVIEWER_ROLE
|
const showInterviewInput = userRole !== CONTACT_INTERVIEWER_ROLE
|
||||||
|
const contactSenarioValues = Object.fromEntries(
|
||||||
|
Object.entries(buildListContactVariableValues(listHeaders, detail, sid)).map(([key, value]) => [
|
||||||
|
key,
|
||||||
|
escapeHtml(value),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
const resolvedContactSenario = contactSenario
|
||||||
|
? sanitizeHtml(substituteVariables(contactSenario, contactSenarioValues))
|
||||||
|
: ''
|
||||||
|
|
||||||
const handleAddEvent =
|
const handleAddEvent =
|
||||||
(resultCodeType: ResultCodeType) =>
|
(resultCodeType: ResultCodeType) =>
|
||||||
@@ -309,7 +339,7 @@ const ListContactEventPanel = ({
|
|||||||
|
|
||||||
await addListEventMutation.mutateAsync({
|
await addListEventMutation.mutateAsync({
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
sid: Number(sid),
|
sid,
|
||||||
resultCodeType,
|
resultCodeType,
|
||||||
resultCd,
|
resultCd,
|
||||||
listCallHistIdx,
|
listCallHistIdx,
|
||||||
@@ -321,7 +351,7 @@ const ListContactEventPanel = ({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (resveDt) {
|
if (resveDt) {
|
||||||
await reserveMutation.mutateAsync({ prjctIdx, sid: Number(sid), userId, resveDt })
|
await reserveMutation.mutateAsync({ prjctIdx, sid, userId, resveDt })
|
||||||
}
|
}
|
||||||
|
|
||||||
alert('등록되었습니다.')
|
alert('등록되었습니다.')
|
||||||
@@ -357,10 +387,10 @@ const ListContactEventPanel = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{useContactSenario && contactSenario ? (
|
{useContactSenario && resolvedContactSenario ? (
|
||||||
<div className="space-y-2 rounded-lg border bg-white p-4">
|
<div className="space-y-2 rounded-lg border bg-white p-4">
|
||||||
<h2 className="text-lg font-bold border-b pb-2">컨택 시나리오</h2>
|
<h2 className="text-lg font-bold border-b pb-2">컨택 시나리오</h2>
|
||||||
<div className="text-base leading-relaxed" dangerouslySetInnerHTML={{ __html: contactSenario }} />
|
<div className="text-base leading-relaxed" dangerouslySetInnerHTML={{ __html: resolvedContactSenario }} />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ import { KriSingleSelect } from '@/components/common/KriAutoComplete'
|
|||||||
import { useDialog } from '@/hooks/useDialog'
|
import { useDialog } from '@/hooks/useDialog'
|
||||||
import { useDownloadListItemFileByHeaderMutation, useUploadListItemFileMutation } from '@/query/list'
|
import { useDownloadListItemFileByHeaderMutation, useUploadListItemFileMutation } from '@/query/list'
|
||||||
import { ListHeaderConst } from '@/const/listConst'
|
import { ListHeaderConst } from '@/const/listConst'
|
||||||
import { LIST_IS_USE_LABEL } from '@/components/table-column/ListTableColumn'
|
|
||||||
import type { listHeader, ListSearchWithFullResult } from '@/types/list'
|
import type { listHeader, ListSearchWithFullResult } from '@/types/list'
|
||||||
import type { MessageSendChannel } from '@/types/message'
|
import type { MessageSendChannel } from '@/types/message'
|
||||||
import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/project'
|
import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/project'
|
||||||
import { formatKst } from '@kri/common'
|
import { formatKst } from '@kri/common'
|
||||||
import { isAssignHeaderType, isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
|
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
|
||||||
import { substituteSurveyUrl } from '@/lib/surveyUrl'
|
import { substituteVariables } from '@/lib/surveyUrl'
|
||||||
import { formatKoreanPhoneNumber } from '@/utils/phone'
|
import { formatKoreanPhoneNumber } from '@/utils/phone'
|
||||||
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
|
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
|
||||||
import SingleMessageSendDialog from '@/components/dialog/SingleMessageSendDialog'
|
import SingleMessageSendDialog from '@/components/dialog/SingleMessageSendDialog'
|
||||||
@@ -24,6 +23,10 @@ import { useCtiConnectionStatus } from '@/hooks/useCtiConnectionStatus'
|
|||||||
import { useCtiCallPhase } from '@/hooks/useCtiCallPhase'
|
import { useCtiCallPhase } from '@/hooks/useCtiCallPhase'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { downloadFile } from '@kri/common/browser'
|
import { downloadFile } from '@kri/common/browser'
|
||||||
|
import {
|
||||||
|
buildListContactVariableValues,
|
||||||
|
resolveListHeaderValue,
|
||||||
|
} from '@/components/list-contact/listContactVariables'
|
||||||
|
|
||||||
export type ListContactInfoPanelProps = {
|
export type ListContactInfoPanelProps = {
|
||||||
prjctIdx: number
|
prjctIdx: number
|
||||||
@@ -41,24 +44,13 @@ export type ListContactInfoPanelProps = {
|
|||||||
onSaved?: () => void
|
onSaved?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolveHeaderValue = (header: listHeader, detail?: ListSearchWithFullResult): string => {
|
|
||||||
if (header.listHderTy === ListHeaderConst.MEMO) return detail?.memo ?? ''
|
|
||||||
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
|
||||||
return detail?.use != null ? (LIST_IS_USE_LABEL[detail.use] ?? '') : ''
|
|
||||||
}
|
|
||||||
if (isAssignHeaderType(header.listHderTy)) {
|
|
||||||
return detail?.assignList?.[header.listHderTy] ?? ''
|
|
||||||
}
|
|
||||||
return detail?.itemList?.[header.listHderId] ?? ''
|
|
||||||
}
|
|
||||||
|
|
||||||
export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearchWithFullResult) => {
|
export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearchWithFullResult) => {
|
||||||
const values: Record<number, string> = {}
|
const values: Record<number, string> = {}
|
||||||
|
|
||||||
for (const header of listHeaders) {
|
for (const header of listHeaders) {
|
||||||
if (header.listHderTy === ListHeaderConst.SID) continue
|
if (header.listHderTy === ListHeaderConst.SID) continue
|
||||||
if (!isListFieldVisibleForContact(header)) continue
|
if (!isListFieldVisibleForContact(header)) continue
|
||||||
values[header.listHderId] = resolveHeaderValue(header, detail)
|
values[header.listHderId] = resolveListHeaderValue(header, detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
return values
|
return values
|
||||||
@@ -123,22 +115,16 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
const surveyResultByIdx = new Map((detail?.surveyResults ?? []).map((result) => [result.prjctSurveyIdx, result]))
|
const surveyResultByIdx = new Map((detail?.surveyResults ?? []).map((result) => [result.prjctSurveyIdx, result]))
|
||||||
|
|
||||||
// 설문 URL 치환은 화면 노출(면접원 노출) 여부와 무관하게 전체 헤더 값을 대상으로 한다.
|
const surveyUrlValues = buildListContactVariableValues(listHeaders, detail, sid)
|
||||||
const surveyUrlValues: Record<string, string> = {}
|
|
||||||
for (const header of listHeaders) {
|
|
||||||
if (header.listHderTy === ListHeaderConst.SID) continue
|
|
||||||
surveyUrlValues[header.listHderNm] = resolveHeaderValue(header, detail)
|
|
||||||
}
|
|
||||||
surveyUrlValues.SID = sid // 예약 토큰: 헤더명이 'SID'인 커스텀 헤더가 있어도 항상 실제 sid로 치환한다.
|
|
||||||
|
|
||||||
const handleStartSurvey = (survey: ProjectSurvey) => {
|
const handleStartSurvey = (survey: ProjectSurvey) => {
|
||||||
if (!survey.surveyUrl) return
|
if (!survey.surveyUrl) return
|
||||||
window.open(substituteSurveyUrl(survey.surveyUrl, surveyUrlValues), '_blank', 'noopener,noreferrer')
|
window.open(substituteVariables(survey.surveyUrl, surveyUrlValues), '_blank', 'noopener,noreferrer')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleShowQr = (survey: ProjectSurvey) => {
|
const handleShowQr = (survey: ProjectSurvey) => {
|
||||||
if (!survey.surveyUrl) return
|
if (!survey.surveyUrl) return
|
||||||
setQrTargetUrl(substituteSurveyUrl(survey.surveyUrl, surveyUrlValues))
|
setQrTargetUrl(substituteVariables(survey.surveyUrl, surveyUrlValues))
|
||||||
showDialog('surveyQrDialog')
|
showDialog('surveyQrDialog')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +142,7 @@ const ListContactInfoPanel = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!telNum) return
|
if (!telNum) return
|
||||||
ctiClient.makeCall({ dialNumber: telNum, prjctIdx, sid: Number(sid), listHderId, aniNumber: callerTelNum ?? '' })
|
ctiClient.makeCall({ dialNumber: telNum, prjctIdx, sid, listHderId, aniNumber: callerTelNum ?? '' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePickFile = (listHderId: number) => {
|
const handlePickFile = (listHderId: number) => {
|
||||||
|
|||||||
36
src/components/list-contact/listContactVariables.ts
Normal file
36
src/components/list-contact/listContactVariables.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import { LIST_IS_USE_LABEL } from '@/components/table-column/ListTableColumn'
|
||||||
|
import { ListHeaderConst } from '@/const/listConst'
|
||||||
|
import type { listHeader, ListSearchWithFullResult } from '@/types/list'
|
||||||
|
import { isAssignHeaderType } from '@/utils/listAccess'
|
||||||
|
|
||||||
|
export const resolveListHeaderValue = (
|
||||||
|
header: listHeader,
|
||||||
|
detail?: ListSearchWithFullResult,
|
||||||
|
): string => {
|
||||||
|
if (header.listHderTy === ListHeaderConst.MEMO) return detail?.memo ?? ''
|
||||||
|
if (header.listHderTy === ListHeaderConst.IS_USE) {
|
||||||
|
return detail?.use != null ? (LIST_IS_USE_LABEL[detail.use] ?? '') : ''
|
||||||
|
}
|
||||||
|
if (isAssignHeaderType(header.listHderTy)) {
|
||||||
|
return detail?.assignList?.[header.listHderTy] ?? ''
|
||||||
|
}
|
||||||
|
return detail?.itemList?.[header.listHderId] ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
export const buildListContactVariableValues = (
|
||||||
|
listHeaders: listHeader[],
|
||||||
|
detail: ListSearchWithFullResult | undefined,
|
||||||
|
sid: string,
|
||||||
|
): Record<string, string> => {
|
||||||
|
const values: Record<string, string> = {}
|
||||||
|
|
||||||
|
// 화면 노출 여부와 무관하게 전체 헤더 값을 치환 대상으로 사용한다.
|
||||||
|
for (const header of listHeaders) {
|
||||||
|
if (header.listHderTy === ListHeaderConst.SID) continue
|
||||||
|
values[header.listHderNm] = resolveListHeaderValue(header, detail)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 같은 이름의 커스텀 헤더가 있어도 예약 토큰 SID에는 실제 SID를 사용한다.
|
||||||
|
values.SID = sid
|
||||||
|
return values
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ export function DateProgressSection({ title, subtitle, rows, resultCodeColumns }
|
|||||||
const totalSeries = {
|
const totalSeries = {
|
||||||
name: 'Total',
|
name: 'Total',
|
||||||
data: sortedRows.map((row) => row.totalCount ?? 0),
|
data: sortedRows.map((row) => row.totalCount ?? 0),
|
||||||
option: { type: 'bar' },
|
option: { type: 'bar', barMaxWidth: 48 },
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultSeries = resultCodeColumns.map(({ resultCd, label }) => ({
|
const resultSeries = resultCodeColumns.map(({ resultCd, label }) => ({
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useCallback, useSyncExternalStore } from "react";
|
import { useCallback, useSyncExternalStore } from "react";
|
||||||
import { ctiClient } from "@/lib/cti/ctiClient";
|
import { ctiClient } from "@/lib/cti/ctiClient";
|
||||||
|
|
||||||
export function useCtiLastCallHistId(prjctIdx: number, sid: number) {
|
export function useCtiLastCallHistId(prjctIdx: number, sid: string) {
|
||||||
const getSnapshot = useCallback(
|
const getSnapshot = useCallback(
|
||||||
() => ctiClient.getLastCallHistIdFor(prjctIdx, sid),
|
() => ctiClient.getLastCallHistIdFor(prjctIdx, sid),
|
||||||
[prjctIdx, sid],
|
[prjctIdx, sid],
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type CtiLoginParams = {
|
|||||||
type CtiMakeCallParams = {
|
type CtiMakeCallParams = {
|
||||||
dialNumber: string;
|
dialNumber: string;
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
listHderId: number;
|
listHderId: number;
|
||||||
aniNumber: string;
|
aniNumber: string;
|
||||||
};
|
};
|
||||||
@@ -32,7 +32,7 @@ export type CtiCallPhase = "idle" | "dialing" | "active";
|
|||||||
|
|
||||||
type CtiCallContext = {
|
type CtiCallContext = {
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
listHderId: number;
|
listHderId: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ type CtiCall = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type PersistedCtiState = {
|
type PersistedCtiState = {
|
||||||
version: 2;
|
version: 3;
|
||||||
agentLoginId: string;
|
agentLoginId: string;
|
||||||
agentStatus: string | null;
|
agentStatus: string | null;
|
||||||
activeCall: CtiCall | null;
|
activeCall: CtiCall | null;
|
||||||
@@ -54,7 +54,25 @@ type PersistedCtiState = {
|
|||||||
updatedAt: number;
|
updatedAt: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CTI_STATE_VERSION = 2;
|
type LegacyCtiCallContext = Omit<CtiCallContext, "sid"> & {
|
||||||
|
sid: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type LegacyCtiCall = Omit<CtiCall, "context"> & {
|
||||||
|
context: LegacyCtiCallContext;
|
||||||
|
};
|
||||||
|
|
||||||
|
type LegacyPersistedCtiState = Omit<
|
||||||
|
PersistedCtiState,
|
||||||
|
"version" | "activeCall" | "closingCall" | "lastCallContext"
|
||||||
|
> & {
|
||||||
|
version: 2;
|
||||||
|
activeCall: LegacyCtiCall | null;
|
||||||
|
closingCall: LegacyCtiCall | null;
|
||||||
|
lastCallContext: LegacyCtiCallContext | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const CTI_STATE_VERSION = 3;
|
||||||
const CTI_STATE_TTL_MS = 24 * 60 * 60 * 1000;
|
const CTI_STATE_TTL_MS = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
let socket: WebSocket | null = null;
|
let socket: WebSocket | null = null;
|
||||||
@@ -92,6 +110,19 @@ const isCallInProgress = () =>
|
|||||||
const isCallContext = (value: unknown): value is CtiCallContext => {
|
const isCallContext = (value: unknown): value is CtiCallContext => {
|
||||||
if (typeof value !== "object" || value === null) return false;
|
if (typeof value !== "object" || value === null) return false;
|
||||||
const context = value as Partial<CtiCallContext>;
|
const context = value as Partial<CtiCallContext>;
|
||||||
|
return (
|
||||||
|
typeof context.prjctIdx === "number" &&
|
||||||
|
Number.isFinite(context.prjctIdx) &&
|
||||||
|
typeof context.sid === "string" &&
|
||||||
|
context.sid.length > 0 &&
|
||||||
|
typeof context.listHderId === "number" &&
|
||||||
|
Number.isFinite(context.listHderId)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isLegacyCallContext = (value: unknown): value is LegacyCtiCallContext => {
|
||||||
|
if (typeof value !== "object" || value === null) return false;
|
||||||
|
const context = value as Partial<LegacyCtiCallContext>;
|
||||||
return (
|
return (
|
||||||
typeof context.prjctIdx === "number" &&
|
typeof context.prjctIdx === "number" &&
|
||||||
Number.isFinite(context.prjctIdx) &&
|
Number.isFinite(context.prjctIdx) &&
|
||||||
@@ -111,6 +142,15 @@ const isCtiCall = (value: unknown): value is CtiCall => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isLegacyCtiCall = (value: unknown): value is LegacyCtiCall => {
|
||||||
|
if (typeof value !== "object" || value === null) return false;
|
||||||
|
const call = value as Partial<LegacyCtiCall>;
|
||||||
|
return (
|
||||||
|
isLegacyCallContext(call.context) &&
|
||||||
|
(call.agentSessionId === null || typeof call.agentSessionId === "string")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const isPersistedCtiState = (value: unknown): value is PersistedCtiState => {
|
const isPersistedCtiState = (value: unknown): value is PersistedCtiState => {
|
||||||
if (typeof value !== "object" || value === null) return false;
|
if (typeof value !== "object" || value === null) return false;
|
||||||
const state = value as Partial<PersistedCtiState>;
|
const state = value as Partial<PersistedCtiState>;
|
||||||
@@ -128,6 +168,48 @@ const isPersistedCtiState = (value: unknown): value is PersistedCtiState => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isLegacyPersistedCtiState = (value: unknown): value is LegacyPersistedCtiState => {
|
||||||
|
if (typeof value !== "object" || value === null) return false;
|
||||||
|
const state = value as Partial<LegacyPersistedCtiState>;
|
||||||
|
return (
|
||||||
|
state.version === 2 &&
|
||||||
|
typeof state.agentLoginId === "string" &&
|
||||||
|
(state.agentStatus === null || typeof state.agentStatus === "string") &&
|
||||||
|
(state.activeCall === null || isLegacyCtiCall(state.activeCall)) &&
|
||||||
|
(state.closingCall === null || isLegacyCtiCall(state.closingCall)) &&
|
||||||
|
(state.lastCallContext === null || isLegacyCallContext(state.lastCallContext)) &&
|
||||||
|
(state.lastCallHistId === null || typeof state.lastCallHistId === "number") &&
|
||||||
|
typeof state.hangupRequested === "boolean" &&
|
||||||
|
typeof state.callClosedReceived === "boolean" &&
|
||||||
|
typeof state.updatedAt === "number"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const migrateLegacyCallContext = (context: LegacyCtiCallContext): CtiCallContext => ({
|
||||||
|
...context,
|
||||||
|
sid: String(context.sid),
|
||||||
|
});
|
||||||
|
|
||||||
|
const migrateLegacyCall = (call: LegacyCtiCall | null): CtiCall | null =>
|
||||||
|
call
|
||||||
|
? {
|
||||||
|
...call,
|
||||||
|
context: migrateLegacyCallContext(call.context),
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const toPersistedCtiState = (value: unknown): PersistedCtiState | null => {
|
||||||
|
if (isPersistedCtiState(value)) return value;
|
||||||
|
if (!isLegacyPersistedCtiState(value)) return null;
|
||||||
|
return {
|
||||||
|
...value,
|
||||||
|
version: CTI_STATE_VERSION,
|
||||||
|
activeCall: migrateLegacyCall(value.activeCall),
|
||||||
|
closingCall: migrateLegacyCall(value.closingCall),
|
||||||
|
lastCallContext: value.lastCallContext ? migrateLegacyCallContext(value.lastCallContext) : null,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const persistCtiState = () => {
|
const persistCtiState = () => {
|
||||||
if (!currentAgentLoginId) return;
|
if (!currentAgentLoginId) return;
|
||||||
setLocalStorage(StorageKeys.CtiState, {
|
setLocalStorage(StorageKeys.CtiState, {
|
||||||
@@ -146,22 +228,24 @@ const persistCtiState = () => {
|
|||||||
|
|
||||||
const restoreCtiState = (agentLoginId: string) => {
|
const restoreCtiState = (agentLoginId: string) => {
|
||||||
const stored = getLocalStorage(StorageKeys.CtiState);
|
const stored = getLocalStorage(StorageKeys.CtiState);
|
||||||
|
const persistedState = toPersistedCtiState(stored);
|
||||||
if (
|
if (
|
||||||
!isPersistedCtiState(stored) ||
|
!persistedState ||
|
||||||
stored.agentLoginId !== agentLoginId ||
|
persistedState.agentLoginId !== agentLoginId ||
|
||||||
Date.now() - stored.updatedAt > CTI_STATE_TTL_MS
|
Date.now() - persistedState.updatedAt > CTI_STATE_TTL_MS
|
||||||
) {
|
) {
|
||||||
if (stored !== null) removeLocalStorage(StorageKeys.CtiState);
|
if (stored !== null) removeLocalStorage(StorageKeys.CtiState);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
agentStatus = stored.agentStatus;
|
agentStatus = persistedState.agentStatus;
|
||||||
activeCall = stored.activeCall;
|
activeCall = persistedState.activeCall;
|
||||||
closingCall = stored.closingCall;
|
closingCall = persistedState.closingCall;
|
||||||
lastCallContext = stored.lastCallContext;
|
lastCallContext = persistedState.lastCallContext;
|
||||||
lastCallHistId = stored.lastCallHistId;
|
lastCallHistId = persistedState.lastCallHistId;
|
||||||
hangupRequested = stored.hangupRequested;
|
hangupRequested = persistedState.hangupRequested;
|
||||||
callClosedReceived = stored.callClosedReceived;
|
callClosedReceived = persistedState.callClosedReceived;
|
||||||
|
if (persistedState !== stored) persistCtiState();
|
||||||
notify();
|
notify();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -324,7 +408,7 @@ const saveCallHistory = (parsed: Record<string, unknown>, phase: "start" | "clos
|
|||||||
const action = phase === "start" ? "call-start" : "call-close";
|
const action = phase === "start" ? "call-start" : "call-close";
|
||||||
console.log(`[CTI][TEMP_LOG] saving ${action}`, { prjctIdx, sid, body }); // TEMP_CTI_LOG
|
console.log(`[CTI][TEMP_LOG] saving ${action}`, { prjctIdx, sid, body }); // TEMP_CTI_LOG
|
||||||
nextApi
|
nextApi
|
||||||
.put<ListCallHist>(`/list-call-hist/${prjctIdx}/${sid}/${action}`, body)
|
.put<ListCallHist>(`/list-call-hist/${prjctIdx}/${encodeURIComponent(sid)}/${action}`, body)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
console.log(`[CTI][TEMP_LOG] ${action} saved, listCallHistIdx =`, result?.listCallHistIdx); // TEMP_CTI_LOG
|
console.log(`[CTI][TEMP_LOG] ${action} saved, listCallHistIdx =`, result?.listCallHistIdx); // TEMP_CTI_LOG
|
||||||
lastCallContext = callContext;
|
lastCallContext = callContext;
|
||||||
@@ -570,7 +654,7 @@ export const ctiClient = {
|
|||||||
},
|
},
|
||||||
getConnectionState: () => connectionState,
|
getConnectionState: () => connectionState,
|
||||||
getCallPhase,
|
getCallPhase,
|
||||||
getLastCallHistIdFor: (prjctIdx: number, sid: number) =>
|
getLastCallHistIdFor: (prjctIdx: number, sid: string) =>
|
||||||
lastCallContext?.prjctIdx === prjctIdx && lastCallContext.sid === sid ? lastCallHistId : null,
|
lastCallContext?.prjctIdx === prjctIdx && lastCallContext.sid === sid ? lastCallHistId : null,
|
||||||
makeCall: (params: CtiMakeCallParams) => {
|
makeCall: (params: CtiMakeCallParams) => {
|
||||||
if (!currentAgentLoginId) return;
|
if (!currentAgentLoginId) return;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// project.surveyUrl에 들어있는 [$SID], [$헤더명] 치환 토큰을 values에 있는 값으로 바꾼다.
|
// 문자열에 들어있는 [$SID], [$헤더명] 치환 토큰을 values에 있는 값으로 바꾼다.
|
||||||
// 값이 없는 토큰은 빈 문자열로 치환한다(URL에 인코딩되지 않은 대괄호가 남지 않도록).
|
// 값이 없는 토큰은 빈 문자열로 치환한다.
|
||||||
// 참고: src/app/(pages)/(main)/project/info/page.tsx의 sidParam = 'sid=[$SID]'와 동일한 토큰.
|
export const substituteVariables = (contents: string, values: Record<string, string>) =>
|
||||||
export const substituteSurveyUrl = (surveyUrl: string, values: Record<string, string>) =>
|
contents.replace(/\[\$([^\]]+)\]/g, (_, key: string) => values[key] ?? "");
|
||||||
surveyUrl.replace(/\[\$([^\]]+)\]/g, (_, key: string) => values[key] ?? "");
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export function useListSearchQuery(prjctIdx: number, request: ListSearchRequest,
|
|||||||
export function useListDetailQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
export function useListDetailQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: qk.listDetail(prjctIdx, sid),
|
queryKey: qk.listDetail(prjctIdx, sid),
|
||||||
queryFn: () => nextApi.get<ListSearchWithFullResult>(`/list/search-sid/${prjctIdx}/${sid}`),
|
queryFn: () => nextApi.get<ListSearchWithFullResult>(`/list/search-sid/${prjctIdx}/${encodeURIComponent(sid)}`),
|
||||||
enabled,
|
enabled,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: "always",
|
refetchOnMount: "always",
|
||||||
@@ -92,7 +92,7 @@ export function useListDetailQuery(prjctIdx: number, sid: string, enabled: boole
|
|||||||
export function useListEventHistoryQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
export function useListEventHistoryQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: qk.listEventHistory(prjctIdx, sid),
|
queryKey: qk.listEventHistory(prjctIdx, sid),
|
||||||
queryFn: () => nextApi.get<ListEventHistory[]>(`/list-hist/event/${prjctIdx}/${sid}`),
|
queryFn: () => nextApi.get<ListEventHistory[]>(`/list-hist/event/${prjctIdx}/${encodeURIComponent(sid)}`),
|
||||||
enabled,
|
enabled,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: "always",
|
refetchOnMount: "always",
|
||||||
@@ -103,7 +103,7 @@ export function useListEventHistoryQuery(prjctIdx: number, sid: string, enabled:
|
|||||||
export function useListUpdateHistoryQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
export function useListUpdateHistoryQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: qk.listUpdateHistory(prjctIdx, sid),
|
queryKey: qk.listUpdateHistory(prjctIdx, sid),
|
||||||
queryFn: () => nextApi.get<ListUpdateHistory[]>(`/list-hist/update/${prjctIdx}/${sid}`),
|
queryFn: () => nextApi.get<ListUpdateHistory[]>(`/list-hist/update/${prjctIdx}/${encodeURIComponent(sid)}`),
|
||||||
enabled,
|
enabled,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: "always",
|
refetchOnMount: "always",
|
||||||
@@ -114,7 +114,7 @@ export function useListUpdateHistoryQuery(prjctIdx: number, sid: string, enabled
|
|||||||
export function useListReserveBySidQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
export function useListReserveBySidQuery(prjctIdx: number, sid: string, enabled: boolean) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: qk.listReserveBySid(prjctIdx, sid),
|
queryKey: qk.listReserveBySid(prjctIdx, sid),
|
||||||
queryFn: () => nextApi.get<ListReserve[]>(`/reserve/sid/${prjctIdx}/${sid}`),
|
queryFn: () => nextApi.get<ListReserve[]>(`/reserve/sid/${prjctIdx}/${encodeURIComponent(sid)}`),
|
||||||
enabled,
|
enabled,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: "always",
|
refetchOnMount: "always",
|
||||||
@@ -154,7 +154,7 @@ export function useUploadListItemFileMutation(prjctIdx: number, sid: string) {
|
|||||||
mutationFn: ({ listHderId, file }: { listHderId: number; file: File }) => {
|
mutationFn: ({ listHderId, file }: { listHderId: number; file: File }) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append(String(listHderId), file);
|
formData.append(String(listHderId), file);
|
||||||
return nextApi.postForm<void>(`/list/item-file-upload/${prjctIdx}/${sid}`, formData);
|
return nextApi.postForm<void>(`/list/item-file-upload/${prjctIdx}/${encodeURIComponent(sid)}`, formData);
|
||||||
},
|
},
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
await queryClient.invalidateQueries({ queryKey: qk.listDetail(prjctIdx, sid) });
|
await queryClient.invalidateQueries({ queryKey: qk.listDetail(prjctIdx, sid) });
|
||||||
@@ -165,7 +165,7 @@ export function useUploadListItemFileMutation(prjctIdx: number, sid: string) {
|
|||||||
export function useDownloadListItemFileByHeaderMutation(prjctIdx: number, sid: string) {
|
export function useDownloadListItemFileByHeaderMutation(prjctIdx: number, sid: string) {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (listHderId: number) =>
|
mutationFn: (listHderId: number) =>
|
||||||
nextApi.get<ArrayBuffer>(`/list/item-file-download/${prjctIdx}/${sid}/${listHderId}`, {
|
nextApi.get<ArrayBuffer>(`/list/item-file-download/${prjctIdx}/${encodeURIComponent(sid)}/${listHderId}`, {
|
||||||
expectBinary: true,
|
expectBinary: true,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -194,7 +194,9 @@ export function useSendResultBySidQuery(
|
|||||||
queryKey: qk.sendResultBySid(sid, prjctCd, reqstSvc, channelTy),
|
queryKey: qk.sendResultBySid(sid, prjctCd, reqstSvc, channelTy),
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
const query = channelTy !== undefined ? `?channelTy=${channelTy}` : "";
|
const query = channelTy !== undefined ? `?channelTy=${channelTy}` : "";
|
||||||
return nextApi.get<SendResultInfo[]>(`/message-report/send-result/${sid}/${prjctCd}/${reqstSvc}${query}`);
|
return nextApi.get<SendResultInfo[]>(
|
||||||
|
`/message-report/send-result/${encodeURIComponent(sid)}/${prjctCd}/${reqstSvc}${query}`,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
enabled: enabled && !!sid && !!prjctCd && !!reqstSvc,
|
enabled: enabled && !!sid && !!prjctCd && !!reqstSvc,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ export type ExternalEventMeta = {
|
|||||||
export type ExternalEventBody = {
|
export type ExternalEventBody = {
|
||||||
action: ExternalActionCode;
|
action: ExternalActionCode;
|
||||||
prjctSurveyIdx: number;
|
prjctSurveyIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
meta: ExternalEventMeta;
|
meta: ExternalEventMeta;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ export type ListUploadHistory = {
|
|||||||
uploadMode: ListUploadMode;
|
uploadMode: ListUploadMode;
|
||||||
regUser: string;
|
regUser: string;
|
||||||
regDt: string;
|
regDt: string;
|
||||||
|
schedulingDelDt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ListUpdateRequest = {
|
export type ListUpdateRequest = {
|
||||||
@@ -216,7 +217,7 @@ export type ListEventInsertMeta = {
|
|||||||
|
|
||||||
export type ListEventInsertRequest = {
|
export type ListEventInsertRequest = {
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
resultCodeType: ResultCodeType;
|
resultCodeType: ResultCodeType;
|
||||||
resultCd: number;
|
resultCd: number;
|
||||||
listCallHistIdx?: number | null;
|
listCallHistIdx?: number | null;
|
||||||
@@ -228,7 +229,7 @@ export type ListEventHistory = {
|
|||||||
listEventHistIdx: number;
|
listEventHistIdx: number;
|
||||||
eventTy: ResultCodeType;
|
eventTy: ResultCodeType;
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
resultCd: number;
|
resultCd: number;
|
||||||
metaData?: string;
|
metaData?: string;
|
||||||
listCallHistIdx?: number;
|
listCallHistIdx?: number;
|
||||||
@@ -240,7 +241,7 @@ export type ListEventHistory = {
|
|||||||
export type ListUpdateHistory = {
|
export type ListUpdateHistory = {
|
||||||
listUpdateHistIdx: number;
|
listUpdateHistIdx: number;
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
listHderId: number;
|
listHderId: number;
|
||||||
beforeVal?: string;
|
beforeVal?: string;
|
||||||
afterVal?: string;
|
afterVal?: string;
|
||||||
@@ -251,7 +252,7 @@ export type ListUpdateHistory = {
|
|||||||
export type ListReserve = {
|
export type ListReserve = {
|
||||||
listResveIdx: number;
|
listResveIdx: number;
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
memo?: string;
|
memo?: string;
|
||||||
cnfirm: boolean;
|
cnfirm: boolean;
|
||||||
resveDt: string;
|
resveDt: string;
|
||||||
@@ -282,7 +283,7 @@ export type ListCallCloseRequest = ListCallStartRequest & {
|
|||||||
export type ListCallHist = ListCallCloseRequest & {
|
export type ListCallHist = ListCallCloseRequest & {
|
||||||
listCallHistIdx: number;
|
listCallHistIdx: number;
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
callStatus: 2 | 4 | 9;
|
callStatus: 2 | 4 | 9;
|
||||||
endDt?: string;
|
endDt?: string;
|
||||||
regUser: string;
|
regUser: string;
|
||||||
@@ -293,7 +294,7 @@ export type ListCallHistSession = ListCallHist;
|
|||||||
|
|
||||||
export type ListReserveRequest = {
|
export type ListReserveRequest = {
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
userId: string;
|
userId: string;
|
||||||
resveDt: string;
|
resveDt: string;
|
||||||
};
|
};
|
||||||
@@ -349,7 +350,7 @@ export type SurveyResult = {
|
|||||||
|
|
||||||
export type ListSearchBase = {
|
export type ListSearchBase = {
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: string;
|
||||||
use: ListIsUse;
|
use: ListIsUse;
|
||||||
assignList: Record<ListHeaderAssignType, string>;
|
assignList: Record<ListHeaderAssignType, string>;
|
||||||
memo: string;
|
memo: string;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export type MessageSendSingleRequest = {
|
|||||||
tmplatIdx: number;
|
tmplatIdx: number;
|
||||||
resve: boolean;
|
resve: boolean;
|
||||||
sendDt?: string;
|
sendDt?: string;
|
||||||
sid: number;
|
sid: string;
|
||||||
destHeaderIds: number[];
|
destHeaderIds: number[];
|
||||||
destNameHeaderId?: number;
|
destNameHeaderId?: number;
|
||||||
};
|
};
|
||||||
@@ -21,7 +21,7 @@ export type MessageSendBulkRequest = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type MessageFailedChunk = {
|
export type MessageFailedChunk = {
|
||||||
sidList?: number[];
|
sidList?: string[];
|
||||||
reason?: string;
|
reason?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user