261007_01_ENH: 카카오 알림톡 관련 내용 추가
This commit is contained in:
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);
|
||||
Reference in New Issue
Block a user