260716_02_ENH: 프로젝트에 발신 번호추가 및 리다이렉트 url, api 수정
This commit is contained in:
@@ -130,6 +130,8 @@ const ListContactPageContent = () => {
|
|||||||
listHeaders={listHeaders}
|
listHeaders={listHeaders}
|
||||||
detail={listDetailQuery.data}
|
detail={listDetailQuery.data}
|
||||||
surveyUrl={projectInfoQuery.data?.surveyUrl}
|
surveyUrl={projectInfoQuery.data?.surveyUrl}
|
||||||
|
callerTelNum={projectInfoQuery.data?.callerTelNum}
|
||||||
|
resultCodes={resultCodeArray}
|
||||||
formValues={formValues}
|
formValues={formValues}
|
||||||
onFieldChange={handleFieldChange}
|
onFieldChange={handleFieldChange}
|
||||||
onSaved={() => listDetailQuery.refetch()}
|
onSaved={() => listDetailQuery.refetch()}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ import {
|
|||||||
useUploadScenarioImageMutation, useKartProjectListQuery,
|
useUploadScenarioImageMutation, useKartProjectListQuery,
|
||||||
} from "@/query/project";
|
} from "@/query/project";
|
||||||
import { useCmpnListQuery } from "@/query/cmpn";
|
import { useCmpnListQuery } from "@/query/cmpn";
|
||||||
|
import { useCallerTelNumListQuery } from "@/query/intranet";
|
||||||
|
import { formatKoreanPhoneNumber } from "@/utils/phone";
|
||||||
|
|
||||||
const defaultProjectInfo: ProjectInfo = {
|
const defaultProjectInfo: ProjectInfo = {
|
||||||
prjctIdx: 0,
|
prjctIdx: 0,
|
||||||
@@ -48,6 +50,7 @@ const defaultProjectInfo: ProjectInfo = {
|
|||||||
prjctStatus: ProjectStatus.WAITING,
|
prjctStatus: ProjectStatus.WAITING,
|
||||||
ownerDept: '',
|
ownerDept: '',
|
||||||
ownerFw: '',
|
ownerFw: '',
|
||||||
|
callerTelNum: '',
|
||||||
surveyTy: SurveyType.NONE,
|
surveyTy: SurveyType.NONE,
|
||||||
surveyPrjctCd: '',
|
surveyPrjctCd: '',
|
||||||
surveyUrl: '',
|
surveyUrl: '',
|
||||||
@@ -61,21 +64,22 @@ const defaultProjectInfo: ProjectInfo = {
|
|||||||
|
|
||||||
type ExternalTab = 'redirect' | 'api'
|
type ExternalTab = 'redirect' | 'api'
|
||||||
|
|
||||||
const baseUrl = 'https://kcont.kric.com'
|
const baseUrl = 'https://contact.kric.com'
|
||||||
const sidParam = 'sid=[$SID]'
|
const sidParam = 'sid=[$SID]'
|
||||||
|
const externalPidParamBase = 'contact-pid=[$prjctIdx]'
|
||||||
|
const internalPidParamBase = 'pid=[$prjctIdx]'
|
||||||
|
|
||||||
const externalUrls = {
|
const externalUrls = {
|
||||||
redirect: {
|
redirect: {
|
||||||
start: `${baseUrl}/redirect/start?${sidParam}`,
|
complete: `${baseUrl}/redirect/complete?${internalPidParamBase}&${sidParam}`,
|
||||||
complete: `${baseUrl}/redirect/complete?${sidParam}`,
|
screen: `${baseUrl}/redirect/screen?${internalPidParamBase}&${sidParam}`,
|
||||||
screen: `${baseUrl}/redirect/screen?${sidParam}`,
|
quota: `${baseUrl}/redirect/quota?${internalPidParamBase}&${sidParam}`,
|
||||||
quota: `${baseUrl}/redirect/quota?${sidParam}`,
|
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
start: `${baseUrl}/api/external/start?${sidParam}`,
|
start: `${baseUrl}/api/external/start?${internalPidParamBase}&${sidParam}`,
|
||||||
complete: `${baseUrl}/api/external/complete?${sidParam}`,
|
complete: `${baseUrl}/api/external/complete?${internalPidParamBase}&${sidParam}`,
|
||||||
screen: `${baseUrl}/api/external/screen?${sidParam}`,
|
screen: `${baseUrl}/api/external/screen?${internalPidParamBase}&${sidParam}`,
|
||||||
quota: `${baseUrl}/api/external/quota?${sidParam}`,
|
quota: `${baseUrl}/api/external/quota?${internalPidParamBase}&${sidParam}`,
|
||||||
},
|
},
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
@@ -111,6 +115,7 @@ const ProjectInfoPage = () => {
|
|||||||
const resultCodesQuery = useResultCodesQuery(prjctIdx, enabled);
|
const resultCodesQuery = useResultCodesQuery(prjctIdx, enabled);
|
||||||
const cmpnListQuery = useCmpnListQuery();
|
const cmpnListQuery = useCmpnListQuery();
|
||||||
const assignedCmpnQuery = useAssignedCmpnIdsQuery(prjctIdx, enabled);
|
const assignedCmpnQuery = useAssignedCmpnIdsQuery(prjctIdx, enabled);
|
||||||
|
const callerTelNumListQuery = useCallerTelNumListQuery(mounted);
|
||||||
|
|
||||||
const kartEnabled =
|
const kartEnabled =
|
||||||
mounted &&
|
mounted &&
|
||||||
@@ -144,6 +149,7 @@ const ProjectInfoPage = () => {
|
|||||||
|
|
||||||
|
|
||||||
const surveyProjectArray = kartProjectListQuery.data ?? [];
|
const surveyProjectArray = kartProjectListQuery.data ?? [];
|
||||||
|
const callerTelNumArray = callerTelNumListQuery.data ?? [];
|
||||||
|
|
||||||
const deptArray = useMemo(() => {
|
const deptArray = useMemo(() => {
|
||||||
const teams = Array.from(new Set((users ?? []).map((u) => u.userTeam).filter(Boolean)));
|
const teams = Array.from(new Set((users ?? []).map((u) => u.userTeam).filter(Boolean)));
|
||||||
@@ -245,7 +251,8 @@ const ProjectInfoPage = () => {
|
|||||||
const next = {...prev, surveyPrjctCd: value};
|
const next = {...prev, surveyPrjctCd: value};
|
||||||
|
|
||||||
if (value && internalSurvey.has(prev.surveyTy || SurveyType.NONE)) {
|
if (value && internalSurvey.has(prev.surveyTy || SurveyType.NONE)) {
|
||||||
let surveyUrl = `/project/${value}/INDEX.asp?${sidParam}`;
|
const pidParam = externalPidParamBase.replace('[$prjctIdx]', String(prev.prjctIdx));
|
||||||
|
let surveyUrl = `/project/${value}/INDEX.asp?${pidParam}&${sidParam}`;
|
||||||
if (prev.surveyTy === SurveyType.KON) {
|
if (prev.surveyTy === SurveyType.KON) {
|
||||||
surveyUrl = `https://kon.kric.com` + surveyUrl
|
surveyUrl = `https://kon.kric.com` + surveyUrl
|
||||||
} else if (prev.surveyTy === SurveyType.KIWI) {
|
} else if (prev.surveyTy === SurveyType.KIWI) {
|
||||||
@@ -275,6 +282,8 @@ const ProjectInfoPage = () => {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const replacePrjctIdx = (url: string) => url.replace('[$prjctIdx]', String(projectInfo.prjctIdx));
|
||||||
|
|
||||||
if (!mounted) return <LoadingOverlayAdapter force />
|
if (!mounted) return <LoadingOverlayAdapter force />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -331,7 +340,7 @@ const ProjectInfoPage = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-3 gap-4">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label className="text-base">담당 그룹</Label>
|
<Label className="text-base">담당 그룹</Label>
|
||||||
<KriSingleSelect
|
<KriSingleSelect
|
||||||
@@ -357,6 +366,20 @@ const ProjectInfoPage = () => {
|
|||||||
widthClassName="w-full"
|
widthClassName="w-full"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label className="text-base">발신 번호</Label>
|
||||||
|
<KriSingleSelect
|
||||||
|
items={callerTelNumArray}
|
||||||
|
value={projectInfo.callerTelNum || ''}
|
||||||
|
onChange={(value) => handleChange('callerTelNum', value)}
|
||||||
|
getValue={(item) => item.telNum}
|
||||||
|
getLabel={(item) => formatKoreanPhoneNumber(item.telNum)}
|
||||||
|
placeholder="발신 번호를 선택하세요"
|
||||||
|
heightClassName="h-9"
|
||||||
|
widthClassName="w-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -451,21 +474,17 @@ const ProjectInfoPage = () => {
|
|||||||
<div className="font-semibold">리다이렉트 URL</div>
|
<div className="font-semibold">리다이렉트 URL</div>
|
||||||
|
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Label className="w-24 text-base">시작:</Label>
|
|
||||||
<Input value={externalUrls.redirect.start} disabled className="bg-white h-9" />
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">완료:</Label>
|
<Label className="w-24 text-base">완료:</Label>
|
||||||
<Input value={externalUrls.redirect.complete} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.redirect.complete)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">스크린 아웃:</Label>
|
<Label className="w-24 text-base">스크린 아웃:</Label>
|
||||||
<Input value={externalUrls.redirect.screen} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.redirect.screen)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">쿼터 풀:</Label>
|
<Label className="w-24 text-base">쿼터 풀:</Label>
|
||||||
<Input value={externalUrls.redirect.quota} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.redirect.quota)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -478,19 +497,19 @@ const ProjectInfoPage = () => {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">시작 API:</Label>
|
<Label className="w-24 text-base">시작 API:</Label>
|
||||||
<Input value={externalUrls.api.start} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.api.start)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">완료 API:</Label>
|
<Label className="w-24 text-base">완료 API:</Label>
|
||||||
<Input value={externalUrls.api.complete} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.api.complete)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">스크린 API:</Label>
|
<Label className="w-24 text-base">스크린 API:</Label>
|
||||||
<Input value={externalUrls.api.screen} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.api.screen)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-24 text-base">쿼터 API:</Label>
|
<Label className="w-24 text-base">쿼터 API:</Label>
|
||||||
<Input value={externalUrls.api.quota} disabled className="bg-white h-9" />
|
<Input value={replacePrjctIdx(externalUrls.api.quota)} readOnly className="bg-white h-9" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
16
src/app/api/external/[[...slug]]/route.ts
vendored
16
src/app/api/external/[[...slug]]/route.ts
vendored
@@ -6,8 +6,9 @@ import { errorToResponse } from "@kri/common/http";
|
|||||||
import { getClientIp } from "@kri/common/server";
|
import { getClientIp } from "@kri/common/server";
|
||||||
import {
|
import {
|
||||||
EXTERNAL_ACTION_CODE_BY_SLUG,
|
EXTERNAL_ACTION_CODE_BY_SLUG,
|
||||||
|
EXTERNAL_ENTRY_TYPE_CODE,
|
||||||
ExternalAction,
|
ExternalAction,
|
||||||
ExternalEntryType,
|
ExternalEntryTypeCode,
|
||||||
ExternalEventBody,
|
ExternalEventBody,
|
||||||
} from "@/types/external";
|
} from "@/types/external";
|
||||||
import {createContactApi} from "@/lib/http-server";
|
import {createContactApi} from "@/lib/http-server";
|
||||||
@@ -17,8 +18,10 @@ const getHeader = (headers: Headers, name: string): string | null => {
|
|||||||
return value && value.trim().length > 0 ? value : null;
|
return value && value.trim().length > 0 ? value : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getEntryType = (headers: Headers): ExternalEntryType => {
|
const getEntryTypeCode = (headers: Headers): ExternalEntryTypeCode => {
|
||||||
return getHeader(headers, "x-entry-type") === "redirect" ? "redirect" : "api";
|
return getHeader(headers, "x-entry-type") === "redirect"
|
||||||
|
? EXTERNAL_ENTRY_TYPE_CODE.redirect
|
||||||
|
: EXTERNAL_ENTRY_TYPE_CODE.api;
|
||||||
};
|
};
|
||||||
|
|
||||||
const toExternalAction = (value: string): ExternalAction | null => {
|
const toExternalAction = (value: string): ExternalAction | null => {
|
||||||
@@ -41,13 +44,12 @@ const buildExternalEventBody = (
|
|||||||
const actionCode = EXTERNAL_ACTION_CODE_BY_SLUG[action];
|
const actionCode = EXTERNAL_ACTION_CODE_BY_SLUG[action];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
actionCode,
|
action: actionCode,
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
sid,
|
sid,
|
||||||
meta: {
|
meta: {
|
||||||
entryType: getEntryType(h),
|
entryType: getEntryTypeCode(h),
|
||||||
action,
|
action: actionCode,
|
||||||
actionCode,
|
|
||||||
pid: String(prjctIdx),
|
pid: String(prjctIdx),
|
||||||
sid: String(sid),
|
sid: String(sid),
|
||||||
remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req),
|
remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {NextRequest, NextResponse} from "next/server";
|
import {NextRequest, NextResponse} from "next/server";
|
||||||
import {RouteContext} from "@/types/common";
|
import {RouteContext} from "@/types/common";
|
||||||
import {createIntranetApi} from "@/lib/http-server";
|
import {createIntranetApi} from "@/lib/http-server";
|
||||||
import {IntranetProjectSearchResponse} from "@/types/project";
|
import {CallerTelNumInfo, IntranetProjectSearchResponse} from "@/types/project";
|
||||||
import {errorToResponse} from "@kri/common/http";
|
import {errorToResponse} from "@kri/common/http";
|
||||||
import {ItrntUserInfo} from "@/types/user";
|
import {ItrntUserInfo} from "@/types/user";
|
||||||
|
|
||||||
@@ -28,6 +28,12 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
|||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(action === "caller-tel-num"){
|
||||||
|
const result = await itrntApi.get<CallerTelNumInfo[]>(`/telnum/caller`);
|
||||||
|
|
||||||
|
return NextResponse.json(result, { status: 200 });
|
||||||
|
}
|
||||||
|
|
||||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
return errorToResponse(error);
|
return errorToResponse(error);
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { useUploadListItemFileMutation } from '@/query/list'
|
|||||||
import { ListHeaderConst } from '@/const/listConst'
|
import { ListHeaderConst } from '@/const/listConst'
|
||||||
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 ResultCode, ResultCodeType } from '@/types/project'
|
||||||
|
import { formatKst } from '@kri/common'
|
||||||
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
|
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
|
||||||
import { substituteSurveyUrl } from '@/lib/surveyUrl'
|
import { substituteSurveyUrl } from '@/lib/surveyUrl'
|
||||||
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
|
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
|
||||||
@@ -30,6 +32,8 @@ export type ListContactInfoPanelProps = {
|
|||||||
listHeaders: listHeader[]
|
listHeaders: listHeader[]
|
||||||
detail?: ListSearchWithFullResult
|
detail?: ListSearchWithFullResult
|
||||||
surveyUrl?: string
|
surveyUrl?: string
|
||||||
|
callerTelNum?: string
|
||||||
|
resultCodes: ResultCode[]
|
||||||
formValues: Record<number, string>
|
formValues: Record<number, string>
|
||||||
onFieldChange: (listHderId: number, value: string) => void
|
onFieldChange: (listHderId: number, value: string) => void
|
||||||
onSaved?: () => void
|
onSaved?: () => void
|
||||||
@@ -69,6 +73,8 @@ const ListContactInfoPanel = ({
|
|||||||
listHeaders,
|
listHeaders,
|
||||||
detail,
|
detail,
|
||||||
surveyUrl,
|
surveyUrl,
|
||||||
|
callerTelNum,
|
||||||
|
resultCodes,
|
||||||
formValues,
|
formValues,
|
||||||
onFieldChange,
|
onFieldChange,
|
||||||
onSaved,
|
onSaved,
|
||||||
@@ -88,7 +94,12 @@ const ListContactInfoPanel = ({
|
|||||||
.sort((a, b) => a.listHderOrder - b.listHderOrder)
|
.sort((a, b) => a.listHderOrder - b.listHderOrder)
|
||||||
|
|
||||||
const substitutedSurveyUrl = surveyUrl ? substituteSurveyUrl(surveyUrl, sid) : ''
|
const substitutedSurveyUrl = surveyUrl ? substituteSurveyUrl(surveyUrl, sid) : ''
|
||||||
const hasSurveyResponse = detail?.surveyResult?.lastResultCd !== undefined
|
const surveyResult = detail?.surveyResult
|
||||||
|
const hasSurveyResponse = surveyResult?.lastResultCd !== undefined
|
||||||
|
const surveyResultLabel = hasSurveyResponse
|
||||||
|
? resultCodes.find((rc) => rc.resultCdTy === ResultCodeType.SURVEY && rc.resultCd === surveyResult?.lastResultCd)
|
||||||
|
?.resultCdLbl ?? String(surveyResult?.lastResultCd)
|
||||||
|
: ''
|
||||||
|
|
||||||
const handleStartSurvey = () => {
|
const handleStartSurvey = () => {
|
||||||
if (!substitutedSurveyUrl) return
|
if (!substitutedSurveyUrl) return
|
||||||
@@ -102,7 +113,7 @@ const ListContactInfoPanel = ({
|
|||||||
|
|
||||||
const handleCall = (telNum: string, listHderId: number) => {
|
const handleCall = (telNum: string, listHderId: number) => {
|
||||||
if (!telNum || !isCtiReady || isOnCall) return
|
if (!telNum || !isCtiReady || isOnCall) return
|
||||||
ctiClient.makeCall({ dialNumber: telNum, prjctIdx, sid: Number(sid), listHderId })
|
ctiClient.makeCall({ dialNumber: telNum, prjctIdx, sid: Number(sid), listHderId, aniNumber: callerTelNum ?? '' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePickFile = (listHderId: number) => {
|
const handlePickFile = (listHderId: number) => {
|
||||||
@@ -265,7 +276,16 @@ const ListContactInfoPanel = ({
|
|||||||
<QrCode className="h-4 w-4" />
|
<QrCode className="h-4 w-4" />
|
||||||
QR
|
QR
|
||||||
</Button>
|
</Button>
|
||||||
{!hasSurveyResponse && <span className="text-sm text-muted-foreground">[응답없음]</span>}
|
{hasSurveyResponse ? (
|
||||||
|
<span className="text-sm">
|
||||||
|
[{surveyResultLabel}]{' '}
|
||||||
|
<span className="text-muted-foreground">
|
||||||
|
({formatKst(surveyResult?.lastResultDt ?? '', 'dateHourMin')})
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="text-sm text-muted-foreground">[응답없음]</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -57,6 +57,21 @@ const getResultColumns = (resultCodeArray: ResultCode[]): DataTableColumn<ListTa
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatSurveyResult = (result?: ListResultBase) => {
|
||||||
|
const lastResultCd = result?.lastResultCd;
|
||||||
|
if (lastResultCd === undefined) return "";
|
||||||
|
|
||||||
|
const label = getResultLabel(ResultCodeType.SURVEY, result);
|
||||||
|
const dt = `(${formatKst(result?.lastResultDt ?? "", "dateHourMin")})`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="leading-tight">
|
||||||
|
<div>{label}</div>
|
||||||
|
<div>{dt}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const columns: DataTableColumn<ListTableRow>[] = [
|
const columns: DataTableColumn<ListTableRow>[] = [
|
||||||
{
|
{
|
||||||
@@ -90,7 +105,8 @@ const getResultColumns = (resultCodeArray: ResultCode[]): DataTableColumn<ListTa
|
|||||||
{
|
{
|
||||||
id: "surveyStatus",
|
id: "surveyStatus",
|
||||||
header: "설문 진행 상태",
|
header: "설문 진행 상태",
|
||||||
accessorFn: (row) => getResultLabel(ResultCodeType.SURVEY, row.surveyResult as ListResultBase | undefined),
|
cell: ({ row }) =>
|
||||||
|
formatSurveyResult(row.original.surveyResult as ListResultBase | undefined),
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export type CtiMakeCallParams = {
|
|||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: number;
|
||||||
listHderId: number;
|
listHderId: number;
|
||||||
|
aniNumber: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CtiConnectionState = "idle" | "connecting" | "open" | "closed";
|
export type CtiConnectionState = "idle" | "connecting" | "open" | "closed";
|
||||||
@@ -260,7 +261,7 @@ export const ctiClient = {
|
|||||||
ZCommand: "MakeCall",
|
ZCommand: "MakeCall",
|
||||||
AgentLoginID: currentAgentLoginId,
|
AgentLoginID: currentAgentLoginId,
|
||||||
DialNumber: params.dialNumber,
|
DialNumber: params.dialNumber,
|
||||||
ANINumber: currentLoginParams.aniNumber,
|
ANINumber: params.aniNumber,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
hangup: requireAgent((agentLoginId) => {
|
hangup: requireAgent((agentLoginId) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {keepPreviousData, useQuery} from "@tanstack/react-query";
|
|||||||
import {qk} from "@/query/key/keys";
|
import {qk} from "@/query/key/keys";
|
||||||
import {nextApi} from "@/lib/http-client";
|
import {nextApi} from "@/lib/http-client";
|
||||||
import {ItrntUserInfo} from "@/types/user";
|
import {ItrntUserInfo} from "@/types/user";
|
||||||
import {IntranetProjectSearchResponse, KonKiwiProjectInfo} from "@/types/project";
|
import {CallerTelNumInfo, IntranetProjectSearchResponse, KonKiwiProjectInfo} from "@/types/project";
|
||||||
|
|
||||||
export function useIntranetProjectListQuery(keyword: string, enabled: boolean) {
|
export function useIntranetProjectListQuery(keyword: string, enabled: boolean) {
|
||||||
const kw = keyword.trim();
|
const kw = keyword.trim();
|
||||||
@@ -35,3 +35,12 @@ export function useIntranetUsersQuery(opts?: {
|
|||||||
initialData: opts?.initialData,
|
initialData: opts?.initialData,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useCallerTelNumListQuery(enabled: boolean) {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: qk.callerTelNumList(),
|
||||||
|
queryFn: () => nextApi.get<CallerTelNumInfo[]>("/intranet/caller-tel-num"),
|
||||||
|
enabled,
|
||||||
|
staleTime: 60_000,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ export const qk = {
|
|||||||
/********** 인트라넷 관련 **********/
|
/********** 인트라넷 관련 **********/
|
||||||
intranetProjectList: (keyword: string) => ["intranet", "project-list", keyword] as const,
|
intranetProjectList: (keyword: string) => ["intranet", "project-list", keyword] as const,
|
||||||
intranetUsers: () => ["intranet", "user-list"] as const,
|
intranetUsers: () => ["intranet", "user-list"] as const,
|
||||||
|
callerTelNumList: () => ["intranet", "caller-tel-num"] as const,
|
||||||
/********** 인트라넷 관련 **********/
|
/********** 인트라넷 관련 **********/
|
||||||
|
|
||||||
/********** 리스트 관련 **********/
|
/********** 리스트 관련 **********/
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ export function useListDetailQuery(prjctIdx: number, sid: string, enabled: boole
|
|||||||
enabled,
|
enabled,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
refetchOnMount: "always",
|
refetchOnMount: "always",
|
||||||
|
// 조사 시작으로 새 창이 뜬 뒤 응답을 마치고 이 탭으로 돌아왔을 때 최신 상태(설문 응답 등)를 바로 보여주기 위함.
|
||||||
|
refetchOnWindowFocus: true,
|
||||||
meta: { ignoreGlobalLoading: true },
|
meta: { ignoreGlobalLoading: true },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { ExternalActionCode } from "@/types/project";
|
import { ExternalActionCode } from "@/types/project";
|
||||||
|
|
||||||
export type ExternalEntryType = "redirect" | "api";
|
export const EXTERNAL_ENTRY_TYPE_CODE = {
|
||||||
|
redirect: 10,
|
||||||
|
api: 20,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ExternalEntryType = keyof typeof EXTERNAL_ENTRY_TYPE_CODE;
|
||||||
|
export type ExternalEntryTypeCode = (typeof EXTERNAL_ENTRY_TYPE_CODE)[ExternalEntryType];
|
||||||
|
|
||||||
export const EXTERNAL_ACTION_CODE_BY_SLUG = {
|
export const EXTERNAL_ACTION_CODE_BY_SLUG = {
|
||||||
start: ExternalActionCode.START,
|
start: ExternalActionCode.START,
|
||||||
@@ -12,9 +18,8 @@ export const EXTERNAL_ACTION_CODE_BY_SLUG = {
|
|||||||
export type ExternalAction = keyof typeof EXTERNAL_ACTION_CODE_BY_SLUG;
|
export type ExternalAction = keyof typeof EXTERNAL_ACTION_CODE_BY_SLUG;
|
||||||
|
|
||||||
export type ExternalEventMeta = {
|
export type ExternalEventMeta = {
|
||||||
entryType: ExternalEntryType;
|
entryType: ExternalEntryTypeCode;
|
||||||
action: ExternalAction;
|
action: ExternalActionCode;
|
||||||
actionCode: ExternalActionCode;
|
|
||||||
pid: string;
|
pid: string;
|
||||||
sid: string;
|
sid: string;
|
||||||
remoteAddr: string | null;
|
remoteAddr: string | null;
|
||||||
@@ -28,7 +33,7 @@ export type ExternalEventMeta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type ExternalEventBody = {
|
export type ExternalEventBody = {
|
||||||
actionCode: ExternalActionCode;
|
action: ExternalActionCode;
|
||||||
prjctIdx: number;
|
prjctIdx: number;
|
||||||
sid: number;
|
sid: number;
|
||||||
meta: ExternalEventMeta;
|
meta: ExternalEventMeta;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export type ProjectInfo = {
|
|||||||
itrntPrjctCd: string;
|
itrntPrjctCd: string;
|
||||||
ownerDept: string;
|
ownerDept: string;
|
||||||
ownerFw: string;
|
ownerFw: string;
|
||||||
|
callerTelNum: string;
|
||||||
surveyTy: SurveyType;
|
surveyTy: SurveyType;
|
||||||
surveyPrjctCd?: string;
|
surveyPrjctCd?: string;
|
||||||
surveyUrl?: string;
|
surveyUrl?: string;
|
||||||
@@ -99,6 +100,12 @@ export type KonKiwiProjectInfo = {
|
|||||||
createDate:string;
|
createDate:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CallerTelNumInfo = {
|
||||||
|
telNum: string;
|
||||||
|
regDt: string;
|
||||||
|
userCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type ResultCode = {
|
export type ResultCode = {
|
||||||
resultCdUUID: string;
|
resultCdUUID: string;
|
||||||
prjctIdx:number;
|
prjctIdx:number;
|
||||||
|
|||||||
22
src/utils/phone.ts
Normal file
22
src/utils/phone.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// 특수/대표번호(15XX, 16XX, 18XX 등): 지역번호 없이 4자리-4자리
|
||||||
|
const SPECIAL_NUMBER_PREFIX = /^(15|16|18)\d{2}/;
|
||||||
|
|
||||||
|
export const formatKoreanPhoneNumber = (value: string): string => {
|
||||||
|
const digits = value.replace(/\D/g, "");
|
||||||
|
|
||||||
|
if (SPECIAL_NUMBER_PREFIX.test(digits) && digits.length === 8) {
|
||||||
|
return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (digits.startsWith("02")) {
|
||||||
|
if (digits.length === 9) return `${digits.slice(0, 2)}-${digits.slice(2, 5)}-${digits.slice(5)}`;
|
||||||
|
if (digits.length === 10) return `${digits.slice(0, 2)}-${digits.slice(2, 6)}-${digits.slice(6)}`;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 010/011~019(휴대폰), 070(인터넷전화), 031~064(지역번호) 등 3자리 국번
|
||||||
|
if (digits.length === 10) return `${digits.slice(0, 3)}-${digits.slice(3, 6)}-${digits.slice(6)}`;
|
||||||
|
if (digits.length === 11) return `${digits.slice(0, 3)}-${digits.slice(3, 7)}-${digits.slice(7)}`;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user