import { useCallback, useState } from 'react';
import { ViewsState } from '../state';
import { useWixPatternsContainer } from '@wix/bex-core/react';
import { presetsToCategories } from '../state/presetsToCategories';
export function useCreateViews() {
    const container = useWixPatternsContainer();
    return useCallback((config) => {
        const { namespace, presets, initialSelect, fqdn, allItemsViewProps } = config;
        return new ViewsState({
            oldNamespace: namespace,
            presets: presetsToCategories(presets),
            container,
            initialSelect,
            fqdn,
            allItemsViewProps,
            reportBI: () => { },
        });
    }, []);
}
export const useViews = (config) => {
    const createViews = useCreateViews();
    const [state] = useState(() => createViews(config));
    return state;
};
//# sourceMappingURL=useViews.js.map