@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
240 lines (215 loc) • 7.02 kB
text/typescript
// AgentC Template System - Unified Component Library
// 모든 티어의 템플릿 컴포넌트를 통합 관리
// =============================================================================
// Tier-specific Exports
// =============================================================================
// Starter Tier
export * from "./starter";
export { STARTER_COMPONENTS, type StarterComponentType } from "./starter";
// Standard Tier
export * from "./standard";
export { STANDARD_COMPONENTS, type StandardComponentType } from "./standard";
// Plus Tier
export * from "./plus";
export { PLUS_COMPONENTS, type PlusComponentType } from "./plus";
// =============================================================================
// Template Classes
// =============================================================================
export { StarterTemplate } from "../../lib/template-system/tiers/starter-template";
export { StandardTemplate } from "../../lib/template-system/tiers/standard-template";
export { PlusTemplate } from "../../lib/template-system/tiers/plus-template";
// =============================================================================
// Core Template System
// =============================================================================
export { TemplateBase } from "../../lib/template-system/base-template";
export { AgentCTemplateFactory } from "../../lib/template-system/template-factory";
export { AgentCTemplateManager } from "../../lib/template-system/template-manager";
export { TemplateComponentRegistry } from "../../lib/template-system/component-registry";
// =============================================================================
// Types and Interfaces
// =============================================================================
export * from "../../types/template-system";
// =============================================================================
// Component Registry & Utility Functions
// =============================================================================
import { ServiceTier, ComponentType } from "../../types/template-system";
/**
* 서비스 티어별 사용 가능한 컴포넌트 타입 매핑
*/
export const TIER_COMPONENT_MAP = {
[]: [
ComponentType.HERO,
ComponentType.ABOUT,
ComponentType.CONTACT,
ComponentType.FOOTER,
],
[]: [
ComponentType.HERO,
ComponentType.ABOUT,
ComponentType.SERVICES,
ComponentType.TESTIMONIALS,
ComponentType.PORTFOLIO,
ComponentType.CONTACT,
ComponentType.FOOTER,
],
[]: [
ComponentType.HERO,
ComponentType.ABOUT,
ComponentType.SERVICES,
ComponentType.TESTIMONIALS,
ComponentType.PORTFOLIO,
ComponentType.TEAM,
ComponentType.PRICING,
ComponentType.FAQ,
ComponentType.CONTACT,
ComponentType.FOOTER,
ComponentType.BLOG, // Plus 전용
],
} as const;
/**
* 서비스 티어별 최대 컴포넌트 수 제한
*/
export const TIER_COMPONENT_LIMITS = {
[]: 4,
[]: 7,
[]: Infinity, // 무제한 (성능 경고는 15개부터)
} as const;
/**
* 특정 티어에서 컴포넌트 타입이 허용되는지 확인
*/
export function isComponentAllowedInTier(
componentType: ComponentType,
tier: ServiceTier
): boolean {
return TIER_COMPONENT_MAP[tier].includes(componentType);
}
/**
* 티어별 사용 가능한 컴포넌트 타입 목록 반환
*/
export function getAvailableComponentsForTier(
tier: ServiceTier
): ComponentType[] {
return [...TIER_COMPONENT_MAP[tier]];
}
/**
* 컴포넌트 타입에서 최소 필요 티어 반환
*/
export function getMinimumTierForComponent(
componentType: ComponentType
): ServiceTier {
for (const [tier, components] of Object.entries(TIER_COMPONENT_MAP)) {
if (components.includes(componentType)) {
return tier as ServiceTier;
}
}
throw new Error(`Unknown component type: ${componentType}`);
}
/**
* 티어 업그레이드 시 사용 가능해지는 새로운 컴포넌트들 반환
*/
export function getNewComponentsAfterUpgrade(
fromTier: ServiceTier,
toTier: ServiceTier
): ComponentType[] {
const fromComponents = TIER_COMPONENT_MAP[fromTier];
const toComponents = TIER_COMPONENT_MAP[toTier];
return toComponents.filter(
(component) => !fromComponents.includes(component)
);
}
/**
* 서비스 티어 정보
*/
export const TIER_INFO = {
[]: {
name: "스타터",
description: "개인 사용자나 소규모 프로젝트에 적합",
price: { monthly: 9900, yearly: 99000 },
maxComponents: 4,
features: ["기본 템플릿", "기본 커스터마이징", "이메일 지원"],
},
[]: {
name: "스탠다드",
description: "성장하는 비즈니스를 위한 완벽한 솔루션",
price: { monthly: 29900, yearly: 299000 },
maxComponents: 7,
features: ["고급 컴포넌트", "비즈니스 기능", "우선 지원", "분석 도구"],
},
[]: {
name: "플러스",
description: "대규모 조직을 위한 프리미엄 솔루션",
price: { monthly: 99900, yearly: 999000 },
maxComponents: Infinity,
features: [
"모든 기능",
"고급 분석",
"화이트라벨",
"24/7 지원",
"API 액세스",
],
},
} as const;
/**
* 컴포넌트별 사용 복잡도 (1-5)
*/
export const COMPONENT_COMPLEXITY = {
[]: 1,
[]: 1,
[]: 2,
[]: 1,
[]: 3,
[]: 3,
[]: 4,
[]: 4,
[]: 5,
[]: 3,
[]: 5,
} as const;
/**
* 템플릿의 총 복잡도 계산
*/
export function calculateTemplateComplexity(
componentTypes: ComponentType[]
): number {
return componentTypes.reduce((total, type) => {
return total + (COMPONENT_COMPLEXITY[type] || 1);
}, 0);
}
/**
* 권장 컴포넌트 조합 (용도별)
*/
export const RECOMMENDED_COMPONENT_SETS = {
"landing-page": [
ComponentType.HERO,
ComponentType.SERVICES,
ComponentType.TESTIMONIALS,
ComponentType.CONTACT,
ComponentType.FOOTER,
],
"corporate-website": [
ComponentType.HERO,
ComponentType.ABOUT,
ComponentType.SERVICES,
ComponentType.TEAM,
ComponentType.CONTACT,
ComponentType.FOOTER,
],
"portfolio-site": [
ComponentType.HERO,
ComponentType.ABOUT,
ComponentType.PORTFOLIO,
ComponentType.TESTIMONIALS,
ComponentType.CONTACT,
ComponentType.FOOTER,
],
"saas-product": [
ComponentType.HERO,
ComponentType.SERVICES,
ComponentType.PRICING,
ComponentType.FAQ,
ComponentType.TESTIMONIALS,
ComponentType.CONTACT,
ComponentType.FOOTER,
],
} as const;
export type RecommendedComponentSet = keyof typeof RECOMMENDED_COMPONENT_SETS;