76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
import type {
|
|
MessageType,
|
|
SendCancelBulkRequest,
|
|
SendCancelSingleRequest,
|
|
Template,
|
|
TemplateKko,
|
|
TemplatePurpose,
|
|
TemplateSummary,
|
|
} from '@kri/common/noti-hub';
|
|
import type { ListFilter } from './list';
|
|
|
|
export type KkoSenderProfile = {
|
|
senderKey: string;
|
|
name: string;
|
|
uuid: string;
|
|
};
|
|
|
|
export type KkoTemplateWithProfile = TemplateKko & { senderKey?: string };
|
|
|
|
// 서버 조회 응답은 모든 채널의 템플릿에 tmplatPurpose를 내려준다. 화면 상태에서는 필수로 다룬다.
|
|
export type TemplateWithPurpose = (Exclude<Template, TemplateKko> | KkoTemplateWithProfile) & {
|
|
tmplatPurpose: TemplatePurpose;
|
|
};
|
|
|
|
/** 이메일·문자 템플릿 관리 화면(MessageTemplate) 상태. 알림톡은 별도 화면에서 다룬다. */
|
|
export type SmsEmailTemplateWithPurpose = Exclude<TemplateWithPurpose, { tmplatTy: MessageType.KKO }>;
|
|
|
|
export type TemplateSummaryWithPurpose = TemplateSummary & Required<Pick<TemplateSummary, 'tmplatPurpose'>>;
|
|
|
|
export type MessageSendChannel = 'sms' | 'email' | 'kko';
|
|
|
|
/** 조회 응답의 첨부파일명 목록(atchFl, 파이프 구분). 알림톡 템플릿에는 첨부가 없다. */
|
|
export const getTemplateAttachmentNames = (template: Template): string[] =>
|
|
'atchFl' in template && template.atchFl ? template.atchFl.split('|').filter(Boolean) : [];
|
|
|
|
/** 문자 미리보기에 표시할 첨부 이미지 (src는 data URL 또는 Object URL) */
|
|
export type TemplateAttachmentImage = {
|
|
fileName: string;
|
|
src: string;
|
|
};
|
|
|
|
export type PhoneVerificationSendData = {
|
|
verificationId: string;
|
|
expireDt: string;
|
|
};
|
|
|
|
export type SendSingleResponse = {
|
|
cmid: string;
|
|
/** 수신처를 여러 개 선택한 경우 마지막 발송 건의 식별자 */
|
|
sendIdx?: number;
|
|
data: Record<string, unknown>;
|
|
};
|
|
|
|
/** 예약 취소 요청. type으로 단건(/cancel/single)·벌크(/cancel/bulk) 경로를 구분한다. */
|
|
export type SendCancelRequest =
|
|
| ({ type: 'single' } & SendCancelSingleRequest)
|
|
| ({ type: 'bulk' } & SendCancelBulkRequest);
|
|
|
|
export type MessageSendSingleRequest = {
|
|
tmplatIdx: number;
|
|
resve: boolean;
|
|
sendDt?: string;
|
|
sid: string;
|
|
destHeaderIds: number[];
|
|
destNameHeaderId?: number;
|
|
};
|
|
|
|
export type MessageSendBulkRequest = {
|
|
tmplatIdx: number;
|
|
resve: boolean;
|
|
sendDt?: string;
|
|
listFilter: ListFilter;
|
|
destHeaderIds: number[];
|
|
destNameHeaderId?: number;
|
|
};
|