import { PresetCategory, PresetOption } from '../components/PresetSelector/PresetSelector.types'; import { Preset } from '../types'; /** * Web-app preset structure (from appstore.js globalPresets and singlePresets) */ export interface WebAppPreset { _id?: string; id?: string; name: string; fileType?: string; fileSize?: string; customWidth?: number; customHeight?: number; isGlobal?: boolean; } /** * Convert a single web-app preset object to the new PresetOption interface * * @param preset - Web-app preset object * @param isOriginal - Whether this represents the original file (no transformation) * @returns PresetOption object compatible with PresetSelector component * * @example * ```typescript * const webAppPreset = { * _id: 'preset123', * name: 'Thumbnail', * fileType: 'jpg', * customWidth: 150, * customHeight: 150 * }; * * const preset = adaptPreset(webAppPreset); * // Returns: { id: 'preset123', name: 'Thumbnail', fileType: 'jpg', dimensions: { width: 150, height: 150 } } * ``` */ export declare function adaptPreset(preset: WebAppPreset, isOriginal?: boolean): PresetOption; /** * Create an "Original" preset option for when no transformation is needed * * @param name - Display name for the original option * @returns PresetOption representing the original file * * @example * ```typescript * const originalPreset = createOriginalPreset(); * // Returns: { id: 'original', name: 'Original', isOriginal: true } * ``` */ export declare function createOriginalPreset(name?: string): PresetOption; /** * Convert web-app single presets and global presets into PresetOption array * * @param singlePresets - Asset-specific presets from the API * @param globalPresets - Global presets available for all assets * @param includeOriginal - Whether to include the "Original" option * @returns Array of PresetOption objects * * @example * ```typescript * const singlePresets = resource.presets || []; * const globalPresets = appStore.globalPresets || []; * * const presets = adaptPresets(singlePresets, globalPresets); * ``` */ export declare function adaptPresets(singlePresets?: WebAppPreset[], globalPresets?: WebAppPreset[], includeOriginal?: boolean): PresetOption[]; /** * Convert web-app presets into categorized PresetCategory array * * @param singlePresets - Asset-specific presets * @param globalPresets - Global presets * @param includeOriginal - Whether to include the "Original" option * @returns Array of PresetCategory objects for categorized display * * @example * ```typescript * const categories = adaptPresetsWithCategories(singlePresets, globalPresets); * // Returns: [ * // { label: 'File', presets: [{ name: 'Original', isOriginal: true }] }, * // { label: 'Asset Presets', presets: [...] }, * // { label: 'Global Presets', presets: [...] } * // ] * ``` */ export declare function adaptPresetsWithCategories(singlePresets?: WebAppPreset[], globalPresets?: WebAppPreset[], includeOriginal?: boolean): PresetCategory[]; /** * Find a preset by ID from the combined list of single and global presets * * @param presetId - ID of the preset to find * @param singlePresets - Asset-specific presets * @param globalPresets - Global presets * @returns The found WebAppPreset or undefined */ export declare function findWebAppPreset(presetId: string, singlePresets?: WebAppPreset[], globalPresets?: WebAppPreset[]): WebAppPreset | undefined; /** * Get the full preset information (merged from web-app format) * This replicates the getFullPreset logic from messages.js * * @param presetId - ID of the preset * @param singlePresets - Asset-specific presets * @param globalPresets - Global presets * @returns Preset information or undefined if not found */ export declare function getFullPreset(presetId: string | undefined, singlePresets?: WebAppPreset[], globalPresets?: WebAppPreset[]): Preset | undefined; /** * Type guard to check if an object is a valid WebAppPreset */ export declare function isWebAppPreset(obj: unknown): obj is WebAppPreset; //# sourceMappingURL=preset-adapter.d.ts.map