261007_01_ENH: 카카오 알림톡 관련 내용 추가
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export * from './noti-hub-types.js';
|
||||
export * from './noti-hub-types.js';
|
||||
export * from './kko-template.js';
|
||||
34
src/noti-hub/kko-template.ts
Normal file
34
src/noti-hub/kko-template.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { KkoTemplateDetail } from "./noti-hub-types.js";
|
||||
|
||||
const isEmptyExtra = (value: unknown): boolean => {
|
||||
if (value === null || value === undefined) return true;
|
||||
if (typeof value === "string") return value.trim() === "";
|
||||
if (Array.isArray(value)) return value.length === 0;
|
||||
if (typeof value === "object") return Object.keys(value).length === 0;
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 외부 알림톡 템플릿이 내부 저장 가능한 형태인지 미리 판단한다.
|
||||
* 승인(APR)·정상(A)·block/dormant 명시적 false·기본 텍스트형(BA/NONE)이며
|
||||
* 이미지·아이템·대표 링크·버튼·바로연결 등 추가 요소가 없어야 한다.
|
||||
* 화면 안내용 보조 판단이며 최종 판정은 서버(NotiHub)가 한다.
|
||||
*/
|
||||
export const isKkoTemplateSavable = (detail: KkoTemplateDetail): boolean =>
|
||||
detail.inspectionStatus === "APR" &&
|
||||
detail.status === "A" &&
|
||||
detail.block === false &&
|
||||
detail.dormant === false &&
|
||||
detail.templateMessageType === "BA" &&
|
||||
detail.templateEmphasizeType === "NONE" &&
|
||||
[
|
||||
detail.templateExtra,
|
||||
detail.templateImageName,
|
||||
detail.templateImageUrl,
|
||||
detail.templateHeader,
|
||||
detail.templateItemHighlight,
|
||||
detail.templateItem,
|
||||
detail.templateRepresentLink,
|
||||
detail.buttons,
|
||||
detail.quickReplies,
|
||||
].every(isEmptyExtra);
|
||||
@@ -3,12 +3,19 @@ import type { FileResponse, PageRequest, PageResponse } from "../types.js";
|
||||
export enum MessageType {
|
||||
EMAIL = 11,
|
||||
SMS = 21,
|
||||
LMS_MMS = 22
|
||||
LMS_MMS = 22,
|
||||
KKO = 31
|
||||
}
|
||||
|
||||
export enum ChannelType{
|
||||
EMAIL = 1,
|
||||
SMS = 2
|
||||
SMS = 2,
|
||||
KKO = 3
|
||||
}
|
||||
|
||||
export enum TemplatePurpose {
|
||||
NORMAL = 0,
|
||||
PHONE_VERIFICATION = 1
|
||||
}
|
||||
|
||||
export const SMS_TYPE_ARRAY = [MessageType.SMS, MessageType.LMS_MMS] as const;
|
||||
@@ -17,6 +24,7 @@ export type SmsType = typeof SMS_TYPE_ARRAY[number];
|
||||
export type TemplateSummary = {
|
||||
tmplatIdx: number;
|
||||
tmplatNm: string;
|
||||
tmplatPurpose?: TemplatePurpose;
|
||||
}
|
||||
|
||||
export type TemplateBasic = {
|
||||
@@ -29,17 +37,86 @@ export type TemplateBasic = {
|
||||
|
||||
export type TemplateSms = TemplateBasic & {
|
||||
tmplatTy: SmsType;
|
||||
tmplatPurpose?: TemplatePurpose;
|
||||
tmplatTitle?: string;
|
||||
sendTel: string;
|
||||
/** 조회 응답 전용. 파이프(|)로 구분한 첨부파일명 목록 */
|
||||
atchFl?: string;
|
||||
}
|
||||
|
||||
export type TemplateEmail = TemplateBasic & {
|
||||
tmplatTy: MessageType.EMAIL;
|
||||
tmplatTitle: string;
|
||||
sendEml: string;
|
||||
/** 조회 응답 전용. 파이프(|)로 구분한 첨부파일명 목록 */
|
||||
atchFl?: string;
|
||||
}
|
||||
|
||||
export type Template = TemplateSms | TemplateEmail;
|
||||
/** 알림톡 템플릿. 본문은 서버가 외부 템플릿을 조회해 채우므로 요청에서는 tmplatBody, tmplatTitle을 생략한다. */
|
||||
export type TemplateKko = {
|
||||
tmplatIdx?: number;
|
||||
itrntPrjctCd: string;
|
||||
tmplatTy: MessageType.KKO;
|
||||
/** 현재 알림톡은 NORMAL(0)만 지원한다. */
|
||||
tmplatPurpose?: TemplatePurpose;
|
||||
tmplatNm: string;
|
||||
sendNm: string;
|
||||
sendTel: string;
|
||||
kkoTmplatCd: string;
|
||||
/** 생략하거나 공백이면 서버에서 82를 사용한다. */
|
||||
nationCd?: string;
|
||||
tmplatBody?: string;
|
||||
tmplatTitle?: string;
|
||||
};
|
||||
|
||||
export type Template = TemplateSms | TemplateEmail | TemplateKko;
|
||||
|
||||
export type KkoTemplateListRequest = {
|
||||
keyword?: string;
|
||||
};
|
||||
|
||||
export type KkoTemplateSummary = {
|
||||
templateCode: string;
|
||||
templateName: string;
|
||||
serviceStatus: string | null;
|
||||
createdAt: string | null;
|
||||
modifiedAt: string | null;
|
||||
};
|
||||
|
||||
export type KkoTemplateListResponse = {
|
||||
totalCount: number;
|
||||
totalPage: number;
|
||||
currentPage: number;
|
||||
list: KkoTemplateSummary[];
|
||||
};
|
||||
|
||||
export type KkoTemplateDetailRequest = {
|
||||
templateCode: string;
|
||||
};
|
||||
|
||||
export type KkoTemplateDetail = {
|
||||
templateCode: string;
|
||||
templateName: string;
|
||||
templateContent: string;
|
||||
templatePreviewMessage: string | null;
|
||||
templateMessageType: string | null;
|
||||
templateEmphasizeType: string | null;
|
||||
inspectionStatus: string | null;
|
||||
status: string | null;
|
||||
block: boolean | null;
|
||||
dormant: boolean | null;
|
||||
templateExtra: string | null;
|
||||
templateImageName: string | null;
|
||||
templateImageUrl: string | null;
|
||||
templateTitle: string | null;
|
||||
templateSubtitle: string | null;
|
||||
templateHeader: string | null;
|
||||
templateItemHighlight: unknown | null;
|
||||
templateItem: unknown | null;
|
||||
templateRepresentLink: unknown | null;
|
||||
buttons: unknown[] | null;
|
||||
quickReplies: unknown[] | null;
|
||||
};
|
||||
|
||||
export type BulkSendCreateRequest = {
|
||||
reqstCmpn: string;
|
||||
@@ -75,6 +152,23 @@ export type BulkSendResponse = {
|
||||
failCount: number;
|
||||
};
|
||||
|
||||
export type BulkSendFailedChunk = {
|
||||
chunkIndex: number;
|
||||
from: number;
|
||||
to: number;
|
||||
targetCount: number;
|
||||
errorMessage: string | null;
|
||||
};
|
||||
|
||||
export type BulkSendResult = {
|
||||
bulkSendKey?: string;
|
||||
targetCount: number;
|
||||
requestCount: number;
|
||||
acceptCount: number;
|
||||
failCount: number;
|
||||
failedChunks?: BulkSendFailedChunk[];
|
||||
};
|
||||
|
||||
export type SendResultSummaryRequest = {
|
||||
bulkSendKey?: string;
|
||||
itrntPrjctCd?: string;
|
||||
@@ -141,3 +235,30 @@ export type SendInfo = {
|
||||
regUser: string;
|
||||
regDt: string;
|
||||
};
|
||||
|
||||
export type SendResultInfo = {
|
||||
cmid: string;
|
||||
bulkSendKey?: string;
|
||||
/** MessageType 코드 */
|
||||
sendTy: number;
|
||||
itrntPrjctCd: string;
|
||||
reqstSvc: string;
|
||||
prjctCd: string;
|
||||
sid: string;
|
||||
resve: boolean;
|
||||
resultCode: number;
|
||||
resultLabel?: string;
|
||||
resultViewLabel?: string;
|
||||
tmplatIdx?: number;
|
||||
kkoTmplatCd?: string;
|
||||
sendEml?: string;
|
||||
sendTel?: string;
|
||||
sendNm?: string;
|
||||
sendDt: string;
|
||||
destEml?: string;
|
||||
destNm?: string;
|
||||
destTel?: string;
|
||||
regCmpn: string;
|
||||
regUser: string;
|
||||
regDt: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user