/** * 상세설명 블록 에디터 — 스키마·앞단 검증·공용 블록/템플릿 도구. * * 서버 계약(bootservice/admin/internal-api): * - Const::FORM_TYPE_BLOCK(4) 일 때만 apply_content_blocks! 가 동작한다. 4 가 아니면 블록은 조용히 무시된다. * - cob(content_blocks)가 편집 원본, co(content)는 서버가 컴파일한 HTML 산출물이다(dual-write). * MCP 는 블록 JSON 만 보내고 HTML 컴파일은 서버(Product::ContentBlock)에 맡긴다 — 세 번째 컴파일러를 만들지 않는다. * - data[:content_blocks] 가 nil 이면 서버가 기존 블록에 손대지 않는다(부분수정 안전). * 빈 배열은 '전부 비웠다'는 명시적 의사표시로 보고 지운다. */ import { z } from 'zod'; import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { InternalApiClient } from '../client/internal-api.js'; /** Const::FORM_TYPE_* (internal-api/app/models/const.rb:2583-2586) */ export declare const CONTENT_TYPE_INPUT = 1; export declare const CONTENT_TYPE_IMAGE = 2; export declare const CONTENT_TYPE_HTML = 3; export declare const CONTENT_TYPE_BLOCK = 4; /** * Product::ContentBlock::BLOCK_TYPES * * ⚠️ 이 enum 에 없는 type 하나가 create_product/update_product 호출 전체를 반려한다(zod). * 서버가 새 블록을 알게 되면 여기도 같이 늘려야 한다 — cover 가 빠져 상세가 통째로 유실됐던 * 전례(2026-08-03)가 있다. 서버 BLOCK_TYPES 와 항상 같은 목록을 유지할 것. */ export declare const CONTENT_BLOCK_TYPES: readonly ["heading", "text", "image", "imageText", "features", "specs", "notice", "html", "subscriptionPlan", "cover", "steps", "stats", "faq", "compare", "policyBadges", "sizeGuide", "meterGroup", "fitFor"]; /** Product::ContentBlock 의 상한값 — 서버는 초과분을 조용히 잘라낸다(MAX_BLOCKS 만 오류) */ export declare const MAX_BLOCKS = 300; export declare const MAX_IMAGE_ITEMS = 50; export declare const MAX_FEATURE_ITEMS = 4; export declare const MAX_SPEC_ROWS = 100; export declare const MAX_STEP_ITEMS = 6; export declare const MAX_STAT_ITEMS = 4; export declare const MAX_FAQ_ITEMS = 5; export declare const MAX_COMPARE_COLUMNS = 3; export declare const MAX_COMPARE_ROWS = 8; export declare const MAX_SIZE_GUIDE_COLUMNS = 6; export declare const MAX_SIZE_GUIDE_ROWS = 10; export declare const MAX_METER_ITEMS = 5; export declare const MAX_METER_LEVEL = 5; export declare const MAX_FIT_FOR_ITEMS = 4; export declare const MAX_FIT_FOR_BAD_ITEMS = 3; /** 오버라인 라벨 상한 — 넘으면 제목 위에서 두 줄이 되어 라벨이 아니라 문장으로 읽힌다 */ export declare const MAX_EYEBROW_LENGTH = 24; /** * 서버 allowlist 미러 — 상수 이름은 Product::ContentBlock 의 것을 그대로 쓴다. * * ⚠️ 여기 없는 값 하나가 create_product/update_product 호출 **전체**를 반려한다(zod). * 반대로 서버가 모르는 값을 여기서 열면 저장은 성공하는데 화면에는 안 나오는 "되는 척"이 된다. * 두 방향 모두 __tests__/content-block-parity.test.ts 가 서버 소스(content_block.rb)와 직접 * 대조해 막는다 — 서버 트리를 읽을 수 있는 로컬 개발 환경에서만 도는 검사다(CI 에서는 skip). * @date: 26-08-26 (2.8.0 — 틴트 6종·아이콘 세트·비율 2종·오버라인·잘라내기 기준점) */ export declare const SECTION_TONES: readonly ["plain", "tint", "dark", "tint-warm", "tint-sand", "tint-sage", "tint-cool", "tint-blush", "tint-slate"]; export declare const SECTION_PADS: readonly ["wide"]; export declare const SECTION_ALIGNS: readonly ["center"]; export declare const TEXT_EMPHASES: readonly ["lead", "quote"]; export declare const FEATURE_PRESETS: readonly ["number", "icon", "rule"]; export declare const STEP_PRESETS: readonly ["card"]; export declare const COVER_POSITIONS: readonly ["tl", "tc", "c", "bc", "bl"]; export declare const COVER_DIMS: readonly [1, 2, 3]; export declare const COVER_HEIGHTS: readonly [1, 2, 3]; export declare const HEADING_LEVELS: readonly [2, 3]; export declare const TITLE_SIZES: readonly ["sm", "md", "lg", "xl"]; export declare const NOTICE_TONES: readonly ["info", "warning"]; export declare const IMAGE_RATIOS: readonly ["origin", "1:1", "4:3", "3:4", "16:9"]; export declare const IMAGE_LAYOUTS: readonly ["stack", "grid2", "grid3"]; export declare const IMAGE_WIDTHS: readonly ["xs", "sm", "md", "lg"]; export declare const ALIGNMENTS: readonly ["left", "right", "top", "bottom"]; export declare const VERTICAL_ALIGNMENTS: readonly ["top", "center", "bottom"]; export declare const BLOCK_SPACINGS: readonly ["none", "sm", "md", "lg", "xl"]; export declare const POLICY_BADGE_KEYS: readonly ["delivery", "dispatch", "refund"]; /** 서버가 저장하는 잘라내기 기준점 8칸(IMAGE_FOCUSES) — 사진에서 상품이 놓인 3×3 칸 */ export declare const IMAGE_FOCUSES: readonly ["tl", "tc", "tr", "cl", "cr", "bl", "bc", "br"]; /** * 스키마가 받는 값 = 저장되는 8칸 + 'c'(한가운데). * 'c' 는 종전 동작(기본값)이라 서버가 저장도 클래스 산출도 하지 않지만, 여기서 막으면 * "가운데를 살려라"는 가장 자연스러운 값 하나가 호출 전체를 반려시킨다. 받아서 무해하게 흘린다. */ export declare const IMAGE_FOCUS_INPUTS: readonly ["tl", "tc", "tr", "cl", "cr", "bl", "bc", "br", "c"]; /** * 내장 아이콘 세트 — features 의 icon 이 'set:이름' 이면 서버가 라인 아이콘(CSS mask)으로 낸다. * 이모지는 종전대로 글자로 나가므로 자유 입력을 계속 받는다(대신 4글자에서 잘린다). */ export declare const ICON_SET_PREFIX = "set:"; export declare const ICON_SET_NAMES: readonly ["truck", "box", "shield", "leaf", "ruler", "wash", "heat", "drop", "star", "heart", "check", "clock", "gift", "recycle", "warn", "sparkle"]; /** 'set:truck' → 'truck'. 세트 표기가 아니거나 모르는 이름이면 빈 문자열 (서버 _icon_set_name 과 같은 규칙) */ export declare function iconSetName(icon: string | undefined | null): string; /** 대조 감사(content-block-parity.test.ts)의 기준표 — 서버 상수명 → MCP 미러 */ export declare const SERVER_ENUM_MIRROR: Record; /** 같은 감사의 상한값 표 */ export declare const SERVER_LIMIT_MIRROR: Record; /** * image 블록의 items 와 features 블록의 items 는 항목 모양이 다르다. * 스키마를 9종 union 으로 쪼개면 도구 설명이 통째로 커지므로, 항목 하나에 두 모양을 합쳐 두고 * 어느 필드가 어느 블록의 것인지 설명과 앞단 검증(validateContentBlocks)으로 가른다. * 서버 _normalize_block 이 블록 종류에 필요한 키만 읽으므로 남는 키는 버려진다. */ export declare const contentBlockItemSchema: z.ZodObject<{ url: z.ZodOptional; alt: z.ZodOptional; caption: z.ZodOptional; width: z.ZodOptional; height: z.ZodOptional; bytes: z.ZodOptional; focus: z.ZodOptional>; originUrl: z.ZodOptional; icon: z.ZodOptional>; title: z.ZodOptional; text: z.ZodOptional; q: z.ZodOptional; a: z.ZodOptional; value: z.ZodOptional; unit: z.ZodOptional; label: z.ZodOptional; level: z.ZodOptional; low: z.ZodOptional; high: z.ZodOptional; }, "strip", z.ZodTypeAny, { q?: string | undefined; url?: string | undefined; title?: string | undefined; text?: string | undefined; value?: string | undefined; unit?: string | undefined; level?: number | undefined; alt?: string | undefined; caption?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; icon?: string | undefined; a?: string | undefined; label?: string | undefined; low?: string | undefined; high?: string | undefined; }, { q?: string | undefined; url?: string | undefined; title?: string | undefined; text?: string | undefined; value?: string | undefined; unit?: string | undefined; level?: number | undefined; alt?: string | undefined; caption?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; icon?: string | undefined; a?: string | undefined; label?: string | undefined; low?: string | undefined; high?: string | undefined; }>; export declare const contentBlockRowSchema: z.ZodObject<{ label: z.ZodOptional; value: z.ZodOptional; values: z.ZodOptional>; }, "strip", z.ZodTypeAny, { values?: string[] | undefined; value?: string | undefined; label?: string | undefined; }, { values?: string[] | undefined; value?: string | undefined; label?: string | undefined; }>; /** * 블록 1개. 필드는 전부 optional 이고 블록 종류에 따라 쓰는 필드가 다르다. * 값 범위(enum)는 여기서 막고, "비어서 상세에 안 나오는" 상황은 validateContentBlocks 가 잡는다. */ export declare const contentBlockSchema: z.ZodObject<{ type: z.ZodEnum<["heading", "text", "image", "imageText", "features", "specs", "notice", "html", "subscriptionPlan", "cover", "steps", "stats", "faq", "compare", "policyBadges", "sizeGuide", "meterGroup", "fitFor"]>; id: z.ZodOptional; text: z.ZodOptional; level: z.ZodOptional>; size: z.ZodOptional>; eyebrow: z.ZodOptional; eyebrowNumbered: z.ZodOptional; html: z.ZodOptional; items: z.ZodOptional; alt: z.ZodOptional; caption: z.ZodOptional; width: z.ZodOptional; height: z.ZodOptional; bytes: z.ZodOptional; focus: z.ZodOptional>; originUrl: z.ZodOptional; icon: z.ZodOptional>; title: z.ZodOptional; text: z.ZodOptional; q: z.ZodOptional; a: z.ZodOptional; value: z.ZodOptional; unit: z.ZodOptional; label: z.ZodOptional; level: z.ZodOptional; low: z.ZodOptional; high: z.ZodOptional; }, "strip", z.ZodTypeAny, { q?: string | undefined; url?: string | undefined; title?: string | undefined; text?: string | undefined; value?: string | undefined; unit?: string | undefined; level?: number | undefined; alt?: string | undefined; caption?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; icon?: string | undefined; a?: string | undefined; label?: string | undefined; low?: string | undefined; high?: string | undefined; }, { q?: string | undefined; url?: string | undefined; title?: string | undefined; text?: string | undefined; value?: string | undefined; unit?: string | undefined; level?: number | undefined; alt?: string | undefined; caption?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; icon?: string | undefined; a?: string | undefined; label?: string | undefined; low?: string | undefined; high?: string | undefined; }>, "many">>; ratio: z.ZodOptional>; layout: z.ZodOptional>; image: z.ZodOptional; alt: z.ZodOptional; width: z.ZodOptional; height: z.ZodOptional; bytes: z.ZodOptional; focus: z.ZodOptional>; originUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { url?: string | undefined; alt?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; }, { url?: string | undefined; alt?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; }>>; align: z.ZodOptional>; verticalAlign: z.ZodOptional>; imageWidth: z.ZodOptional>; rows: z.ZodOptional; value: z.ZodOptional; values: z.ZodOptional>; }, "strip", z.ZodTypeAny, { values?: string[] | undefined; value?: string | undefined; label?: string | undefined; }, { values?: string[] | undefined; value?: string | undefined; label?: string | undefined; }>, "many">>; headers: z.ZodOptional>; columns: z.ZodOptional, z.ZodLiteral<2>, z.ZodArray]>>; note: z.ZodOptional; good: z.ZodOptional>; bad: z.ZodOptional>; show: z.ZodOptional, "many">>; pos: z.ZodOptional>; dim: z.ZodOptional>; height: z.ZodOptional>; bleed: z.ZodOptional; section: z.ZodOptional>; sectionPad: z.ZodOptional>; sectionAlign: z.ZodOptional>; emphasis: z.ZodOptional>; preset: z.ZodOptional>; tone: z.ZodOptional>; title: z.ZodOptional; sharedId: z.ZodOptional; raw: z.ZodOptional; source: z.ZodOptional>; spacing: z.ZodOptional>; hint: z.ZodOptional; required: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "image" | "text" | "heading" | "imageText" | "features" | "specs" | "notice" | "html" | "subscriptionPlan" | "cover" | "steps" | "stats" | "faq" | "compare" | "policyBadges" | "sizeGuide" | "meterGroup" | "fitFor"; image?: { url?: string | undefined; alt?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; } | undefined; hint?: string | undefined; title?: string | undefined; text?: string | undefined; id?: string | undefined; source?: "manual" | "legacy" | "product" | undefined; section?: "dark" | "plain" | "tint" | "tint-warm" | "tint-sand" | "tint-sage" | "tint-cool" | "tint-blush" | "tint-slate" | undefined; html?: string | undefined; level?: number | undefined; size?: "sm" | "md" | "lg" | "xl" | undefined; eyebrow?: string | undefined; eyebrowNumbered?: boolean | undefined; height?: number | undefined; items?: { q?: string | undefined; url?: string | undefined; title?: string | undefined; text?: string | undefined; value?: string | undefined; unit?: string | undefined; level?: number | undefined; alt?: string | undefined; caption?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; icon?: string | undefined; a?: string | undefined; label?: string | undefined; low?: string | undefined; high?: string | undefined; }[] | undefined; ratio?: "origin" | "1:1" | "4:3" | "3:4" | "16:9" | undefined; layout?: "stack" | "grid2" | "grid3" | undefined; align?: "left" | "right" | "top" | "bottom" | undefined; verticalAlign?: "top" | "bottom" | "center" | undefined; imageWidth?: "sm" | "md" | "lg" | "xs" | undefined; rows?: { values?: string[] | undefined; value?: string | undefined; label?: string | undefined; }[] | undefined; headers?: string[] | undefined; columns?: string[] | 1 | 2 | undefined; note?: string | undefined; good?: string[] | undefined; bad?: string[] | undefined; show?: ("delivery" | "dispatch" | "refund")[] | undefined; pos?: "tl" | "tc" | "bl" | "bc" | "c" | undefined; dim?: number | undefined; bleed?: boolean | undefined; sectionPad?: "wide" | undefined; sectionAlign?: "center" | undefined; emphasis?: "lead" | "quote" | undefined; preset?: "number" | "card" | "icon" | "rule" | undefined; tone?: "info" | "warning" | undefined; sharedId?: string | undefined; raw?: string | undefined; spacing?: "sm" | "md" | "lg" | "xl" | "none" | undefined; required?: boolean | undefined; }, { type: "image" | "text" | "heading" | "imageText" | "features" | "specs" | "notice" | "html" | "subscriptionPlan" | "cover" | "steps" | "stats" | "faq" | "compare" | "policyBadges" | "sizeGuide" | "meterGroup" | "fitFor"; image?: { url?: string | undefined; alt?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; } | undefined; hint?: string | undefined; title?: string | undefined; text?: string | undefined; id?: string | undefined; source?: "manual" | "legacy" | "product" | undefined; section?: "dark" | "plain" | "tint" | "tint-warm" | "tint-sand" | "tint-sage" | "tint-cool" | "tint-blush" | "tint-slate" | undefined; html?: string | undefined; level?: number | undefined; size?: "sm" | "md" | "lg" | "xl" | undefined; eyebrow?: string | undefined; eyebrowNumbered?: boolean | undefined; height?: number | undefined; items?: { q?: string | undefined; url?: string | undefined; title?: string | undefined; text?: string | undefined; value?: string | undefined; unit?: string | undefined; level?: number | undefined; alt?: string | undefined; caption?: string | undefined; width?: number | undefined; height?: number | undefined; bytes?: number | undefined; focus?: "tl" | "tc" | "tr" | "cl" | "cr" | "bl" | "bc" | "br" | "c" | undefined; originUrl?: string | undefined; icon?: string | undefined; a?: string | undefined; label?: string | undefined; low?: string | undefined; high?: string | undefined; }[] | undefined; ratio?: "origin" | "1:1" | "4:3" | "3:4" | "16:9" | undefined; layout?: "stack" | "grid2" | "grid3" | undefined; align?: "left" | "right" | "top" | "bottom" | undefined; verticalAlign?: "top" | "bottom" | "center" | undefined; imageWidth?: "sm" | "md" | "lg" | "xs" | undefined; rows?: { values?: string[] | undefined; value?: string | undefined; label?: string | undefined; }[] | undefined; headers?: string[] | undefined; columns?: string[] | 1 | 2 | undefined; note?: string | undefined; good?: string[] | undefined; bad?: string[] | undefined; show?: ("delivery" | "dispatch" | "refund")[] | undefined; pos?: "tl" | "tc" | "bl" | "bc" | "c" | undefined; dim?: number | undefined; bleed?: boolean | undefined; sectionPad?: "wide" | undefined; sectionAlign?: "center" | undefined; emphasis?: "lead" | "quote" | undefined; preset?: "number" | "card" | "icon" | "rule" | undefined; tone?: "info" | "warning" | undefined; sharedId?: string | undefined; raw?: string | undefined; spacing?: "sm" | "md" | "lg" | "xl" | "none" | undefined; required?: boolean | undefined; }>; export type ContentBlockInput = z.infer; /** * content_type 을 명시하지 않은 호출에만 값을 추론한다. * * 이 함수 하나만 걷어내면 content_type 이 다시 '명시한 값 그대로'로 돌아간다(롤백 격리). * 명시한 값은 절대 덮어쓰지 않는다 — 기존 호출을 깨지 않는 것이 우선이다. */ export declare function resolveContentType(params: { content_type?: number; content_blocks?: ContentBlockInput[]; content?: string; }): number | undefined; export interface ContentBlockValidation { /** 값이 있으면 서버를 부르지 않고 그대로 오류로 돌려준다 */ error: string | null; /** 저장은 되지만 알려야 하는 것 — 응답 note 로 함께 내보낸다 */ warnings: string[]; } /** 구조화 경고에 상품 정보가 필요할 때 넘긴다 — 없으면 해당 규칙은 조용히 건너뛴다 */ export interface ContentBlockValidationContext { /** 상품 타입(Const::PRODUCT_TYPE_*). 0=기본(실물) 확정일 때만 policyBadges 유도가 걸린다 */ productType?: number; } /** 카드 글자에 걸리는 내장 아이콘 이름. 안 걸리면 빈 문자열 — 뜻이 어긋난 그림을 권하지 않는다 */ export declare function iconNameFor(text: string): string; /** * 블록 배열의 앞단 검증. * * 서버는 모양이 안 맞는 블록을 오류 없이 깎아내므로, 저장은 성공했는데 상세만 비는 일이 생긴다. * 그 조용한 실패를 여기서 미리 말해준다. */ export declare function validateContentBlocks(blocks: ContentBlockInput[] | undefined, context?: ContentBlockValidationContext): ContentBlockValidation; /** * content / content_type / content_blocks 조합 검증. * 서버가 조용히 무시하는 조합을 앞단에서 잡아 알려준다. */ export declare function validateContentInput(params: { content?: string; content_type?: number; content_blocks?: ContentBlockInput[]; }, context?: ContentBlockValidationContext): ContentBlockValidation; /** content(HTML) 경로로 저장했을 때 붙이는 안내 — 막지 않고 알리기만 한다 */ export declare const HTML_CONTENT_NOTE: string; /** 상세가 빈 상품에 붙이는 유도 문구 — create/update 응답의 next_step 에 그대로 들어간다 */ export declare const EMPTY_DETAIL_NEXT_STEP: string; /** * 공용 블록 · 내 템플릿 도구. * 상세설명 블록의 재사용 경로 — 반복되는 안내는 공용 블록으로, 상세 한 벌은 템플릿으로 관리한다. */ export declare function registerContentBlockTools(server: McpServer, internalApi: InternalApiClient): void; //# sourceMappingURL=content-block.d.ts.map