/** * Component analysis result */ export interface ComponentInfo { componentName: string; interfaceName: null | string; hasDecorators: boolean; props: PropInfo[]; exportType: 'default' | 'named'; filePath: string; } /** * Property information extracted from component interface */ export interface PropInfo { name: string; type: string; optional: boolean; isComplex: boolean; isUIOnly: boolean; } /** * Type suggestion for attribute configuration */ export interface TypeSuggestion { type: string; reason: string; priority: 'high' | 'low' | 'medium'; } /** * Valid SFCC Page Designer attribute types */ export declare const VALID_ATTRIBUTE_TYPES: readonly ["string", "text", "markup", "integer", "boolean", "product", "category", "file", "page", "image", "url", "enum", "custom", "cms_record"]; /** * Infer Page Designer attribute type from TypeScript type */ export declare function inferPageDesignerType(tsType: string): string; /** * Check if TypeScript type can be auto-inferred */ export declare function isAutoInferredType(tsType: string): boolean; /** * Check if type is too complex for Page Designer */ export declare function isComplexType(tsType: string): boolean; /** * Check if property is UI-only */ export declare function isUIOnlyProp(propName: string): boolean; /** * Generate Page Designer attribute type suggestions for a component prop * * **Inference Strategy:** * Uses naming patterns and TypeScript types to suggest appropriate Page Designer types. * This reduces manual configuration by auto-detecting common patterns. * * **Page Designer Types:** * - `string`: Default text input * - `url`: URL/link inputs (validates URL format) * - `image`: Image asset picker * - `html`: Rich text editor * - `markup`: HTML/markdown editor * - `enum`: Dropdown with predefined values * - `boolean`: Checkbox * - `number`: Numeric input * - `product`: Product picker (SFCC-specific) * - `category`: Category picker (SFCC-specific) * * **Heuristics (by priority):** * 1. **High Priority**: Strong patterns (url, image, product) * 2. **Medium Priority**: Contextual patterns (html, markup) * 3. **Low Priority**: Weak signals (description → markup) * * Multiple suggestions allow developers to choose the best fit. * * @param propName - Property name from component interface * @param tsType - TypeScript type string * @returns Array of type suggestions with reasoning and priority * * @example * // URL detection: * generateTypeSuggestions('imageUrl', 'string') * // => [{ type: 'url', reason: '...', priority: 'high' }] * * @example * // Image detection: * generateTypeSuggestions('heroImage', 'string') * // => [{ type: 'image', reason: '...', priority: 'high' }] * * @example * // Multiple suggestions: * generateTypeSuggestions('description', 'string') * // => [ * // { type: 'markup', reason: '...', priority: 'low' }, * // { type: 'html', reason: '...', priority: 'medium' } * // ] * * @example * // Product reference: * generateTypeSuggestions('product', 'string') * // => [{ type: 'product', reason: '...', priority: 'high' }] * * @public */ export declare function generateTypeSuggestions(propName: string, tsType: string): TypeSuggestion[]; /** * Component analyzer for Page Designer decorator generation */ declare class ComponentAnalyzer { private cache; analyzeComponent(filePath: string): ComponentInfo; clearCache(): void; } export declare const componentAnalyzer: ComponentAnalyzer; /** * Resolve component input (name or path) to absolute file path * * **This is the main entry point for component discovery.** * * Supports two input modes: * 1. **Name-based** (recommended): Just provide the component name * 2. **Path-based** (backward compatible): Provide relative path from workspace * * **Name-based detection:** * Input is treated as a name if it: * - Does NOT contain path separators (/ or \) * - Does NOT have a file extension (.tsx, .ts, etc.) * * **Path-based detection:** * Input is treated as a path if it: * - Contains / or \ * - Has a file extension * * @param input - Component name or relative path * @param workspaceRoot - Absolute path to workspace root * @param searchPaths - Additional directories to search (only used for name-based) * @returns Absolute file path to component * @throws {Error} If component cannot be found, with detailed search information * * @example * // Name-based (finds automatically): * resolveComponent('ProductCard', '/workspace') * // => '/workspace/src/components/product-tile/ProductCard.tsx' * * @example * // Path-based (backward compatible): * resolveComponent('src/components/ProductCard.tsx', '/workspace') * // => '/workspace/src/components/ProductCard.tsx' * * @example * // With custom search paths (for monorepos): * resolveComponent('Hero', '/workspace', ['packages/retail/src', 'packages/shared']) * // => '/workspace/packages/retail/src/components/Hero.tsx' * * @example * // Error handling: * try { * resolveComponent('NonExistent', '/workspace') * } catch (err) { * // Error includes: * // - List of searched locations * // - Tried name variations * // - Helpful tips for resolution * } * * @public */ export declare function resolveComponent(input: string, workspaceRoot: string, searchPaths?: string[]): string; export {};