import { WebAppResource } from './asset-adapter';
import { WebAppFolder } from './folder-adapter';
import { WebAppPreset } from './preset-adapter';
import { PaginationInfo } from '../components/AssetBrowser/AssetBrowser.types';
import { TreeFolder } from '../components/FolderTree/FolderTree.types';
import { Asset, Folder } from '../types';
export { adaptResource, adaptResources } from './asset-adapter';
export { adaptFolder, adaptFolders, adaptFoldersToTree, buildFolderTree } from './folder-adapter';
export { adaptPreset, adaptPresets, adaptPresetsWithCategories } from './preset-adapter';
/**
* Web-app gridData structure (from appstore.js)
*/
export interface WebAppGridData {
folder?: WebAppFolder[];
resource?: WebAppResource[];
parentFolder?: WebAppFolder;
currentFolder?: WebAppFolder;
pagination?: {
count?: number;
pageNumber?: number;
pageSize?: number;
};
}
/**
* Web-app appStore structure (relevant fields)
*/
export interface WebAppAppStore {
gridData?: WebAppGridData;
folderData?: WebAppFolder[];
currentFolderId?: string;
expandedFolderIds?: string[];
loading?: boolean;
isLoading?: boolean;
globalPresets?: WebAppPreset[];
pageCounter?: number;
}
/**
* Web-app authStore structure (relevant fields)
*/
export interface WebAppAuthStore {
isAuthenticated?: boolean;
user?: {
_id?: string;
name?: string;
};
}
/**
* Props returned for AssetBrowser component from store adapter
*/
export interface AdaptedAssetBrowserProps {
folders: Folder[];
assets: Asset[];
loading: boolean;
pagination: PaginationInfo;
currentFolder?: Folder;
parentFolder?: Folder;
}
/**
* Props returned for FolderTree component from store adapter
*/
export interface AdaptedFolderTreeProps {
folders: TreeFolder[];
selectedId: string | null;
expandedIds: string[];
}
/**
* Extract asset browser data from appStore and authStore
*
* @param appStore - MobX appStore instance from web-app
* @param _authStore - MobX authStore instance from web-app (reserved for future use)
* @returns Props compatible with new asset browser components
*
* @example
* ```typescript
* import { appStore, authStore } from '../stores';
* import { getAssetBrowserProps } from '@intelligencebank/integration-components/adapters';
*
* const AssetBrowser = observer(() => {
* const props = getAssetBrowserProps(appStore, authStore);
* return ;
* });
* ```
*/
export declare function getAssetBrowserProps(appStore: WebAppAppStore, _authStore?: WebAppAuthStore): AdaptedAssetBrowserProps;
/**
* Extract folder tree data from appStore
*
* @param appStore - MobX appStore instance from web-app
* @returns Props compatible with FolderTree component
*
* @example
* ```typescript
* import { appStore } from '../stores';
* import { getFolderTreeProps } from '@intelligencebank/integration-components/adapters';
*
* const FolderTreeView = observer(() => {
* const props = getFolderTreeProps(appStore);
* return ;
* });
* ```
*/
export declare function getFolderTreeProps(appStore: WebAppAppStore): AdaptedFolderTreeProps;
/**
* Extract pagination info from appStore
*
* @param appStore - MobX appStore instance
* @returns PaginationInfo object
*/
export declare function getPaginationInfo(appStore: WebAppAppStore): PaginationInfo;
/**
* Extract a single folder from gridData
*
* @param appStore - MobX appStore instance
* @param index - Index of the folder in gridData.folder array
* @returns Folder object or undefined if not found
*/
export declare function getFolderByIndex(appStore: WebAppAppStore, index: number): Folder | undefined;
/**
* Extract a single asset from gridData
*
* @param appStore - MobX appStore instance
* @param index - Index of the resource in gridData.resource array
* @returns Asset object or undefined if not found
*/
export declare function getAssetByIndex(appStore: WebAppAppStore, index: number): Asset | undefined;
/**
* Get the currently selected/active folder
*
* @param appStore - MobX appStore instance
* @returns The current folder or undefined
*/
export declare function getCurrentFolder(appStore: WebAppAppStore): Folder | undefined;
/**
* Get presets with categories from appStore
*
* @param appStore - MobX appStore instance
* @param singlePresets - Asset-specific presets
* @returns Categorized preset array
*/
export declare function getPresetCategories(appStore: WebAppAppStore, singlePresets?: WebAppPreset[]): import('../components/PresetSelector').PresetCategory[];
/**
* Get flat list of presets from appStore
*
* @param appStore - MobX appStore instance
* @param singlePresets - Asset-specific presets
* @returns Flat preset array
*/
export declare function getPresetOptions(appStore: WebAppAppStore, singlePresets?: WebAppPreset[]): import('../components/PresetSelector').PresetOption[];
//# sourceMappingURL=store-adapter.d.ts.map