import { useCallback } from 'react';
import { useWixPatternsContainer, useCollectionContext } from '../providers';
import { ImportState, } from '../state';
export function useCreateImport(params) {
    const { config, detectColumnType, importModalState } = params;
    const { showToast, translate, errorHandler, window, httpClient } = useWixPatternsContainer();
    const collection = useCollectionContext();
    return useCallback(() => {
        return new ImportState({
            config,
            httpClient,
            detectColumnType,
            collection,
            importModalState,
            showToast,
            translate,
            errorHandler,
            downloadCsv: (content, fileName) => {
                window.download(`data:text/csv;charset=utf-8,${encodeURIComponent(content)}`, fileName);
            },
        });
    }, []);
}
//# sourceMappingURL=useImport.js.map